Don't show artwork sync progress, reduce setting-writes

- Hopefully fixes #499
This commit is contained in:
Croneter 2018-07-04 08:17:37 +02:00
parent f169e3da42
commit 768de346b1
4 changed files with 0 additions and 39 deletions

View file

@ -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):

View file

@ -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 ###===---")

View file

@ -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")

View file

@ -136,10 +136,6 @@
<setting id="imageSyncNotifications" label="30008" type="bool" default="true" /><!-- Enable notifications for image caching -->
<setting id="imageSyncDuringPlayback" label="30009" type="bool" default="true" /><!-- Enable image caching during Kodi playback (restart Kodi!) -->
<setting label="39020" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=texturecache)" option="close" /> <!-- Cache all images to Kodi texture cache now -->
<setting type="sep" />
<setting type="lsep" label="30010" /><!-- Approximate progress -->
<setting id="caching_artwork_count" label="30011" type="text" default="unknown" enable="false" visible="eq(-8,true)"/><!-- Plex artwork (posters and backgrounds) left to cache: -->
<setting id="fanarttv_lookups" label="30015" type="text" default="unknown" enable="false" visible="eq(-8,true)"/><!-- Movie and show FanartTV lookups left to do: -->
</category>
<!--
<category label="30235" visible="false">