diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 68eba341..6e8c4a0c 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -1347,12 +1347,12 @@ class LibrarySync(Thread): # We haven't waited long enough for the PMS to finish # processing the item. Do it later continue - if item['state'] == 5: - if self.process_newitems(item) is True: - deleteListe.append(i) - elif item['state'] == 9: + if item['state'] == 9: if self.process_deleteditems(item) is True: deleteListe.append(i) + else: + if self.process_newitems(item) is True: + deleteListe.append(i) # Get rid of the items we just processed if len(deleteListe) > 0: @@ -1423,15 +1423,22 @@ class LibrarySync(Thread): "processing queue" for later """ for item in data: - state = item.get('state') typus = item.get('type') - if state == 9 or (state == 5 and typus in (1, 4, 10)): - self.itemsToProcess.append({ - 'state': state, - 'type': typus, - 'ratingKey': item.get('itemID'), - 'timestamp': utils.getUnixTimestamp() - }) + state = item.get('state') + if state == 9 or typus in (1, 4, 10): + itemId = item.get('itemID') + # Have we already added this element? + for existingItem in self.itemsToProcess: + if existingItem['ratingKey'] == itemId: + break + else: + # Haven't added this element to the queue yet + self.itemsToProcess.append({ + 'state': state, + 'type': typus, + 'ratingKey': itemId, + 'timestamp': utils.getUnixTimestamp() + }) def process_playing(self, data): """ diff --git a/resources/settings.xml b/resources/settings.xml index 191c9103..20c87ae2 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -52,7 +52,7 @@ - +