Fix AttributeError

This commit is contained in:
tomkat83 2016-09-04 17:19:00 +02:00
parent ee6e441628
commit 3f55754908

View file

@ -67,7 +67,6 @@ class Items(object):
def itemsbyId(self, items, process, pdialog=None): def itemsbyId(self, items, process, pdialog=None):
# Process items by itemid. Process can be added, update, userdata, remove # Process items by itemid. Process can be added, update, userdata, remove
emby = self.emby
embycursor = self.embycursor embycursor = self.embycursor
kodicursor = self.kodicursor kodicursor = self.kodicursor
music_enabled = self.music_enabled music_enabled = self.music_enabled
@ -1475,7 +1474,6 @@ class Music(Items):
def add_updateSong(self, item, viewtag=None, viewid=None): def add_updateSong(self, item, viewtag=None, viewid=None):
# Process single song # Process single song
kodicursor = self.kodicursor kodicursor = self.kodicursor
emby = self.emby
emby_db = self.emby_db emby_db = self.emby_db
artwork = self.artwork artwork = self.artwork
API = PlexAPI.API(item) API = PlexAPI.API(item)
@ -1700,7 +1698,6 @@ class Music(Items):
artistid = artist_edb[0] artistid = artist_edb[0]
except TypeError: except TypeError:
# Artist is missing from emby database, add it. # Artist is missing from emby database, add it.
artist_full = emby.getItem(artist_eid)
artistXml = GetPlexMetadata(artist_eid) artistXml = GetPlexMetadata(artist_eid)
if artistXml is None or artistXml == 401: if artistXml is None or artistXml == 401:
log.error('Error getting artist, abort') log.error('Error getting artist, abort')
@ -1747,8 +1744,11 @@ class Music(Items):
artistid = artist_edb[0] artistid = artist_edb[0]
except TypeError: except TypeError:
# Artist is missing from emby database, add it. # Artist is missing from emby database, add it.
artist_full = emby.getItem(artist_eid) artistXml = GetPlexMetadata(artist_eid)
self.add_updateArtist(artist_full) if artistXml is None or artistXml == 401:
log.error('Error getting artist, abort')
return
self.add_updateArtist(artistXml)
artist_edb = emby_db.getItem_byId(artist_eid) artist_edb = emby_db.getItem_byId(artist_eid)
artistid = artist_edb[0] artistid = artist_edb[0]
finally: finally: