From 768de346b1be186c4f02ab5da33a80fdf7fb700f Mon Sep 17 00:00:00 2001 From: Croneter Date: Wed, 4 Jul 2018 08:17:37 +0200 Subject: [PATCH] Don't show artwork sync progress, reduce setting-writes - Hopefully fixes #499 --- resources/lib/artwork.py | 18 ------------------ resources/lib/library_sync/fanart.py | 14 -------------- resources/lib/utils.py | 3 --- resources/settings.xml | 4 ---- 4 files changed, 39 deletions(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 07286f7f..4281e437 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -51,8 +51,6 @@ class Image_Cache_Thread(Thread): suspended = self.suspended queue = self.queue sleep_between = self.sleep_between - counter = 0 - set_zero = False while not stopped(): # In the event the server goes offline while suspended(): @@ -66,14 +64,8 @@ class Image_Cache_Thread(Thread): try: url = queue.get(block=False) except Empty: - if not set_zero and not xbmc.getCondVisibility( - 'Window.IsVisible(DialogAddonSettings.xml)'): - # Avoid saving '0' all the time - set_zero = True - utils.settings('caching_artwork_count', value='0') xbmc.sleep(1000) continue - set_zero = False if isinstance(url, ArtworkSyncMessage): if state.IMAGE_SYNC_NOTIFICATIONS: utils.dialog('notification', @@ -125,13 +117,6 @@ class Image_Cache_Thread(Thread): # We did not even get a timeout break queue.task_done() - # Update the caching state in the PKC settings. - counter += 1 - if (counter > 20 and not xbmc.getCondVisibility( - 'Window.IsVisible(DialogAddonSettings.xml)')): - counter = 0 - utils.settings('caching_artwork_count', - value=str(queue.qsize())) # Sleep for a bit to reduce CPU strain xbmc.sleep(sleep_between) LOG.info("---===### Stopped Image_Cache_Thread ###===---") @@ -172,13 +157,10 @@ class Artwork(): connection.close() if not artworks_to_cache: LOG.info('Caching of major images to Kodi texture cache done') - # Set to "None" - utils.settings('caching_artwork_count', value=utils.lang(30069)) return length = len(artworks_to_cache) LOG.info('Caching has not been completed - caching %s major images', length) - utils.settings('caching_artwork_count', value=str(length)) # Caching %s Plex images self.queue.put(ArtworkSyncMessage(utils.lang(30006) % length)) for i, url in enumerate(artworks_to_cache): diff --git a/resources/lib/library_sync/fanart.py b/resources/lib/library_sync/fanart.py index 9c9088b8..6153c2fd 100644 --- a/resources/lib/library_sync/fanart.py +++ b/resources/lib/library_sync/fanart.py @@ -48,8 +48,6 @@ class ThreadedProcessFanart(Thread): stopped = self.stopped suspended = self.suspended queue = self.queue - counter = 0 - set_zero = False while not stopped(): # In the event the server goes offline while suspended(): @@ -63,14 +61,8 @@ class ThreadedProcessFanart(Thread): try: item = queue.get(block=False) except Empty: - if not set_zero and not xbmc.getCondVisibility( - 'Window.IsVisible(DialogAddonSettings.xml)'): - # Avoid saving '0' all the time - set_zero = True - utils.settings('fanarttv_lookups', value='0') xbmc.sleep(200) continue - set_zero = False if isinstance(item, artwork.ArtworkSyncMessage): if state.IMAGE_SYNC_NOTIFICATIONS: utils.dialog('notification', @@ -90,11 +82,5 @@ class ThreadedProcessFanart(Thread): LOG.debug('Done getting fanart for Plex id %s', item['plex_id']) with plexdb.Get_Plex_DB() as plex_db: plex_db.set_fanart_synched(item['plex_id']) - # Update the caching state in the PKC settings. Avoid saving '0' - counter += 1 - if (counter > 20 and not xbmc.getCondVisibility( - 'Window.IsVisible(DialogAddonSettings.xml)')): - counter = 0 - utils.settings('fanarttv_lookups', value=str(queue.qsize())) queue.task_done() LOG.debug("---===### Stopped FanartSync ###===---") diff --git a/resources/lib/utils.py b/resources/lib/utils.py index a95de9b3..45656b03 100644 --- a/resources/lib/utils.py +++ b/resources/lib/utils.py @@ -464,9 +464,6 @@ def wipe_database(): cursor.execute("DELETE FROM %s" % table_name) connection.commit() cursor.close() - # Reset the artwork sync status in the PKC settings - settings('caching_artwork_count', value='unknown') - settings('fanarttv_lookups', value='unknown') # reset the install run flag settings('SyncInstallRunDone', value="false") diff --git a/resources/settings.xml b/resources/settings.xml index e089de73..6a1d384d 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -136,10 +136,6 @@ - - - -