From 9c74fd4a9899f54742565f823cdf89d89823efe4 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Sat, 17 Sep 2016 19:12:32 +0200 Subject: [PATCH] Fix backgroundsync KeyError --- resources/lib/librarysync.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index a3f25bdc..2f3e095a 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -1399,19 +1399,19 @@ class LibrarySync(Thread): if item['state'] == 9: successful = self.process_deleteditems(item) else: - successful = self.process_newitems(item) + 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({ + 'itemId': item['ratingKey'], + 'class': cls, + 'mediaType': mediaType, + 'refresh': False + }) if successful is True: deleteListe.append(i) - if (settings('FanartTV') == 'true' and - item['mediatype'] in ('movie')): - mediaType = {'movie': 'Movie'}[item['mediatype']] - cls = {'movie': 'Movies'}[item['mediatype']] - self.fanartqueue.put({ - 'itemId': item['ratingKey'], - 'class': cls, - 'mediaType': mediaType, - 'refresh': False - }) 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: