Fix IndexError on deleting items

This commit is contained in:
tomkat83 2016-10-11 18:28:07 +02:00
parent 56a1855762
commit d069fc7c48

View file

@ -1491,10 +1491,13 @@ class LibrarySync(Thread):
"processing queue" for later "processing queue" for later
""" """
for item in data: for item in data:
typus = item.get('type') typus = int(item.get('type', 0))
state = item.get('state') state = int(item.get('state', 0))
if state == 9 or typus in (1, 4, 10): if state == 9 or typus in (1, 4, 10):
itemId = item.get('itemID') itemId = str(item.get('itemID', '0'))
if itemId == '0':
log.warn('Received malformed PMS message: %s' % item)
continue
# Have we already added this element? # Have we already added this element?
for existingItem in self.itemsToProcess: for existingItem in self.itemsToProcess:
if existingItem['ratingKey'] == itemId: if existingItem['ratingKey'] == itemId: