Add fix for missing key

This commit is contained in:
angelblue05 2015-12-31 22:19:36 -06:00
parent 7a19f010dc
commit 227bb3eb42
2 changed files with 7 additions and 3 deletions

View File

@ -2280,10 +2280,14 @@ class Music(Items):
# Add path
pathid = kodi_db.addPath(path)
# Get the album
emby_dbalbum = emby_db.getItem_byId(item['AlbumId'])
try:
# Get the album
emby_dbalbum = emby_db.getItem_byId(item['AlbumId'])
albumid = emby_dbalbum[0]
except KeyError:
# No album Id associated to the song.
self.logMsg("Song itemid: %s has no albumId." % itemid, 1)
return
except TypeError:
# No album found, create a single's album
kodicursor.execute("select coalesce(max(idAlbum),0) from album")

View File

@ -358,7 +358,7 @@ class LibrarySync(threading.Thread):
# Media folders are grouped into userview
for grouped_view in grouped_views:
if (grouped_view['Type'] == "UserView" and
grouped_view['CollectionType'] == mediatype):
grouped_view.get('CollectionType') == mediatype):
# Take the name of the userview
foldername = grouped_view['Name']
break