diff --git a/resources/lib/connect/credentials.py b/resources/lib/connect/credentials.py index 4712a7c2..5a61512e 100644 --- a/resources/lib/connect/credentials.py +++ b/resources/lib/connect/credentials.py @@ -34,7 +34,7 @@ class Credentials(object): if self.credentials is None: try: with open(os.path.join(self.path, 'data.txt')) as infile: - self.credentials = json.load(infile) + self.credentials = json.load(unicode(infile)) except Exception as e: # File is either empty or missing log.warn(e) @@ -54,7 +54,7 @@ class Credentials(object): self.credentials = data # Set credentials to file with open(os.path.join(self.path, 'data.txt'), 'w') as outfile: - json.dump(data, outfile, indent=4, ensure_ascii=False) + json.dump(unicode(data), outfile, indent=4, ensure_ascii=False) else: self._clear() diff --git a/resources/lib/objects/_common.py b/resources/lib/objects/_common.py index 0f022e3d..f683343e 100644 --- a/resources/lib/objects/_common.py +++ b/resources/lib/objects/_common.py @@ -62,10 +62,11 @@ class Items(object): @classmethod def path_validation(cls, path): # Verify if direct path is accessible or not + verify_path = path if not os.path.supports_unicode_filenames: - path = path.encode('utf-8') + verify_path = path.encode('utf-8') - if window('emby_pathverified') != "true" and not xbmcvfs.exists(path): + if window('emby_pathverified') != "true" and not xbmcvfs.exists(verify_path): if dialog(type_="yesno", heading="{emby}", line1="%s %s. %s" % (lang(33047), path, lang(33048))): diff --git a/resources/lib/objects/_kodi_common.py b/resources/lib/objects/_kodi_common.py index bc703a53..59ed5041 100644 --- a/resources/lib/objects/_kodi_common.py +++ b/resources/lib/objects/_kodi_common.py @@ -746,8 +746,8 @@ class KodiItems(object): tag_id = self.cursor.fetchone()[0] + 1 query = "INSERT INTO tag(idTag, strTag) values(?, ?)" - self.cursor.execute(query, (tag_id, name)) - log.debug("Create idTag: %s name: %s", tag_id, name) + self.cursor.execute(query, (tag_id, tag)) + log.debug("Create idTag: %s name: %s", tag_id, tag) finally: # Assign tag to item diff --git a/resources/lib/objects/music.py b/resources/lib/objects/music.py index dc560481..3ee40d4d 100644 --- a/resources/lib/objects/music.py +++ b/resources/lib/objects/music.py @@ -528,8 +528,11 @@ class Music(Items): artist_full = emby.getItem(artist_eid) self.add_updateArtist(artist_full) artist_edb = emby_db.getItem_byId(artist_eid) - artistid = artist_edb[0] - finally: + artistid = artist_edb[0] if artist_edb else None + except Exception: + artistid = None + + if artistid: # Link song to artist self.kodi_db.link_song_artist(artistid, songid, index, artist_name)