Fix sync error when only an item is deleted in section

This commit is contained in:
croneter 2018-11-25 20:31:40 +01:00
parent 69e65f5ca6
commit 2ceb0cd7a2

View file

@ -38,6 +38,7 @@ class FullSync(common.libsync_mixin):
self.plex_type = None self.plex_type = None
self.section_type = None self.section_type = None
self.processing_thread = None self.processing_thread = None
self.section_initiated = False
self.install_sync_done = utils.settings('SyncInstallRunDone') == 'true' self.install_sync_done = utils.settings('SyncInstallRunDone') == 'true'
self.threader = backgroundthread.ThreaderManager( self.threader = backgroundthread.ThreaderManager(
worker=backgroundthread.NonstoppingBackgroundWorker) worker=backgroundthread.NonstoppingBackgroundWorker)
@ -99,6 +100,7 @@ class FullSync(common.libsync_mixin):
app.SYNC.path_verified = False app.SYNC.path_verified = False
try: try:
# Sync new, updated and deleted items # Sync new, updated and deleted items
self.section_initiated = True
iterator = PF.SectionItems(section['section_id'], iterator = PF.SectionItems(section['section_id'],
plex_type=self.plex_type) plex_type=self.plex_type)
# Tell the processing thread about this new section # Tell the processing thread about this new section
@ -163,6 +165,7 @@ class FullSync(common.libsync_mixin):
]) ])
with PlexDB() as self.plexdb: with PlexDB() as self.plexdb:
for kind in kinds: for kind in kinds:
self.section_initiated = False
# Setup our variables # Setup our variables
self.plex_type = kind[0] self.plex_type = kind[0]
self.section_type = kind[1] self.section_type = kind[1]
@ -172,6 +175,14 @@ class FullSync(common.libsync_mixin):
if self.isCanceled() or not self.process_kind(): if self.isCanceled() or not self.process_kind():
return False return False
# Delete movies that are not on Plex anymore # Delete movies that are not on Plex anymore
if not self.section_initiated:
# Need to make sure that we're telling about this section
queue_info = InitNewSection(self.context,
0,
'',
'',
self.plex_type)
self.queue.put(queue_info)
self.process_delete() self.process_delete()
return True return True