Fix exceptions not being raised during sync
This commit is contained in:
parent
f68b4c8820
commit
3acaad5663
1 changed files with 58 additions and 62 deletions
|
@ -71,26 +71,11 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
|
||||||
% (self.current, self.total, self.title))
|
% (self.current, self.total, self.title))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
LOG.debug('Processing thread started')
|
|
||||||
try:
|
|
||||||
self._run()
|
|
||||||
except:
|
|
||||||
utils.ERROR(txt='process_metadata crashed',
|
|
||||||
notify=True,
|
|
||||||
cancel_sync=True)
|
|
||||||
finally:
|
|
||||||
if self.dialog:
|
|
||||||
self.dialog.close()
|
|
||||||
while not self.queue.empty():
|
|
||||||
# We need to empty the queue to let full_sync finish join()
|
|
||||||
self.queue.get()
|
|
||||||
self.queue.task_done()
|
|
||||||
LOG.debug('Processing thread terminated')
|
|
||||||
|
|
||||||
def _run(self):
|
|
||||||
"""
|
"""
|
||||||
Do the work
|
Do the work
|
||||||
"""
|
"""
|
||||||
|
LOG.debug('Processing thread started')
|
||||||
|
try:
|
||||||
if self.show_dialog:
|
if self.show_dialog:
|
||||||
self.dialog = xbmcgui.DialogProgressBG()
|
self.dialog = xbmcgui.DialogProgressBG()
|
||||||
self.dialog.create(utils.lang(39714))
|
self.dialog.create(utils.lang(39714))
|
||||||
|
@ -125,10 +110,13 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
|
||||||
section.plex_type,
|
section.plex_type,
|
||||||
self.last_sync)
|
self.last_sync)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
context.add_update(item['xml'][0],
|
context.add_update(item['xml'][0],
|
||||||
section_name=section.name,
|
section_name=section.name,
|
||||||
section_id=section.id,
|
section_id=section.id,
|
||||||
children=item['children'])
|
children=item['children'])
|
||||||
|
except:
|
||||||
|
utils.ERROR()
|
||||||
self.title = item['xml'][0].get('title')
|
self.title = item['xml'][0].get('title')
|
||||||
self.processed += 1
|
self.processed += 1
|
||||||
self.update_progressbar()
|
self.update_progressbar()
|
||||||
|
@ -143,3 +131,11 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
|
||||||
stats.print_stats()
|
stats.print_stats()
|
||||||
LOG.info('cProfile result: ')
|
LOG.info('cProfile result: ')
|
||||||
LOG.info(string_io.getvalue())
|
LOG.info(string_io.getvalue())
|
||||||
|
finally:
|
||||||
|
if self.dialog:
|
||||||
|
self.dialog.close()
|
||||||
|
while not self.queue.empty():
|
||||||
|
# We need to empty the queue to let full_sync finish join()
|
||||||
|
self.queue.get()
|
||||||
|
self.queue.task_done()
|
||||||
|
LOG.debug('Processing thread terminated')
|
||||||
|
|
Loading…
Reference in a new issue