Fix items getting deleted on subsequent sync
This commit is contained in:
parent
056463da55
commit
7fce226d47
1 changed files with 24 additions and 22 deletions
|
@ -105,6 +105,7 @@ class FullSync(common.libsync_mixin):
|
||||||
section['section_id'],
|
section['section_id'],
|
||||||
section['plex_type'])
|
section['plex_type'])
|
||||||
self.queue.put(queue_info)
|
self.queue.put(queue_info)
|
||||||
|
with PlexDB() as self.plexdb:
|
||||||
for xml_item in iterator:
|
for xml_item in iterator:
|
||||||
if self.isCanceled():
|
if self.isCanceled():
|
||||||
return False
|
return False
|
||||||
|
@ -128,8 +129,12 @@ class FullSync(common.libsync_mixin):
|
||||||
section['section_id'],
|
section['section_id'],
|
||||||
section['plex_type'])
|
section['plex_type'])
|
||||||
self.queue.put(queue_info)
|
self.queue.put(queue_info)
|
||||||
|
with PlexDB() as self.plexdb:
|
||||||
if section['plex_type'] != v.PLEX_TYPE_ARTIST:
|
if section['plex_type'] != v.PLEX_TYPE_ARTIST:
|
||||||
self.process_playstate(iterator)
|
self.process_playstate(iterator)
|
||||||
|
# Delete movies that are not on Plex anymore
|
||||||
|
self.process_delete()
|
||||||
|
# Wait again till the processing thread is done
|
||||||
self.queue.join()
|
self.queue.join()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
LOG.error('Could not process playstate for section %s', section)
|
LOG.error('Could not process playstate for section %s', section)
|
||||||
|
@ -183,7 +188,6 @@ class FullSync(common.libsync_mixin):
|
||||||
kinds,
|
kinds,
|
||||||
iterator_queue)
|
iterator_queue)
|
||||||
backgroundthread.BGThreader.addTask(task)
|
backgroundthread.BGThreader.addTask(task)
|
||||||
with PlexDB() as self.plexdb:
|
|
||||||
while True:
|
while True:
|
||||||
section = iterator_queue.get()
|
section = iterator_queue.get()
|
||||||
if section is None:
|
if section is None:
|
||||||
|
@ -196,8 +200,6 @@ class FullSync(common.libsync_mixin):
|
||||||
# Now do the heavy lifting
|
# Now do the heavy lifting
|
||||||
if self.isCanceled() or not self.process_section(section):
|
if self.isCanceled() or not self.process_section(section):
|
||||||
return False
|
return False
|
||||||
# Delete movies that are not on Plex anymore
|
|
||||||
self.process_delete()
|
|
||||||
iterator_queue.task_done()
|
iterator_queue.task_done()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue