* Fix typos

* Indicate unicode dict

* Fix artistid

* Attempt to fix encoding
This commit is contained in:
angelblue05 2016-10-29 03:15:16 -05:00 committed by GitHub
parent ba22e26c06
commit 85d054f33a
4 changed files with 12 additions and 8 deletions

View file

@ -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()

View file

@ -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))):

View file

@ -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

View file

@ -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)