Fix backgroundsync KeyError

This commit is contained in:
tomkat83 2016-09-17 19:12:32 +02:00
parent ee4f1517d5
commit 9c74fd4a98

View file

@ -1399,11 +1399,9 @@ class LibrarySync(Thread):
if item['state'] == 9:
successful = self.process_deleteditems(item)
else:
successful = self.process_newitems(item)
if successful is True:
deleteListe.append(i)
if (settings('FanartTV') == 'true' and
item['mediatype'] in ('movie')):
successful, item = self.process_newitems(item)
if successful and settings('FanartTV') == 'true':
if item['mediatype'] in ('movie', 'show'):
mediaType = {'movie': 'Movie'}[item['mediatype']]
cls = {'movie': 'Movies'}[item['mediatype']]
self.fanartqueue.put({
@ -1412,6 +1410,8 @@ class LibrarySync(Thread):
'mediaType': mediaType,
'refresh': False
})
if successful is True:
deleteListe.append(i)
else:
# Safety net if we can't process an item
item['attempt'] += 1
@ -1437,7 +1437,7 @@ class LibrarySync(Thread):
xml = PF.GetPlexMetadata(ratingKey)
if xml in (None, 401):
log.error('Could not download data for %s, skipping' % ratingKey)
return False
return False, item
log.debug("Processing new/updated PMS item: %s" % ratingKey)
viewtag = xml.attrib.get('librarySectionTitle')
viewid = xml.attrib.get('librarySectionID')
@ -1462,7 +1462,7 @@ class LibrarySync(Thread):
music.add_updateSong(xml[0],
viewtag=viewtag,
viewid=viewid)
return True
return True, item
def process_deleteditems(self, item):
if item.get('type') == 1: