Fix exceptions not being raised during sync

This commit is contained in:
croneter 2018-11-20 18:08:51 +01:00
parent f68b4c8820
commit 3acaad5663

View file

@ -71,26 +71,11 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
% (self.current, self.total, self.title))
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
"""
LOG.debug('Processing thread started')
try:
if self.show_dialog:
self.dialog = xbmcgui.DialogProgressBG()
self.dialog.create(utils.lang(39714))
@ -125,10 +110,13 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
section.plex_type,
self.last_sync)
else:
try:
context.add_update(item['xml'][0],
section_name=section.name,
section_id=section.id,
children=item['children'])
except:
utils.ERROR()
self.title = item['xml'][0].get('title')
self.processed += 1
self.update_progressbar()
@ -143,3 +131,11 @@ class ProcessMetadata(backgroundthread.KillableThread, common.libsync_mixin):
stats.print_stats()
LOG.info('cProfile result: ')
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')