Fix new episodes not being detected

- Set standard safety margin to 60 seconds. Otherwise, you might get
many screen refreshes
- Fixes #23
This commit is contained in:
tomkat83 2016-05-12 21:46:50 +02:00
parent 04c415604d
commit 5bf1a5a8e0
2 changed files with 20 additions and 13 deletions

View file

@ -1347,12 +1347,12 @@ class LibrarySync(Thread):
# We haven't waited long enough for the PMS to finish # We haven't waited long enough for the PMS to finish
# processing the item. Do it later # processing the item. Do it later
continue continue
if item['state'] == 5: if item['state'] == 9:
if self.process_newitems(item) is True:
deleteListe.append(i)
elif item['state'] == 9:
if self.process_deleteditems(item) is True: if self.process_deleteditems(item) is True:
deleteListe.append(i) deleteListe.append(i)
else:
if self.process_newitems(item) is True:
deleteListe.append(i)
# Get rid of the items we just processed # Get rid of the items we just processed
if len(deleteListe) > 0: if len(deleteListe) > 0:
@ -1423,13 +1423,20 @@ class LibrarySync(Thread):
"processing queue" for later "processing queue" for later
""" """
for item in data: for item in data:
state = item.get('state')
typus = item.get('type') typus = item.get('type')
if state == 9 or (state == 5 and typus in (1, 4, 10)): 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({ self.itemsToProcess.append({
'state': state, 'state': state,
'type': typus, 'type': typus,
'ratingKey': item.get('itemID'), 'ratingKey': itemId,
'timestamp': utils.getUnixTimestamp() 'timestamp': utils.getUnixTimestamp()
}) })

View file

@ -52,7 +52,7 @@
<setting type="lsep" label="39052" /><!-- Background Sync --> <setting type="lsep" label="39052" /><!-- Background Sync -->
<setting id="enableBackgroundSync" type="bool" label="39026" default="true" visible="true"/> <setting id="enableBackgroundSync" type="bool" label="39026" default="true" visible="true"/>
<setting id="saftyMargin" type="slider" label="39051" default="30" option="int" range="10,1,300" visible="eq(-1,true)"/> <setting id="saftyMargin" type="slider" label="39051" default="60" option="int" range="10,1,300" visible="eq(-1,true)"/>
<setting id="fullSyncInterval" type="number" label="39053" default="60" option="int" /> <setting id="fullSyncInterval" type="number" label="39053" default="60" option="int" />
<setting type="lsep" label="30538" /><!-- Complete Re-Sync necessary --> <setting type="lsep" label="30538" /><!-- Complete Re-Sync necessary -->