Fix playback not starting for really large libraries

- Partially fixes #599
This commit is contained in:
croneter 2019-01-14 18:22:31 +01:00
parent 332a2eca68
commit e255958b57

View file

@ -221,16 +221,24 @@ class FullSync(common.fullsync_mixin):
self.section_type_text = utils.lang( self.section_type_text = utils.lang(
v.TRANSLATION_FROM_PLEXTYPE[section['plex_type']]) v.TRANSLATION_FROM_PLEXTYPE[section['plex_type']])
self.current = 0 self.current = 0
with section['context'](self.current_sync) as itemtype:
for xml_item in iterator: last = True
if self.isCanceled(): loop = common.tag_last(iterator)
return False while True:
itemtype.update_userdata(xml_item, section['plex_type']) with section['context'](self.current_sync) as itemtype:
itemtype.plexdb.update_last_sync(int(xml_item.attrib['ratingKey']), for i, (last, xml_item) in enumerate(loop):
section['plex_type'], if self.isCanceled():
self.current_sync) return False
self.current += 1 itemtype.update_userdata(xml_item, section['plex_type'])
self.update_progressbar() itemtype.plexdb.update_last_sync(int(xml_item.attrib['ratingKey']),
section['plex_type'],
self.current_sync)
self.current += 1
self.update_progressbar()
if (i + 1) % BATCH_SIZE == 0:
break
if last:
break
return True return True
except RuntimeError: except RuntimeError:
LOG.error('Could not entirely process section %s', section) LOG.error('Could not entirely process section %s', section)