From b2615c19bd3c58ed7e40f491766d1d26a5151573 Mon Sep 17 00:00:00 2001 From: croneter Date: Tue, 13 Nov 2018 16:30:05 +0100 Subject: [PATCH] Fix fanart download message showing up too often --- resources/lib/library_sync/fanart.py | 6 +++++- resources/lib/sync.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/lib/library_sync/fanart.py b/resources/lib/library_sync/fanart.py index cc6f1532..77fdd38c 100644 --- a/resources/lib/library_sync/fanart.py +++ b/resources/lib/library_sync/fanart.py @@ -44,6 +44,7 @@ class FanartThread(backgroundthread.KillableThread): def _run_internal(self): LOG.info('Starting FanartThread') + finished = False while True: with PlexDB() as plexdb: func = plexdb.every_plex_id if self.refresh else plexdb.missing_fanart @@ -52,8 +53,11 @@ class FanartThread(backgroundthread.KillableThread): if self.isCanceled() or self.isSuspended(): break process_fanart(plex_id, typus, self.refresh) + if self.isCanceled() or self.isSuspended(): + break else: # Done processing! + finished = True break # Need to have these outside our DB context to close the connection if self.isCanceled(): @@ -63,7 +67,7 @@ class FanartThread(backgroundthread.KillableThread): return xbmc.sleep(1000) LOG.info('FanartThread finished') - self.callback() + self.callback(finished) class FanartTask(backgroundthread.Task, common.libsync_mixin): diff --git a/resources/lib/sync.py b/resources/lib/sync.py index ac20dd47..84b96855 100644 --- a/resources/lib/sync.py +++ b/resources/lib/sync.py @@ -151,9 +151,9 @@ class Sync(backgroundthread.KillableThread): LOG.info('Still downloading fanart') return False - def on_fanart_download_finished(self): + def on_fanart_download_finished(self, successful): # FanartTV lookup completed - if state.SYNC_DIALOG: + if successful and state.SYNC_DIALOG: utils.dialog('notification', heading='{plex}', message=utils.lang(30019),