Only marking full sync as successful if that is indeed the case
This commit is contained in:
parent
9087f27f2a
commit
9b9d2be53d
1 changed files with 8 additions and 2 deletions
|
@ -544,10 +544,11 @@ class DownloadGen(object):
|
||||||
Special iterator object that will yield all child xmls piece-wise. It also
|
Special iterator object that will yield all child xmls piece-wise. It also
|
||||||
saves the original xml.attrib.
|
saves the original xml.attrib.
|
||||||
|
|
||||||
Yields XML etree children or raises RuntimeError
|
Yields XML etree children or raises RuntimeError at the end
|
||||||
"""
|
"""
|
||||||
def __init__(self, url, plex_type=None, last_viewed_at=None,
|
def __init__(self, url, plex_type=None, last_viewed_at=None,
|
||||||
updated_at=None, args=None):
|
updated_at=None, args=None):
|
||||||
|
self.successful = True
|
||||||
self.args = args or {}
|
self.args = args or {}
|
||||||
self.args.update({
|
self.args.update({
|
||||||
'X-Plex-Container-Size': CONTAINERSIZE,
|
'X-Plex-Container-Size': CONTAINERSIZE,
|
||||||
|
@ -597,6 +598,8 @@ class DownloadGen(object):
|
||||||
if xml is not None:
|
if xml is not None:
|
||||||
for child in xml:
|
for child in xml:
|
||||||
self.xml.append(child)
|
self.xml.append(child)
|
||||||
|
else:
|
||||||
|
self.successful = False
|
||||||
self.pending_counter.pop()
|
self.pending_counter.pop()
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
|
@ -616,6 +619,9 @@ class DownloadGen(object):
|
||||||
return child
|
return child
|
||||||
except IndexError:
|
except IndexError:
|
||||||
if not self.pending_counter and not len(self.xml):
|
if not self.pending_counter and not len(self.xml):
|
||||||
|
if not self.successful:
|
||||||
|
raise RuntimeError('Could not download everything')
|
||||||
|
else:
|
||||||
raise StopIteration()
|
raise StopIteration()
|
||||||
LOG.debug('Waiting for download to finish')
|
LOG.debug('Waiting for download to finish')
|
||||||
app.APP.monitor.waitForAbort(0.1)
|
app.APP.monitor.waitForAbort(0.1)
|
||||||
|
|
Loading…
Reference in a new issue