Fix current sync progress for more than 2000 items

This commit is contained in:
croneter 2018-12-09 14:23:01 +01:00
parent de90ab225f
commit 27d34167e9

View file

@ -88,7 +88,7 @@ class FullSync(common.libsync_mixin):
self.show_dialog_userdata = utils.settings('playstate_sync_indicator') == 'true' self.show_dialog_userdata = utils.settings('playstate_sync_indicator') == 'true'
self.dialog = None self.dialog = None
self.total = 0 self.total = 0
self.current = 1 self.current = 0
self.processed = 0 self.processed = 0
self.title = '' self.title = ''
self.section = None self.section = None
@ -154,7 +154,6 @@ class FullSync(common.libsync_mixin):
break break
LOG.debug('Start or continue processing section %s (%ss)', LOG.debug('Start or continue processing section %s (%ss)',
section.name, section.plex_type) section.name, section.plex_type)
self.current = 1
self.processed = 0 self.processed = 0
self.total = section.total self.total = section.total
self.section_name = section.name self.section_name = section.name
@ -189,8 +188,8 @@ class FullSync(common.libsync_mixin):
else: else:
raise ValueError('Unknown type %s' % type(item)) raise ValueError('Unknown type %s' % type(item))
self.item_count -= 1 self.item_count -= 1
self.update_progressbar()
self.current += 1 self.current += 1
self.update_progressbar()
if self.processed == 500: if self.processed == 500:
self.processed = 0 self.processed = 0
context.commit() context.commit()
@ -215,6 +214,7 @@ class FullSync(common.libsync_mixin):
last = True last = True
# To keep track of the item-number in order to kill while loops # To keep track of the item-number in order to kill while loops
self.item_count = 0 self.item_count = 0
self.current = 0
while True: while True:
# Check Plex DB to see what we need to add/update # Check Plex DB to see what we need to add/update
with PlexDB() as self.plexdb: with PlexDB() as self.plexdb: