Fixes to XML download iterator

This commit is contained in:
croneter 2018-11-11 17:48:11 +01:00
parent 7aec7fe776
commit bc7fc4db1b
3 changed files with 6 additions and 7 deletions

View file

@ -104,8 +104,7 @@ class FullSync(common.libsync_mixin):
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
queue_info = InitNewSection(self.context, queue_info = InitNewSection(self.context,
utils.cast(int, iterator.total,
iterator.get('totalSize', 0)),
iterator.get('librarySectionTitle'), iterator.get('librarySectionTitle'),
section['section_id'], section['section_id'],
self.plex_type) self.plex_type)
@ -131,8 +130,7 @@ class FullSync(common.libsync_mixin):
plex_type=self.plex_type) plex_type=self.plex_type)
# Tell the processing thread that we're syncing playstate # Tell the processing thread that we're syncing playstate
queue_info = InitNewSection(self.context, queue_info = InitNewSection(self.context,
utils.cast(int, iterator.total,
iterator.get('totalSize', 0)),
iterator.get('librarySectionTitle'), iterator.get('librarySectionTitle'),
section['section_id'], section['section_id'],
self.plex_type) self.plex_type)

View file

@ -66,7 +66,7 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
except ZeroDivisionError: except ZeroDivisionError:
progress = 0 progress = 0
self.dialog.update(progress, self.dialog.update(progress,
'%s: %s' % (self.section_type_text, self.section_name), '%s (%s)' % (self.section_name, self.section_type_text),
'%s/%s: %s' '%s/%s: %s'
% (self.current, self.total, self.title)) % (self.current, self.total, self.title))

View file

@ -617,10 +617,11 @@ class DownloadGen(object):
self.current += 1 self.current += 1
child = self.xml[0] child = self.xml[0]
self.xml.remove(child) self.xml.remove(child)
if self.current % CONTAINERSIZE == 0: if (self.current % CONTAINERSIZE == 0 and
self.current < self.total - self.cache_factor * CONTAINERSIZE):
self.pending_counter.append(None)
self._download_chunk( self._download_chunk(
start=self.current + (self.cache_factor - 1) * CONTAINERSIZE) start=self.current + (self.cache_factor - 1) * CONTAINERSIZE)
self.pending_counter.append(None)
return child return child
sleep(100) sleep(100)
if not len(self.pending_counter) and not len(self.xml): if not len(self.pending_counter) and not len(self.xml):