Show caching progress for Plex images in the PKC settings
This commit is contained in:
parent
f9cc0f249d
commit
d16296395f
3 changed files with 46 additions and 14 deletions
|
@ -43,12 +43,12 @@ msgstr ""
|
|||
|
||||
# Sync notification displayed if there is still artwork to be cached to Kodi
|
||||
msgctxt "#30006"
|
||||
msgid "Caching %s images"
|
||||
msgid "Caching %s Plex images"
|
||||
msgstr ""
|
||||
|
||||
# Sync notification displayed if syncing of major artwork is done
|
||||
msgctxt "#30007"
|
||||
msgid "Major image caching done"
|
||||
msgid "Plex image caching done"
|
||||
msgstr ""
|
||||
|
||||
# PKC settings artwork: Enable notifications for artwork image sync
|
||||
|
@ -61,6 +61,16 @@ msgctxt "#30009"
|
|||
msgid "Enable image caching during Kodi playback (restart Kodi!)"
|
||||
msgstr ""
|
||||
|
||||
# PKC settings - Artwork
|
||||
msgctxt "#30010"
|
||||
msgid "Approximate caching progress"
|
||||
msgstr ""
|
||||
|
||||
# PKC settings - Artwork
|
||||
msgctxt "#30011"
|
||||
msgid "Plex artwork (posters and backgrounds) left to cache:"
|
||||
msgstr ""
|
||||
|
||||
# Button text
|
||||
msgctxt "#30012"
|
||||
msgid "OK"
|
||||
|
@ -407,7 +417,7 @@ msgstr ""
|
|||
|
||||
# PKC Settings - Artwork
|
||||
msgctxt "#30512"
|
||||
msgid "Force artwork caching"
|
||||
msgid "Cache all artwork for a smooth Kodi experience"
|
||||
msgstr ""
|
||||
|
||||
# PKC Settings - Artwork
|
||||
|
|
|
@ -69,7 +69,15 @@ class Image_Cache_Thread(Thread):
|
|||
sleep(1000)
|
||||
continue
|
||||
if isinstance(url, ArtworkSyncMessage):
|
||||
if state.IMAGE_SYNC_NOTIFICATIONS:
|
||||
if url.major_artwork_counter is not None:
|
||||
if url.major_artwork_counter == 0:
|
||||
# Done caching, show this in the PKC settings, too
|
||||
settings('caching_major_artwork', value=lang(30069))
|
||||
LOG.info('Done caching major images!')
|
||||
else:
|
||||
settings('caching_major_artwork',
|
||||
value=str(url.major_artwork_counter))
|
||||
if url.message and state.IMAGE_SYNC_NOTIFICATIONS:
|
||||
dialog('notification',
|
||||
heading=lang(29999),
|
||||
message=url.message,
|
||||
|
@ -110,9 +118,9 @@ class Image_Cache_Thread(Thread):
|
|||
sleep((2**sleeptime) * 1000)
|
||||
sleeptime += 1
|
||||
continue
|
||||
except Exception as e:
|
||||
except Exception as err:
|
||||
LOG.error('Unknown exception for url %s: %s'.
|
||||
double_urldecode(url), e)
|
||||
double_urldecode(url), err)
|
||||
import traceback
|
||||
LOG.error("Traceback:\n%s", traceback.format_exc())
|
||||
break
|
||||
|
@ -159,15 +167,25 @@ class Artwork():
|
|||
connection.close()
|
||||
if not artworks_to_cache:
|
||||
LOG.info('Caching of major images to Kodi texture cache done')
|
||||
# Set to "None"
|
||||
settings('caching_major_artwork', value=lang(30069))
|
||||
return
|
||||
length = len(artworks_to_cache)
|
||||
LOG.info('Caching has not been completed - caching %s major images',
|
||||
len(artworks_to_cache))
|
||||
# Caching %s images
|
||||
self.queue.put(ArtworkSyncMessage(lang(30006) % len(artworks_to_cache)))
|
||||
for url in artworks_to_cache:
|
||||
length)
|
||||
settings('caching_major_artwork', value=str(length))
|
||||
# Caching %s Plex images
|
||||
self.queue.put(ArtworkSyncMessage(message=lang(30006) % length,
|
||||
major_artwork_counter=length))
|
||||
for i, url in enumerate(artworks_to_cache):
|
||||
self.queue.put(url[0])
|
||||
# Major image caching done
|
||||
self.queue.put(ArtworkSyncMessage(lang(30007)))
|
||||
if (length - i) % 10 == 0:
|
||||
# Update the PKC settings for artwork caching progress
|
||||
msg = ArtworkSyncMessage(major_artwork_counter=length - i)
|
||||
self.queue.put(msg)
|
||||
# Plex image caching done
|
||||
self.queue.put(ArtworkSyncMessage(message=lang(30007),
|
||||
major_artwork_counter=0))
|
||||
|
||||
def fullTextureCacheSync(self):
|
||||
"""
|
||||
|
@ -325,5 +343,6 @@ class ArtworkSyncMessage(object):
|
|||
"""
|
||||
Put in artwork queue to display the message as a Kodi notification
|
||||
"""
|
||||
def __init__(self, message):
|
||||
def __init__(self, message=None, major_artwork_counter=None):
|
||||
self.message = message
|
||||
self.major_artwork_counter = major_artwork_counter
|
||||
|
|
|
@ -123,12 +123,15 @@
|
|||
</category>
|
||||
|
||||
<category label="30544"><!-- artwork -->
|
||||
<setting id="enableTextureCache" label="30512" type="bool" default="true" /> <!-- Force Artwork Caching -->
|
||||
<setting id="enableTextureCache" label="30512" type="bool" default="true" /> <!-- Cache all artwork for a smooth Kodi experience -->
|
||||
<setting id="FanartTV" label="30539" type="bool" default="false" /><!-- Download additional art from FanArtTV -->
|
||||
<setting label="39222" type="action" action="RunPlugin(plugin://plugin.video.plexkodiconnect/?mode=fanart)" option="close" visible="eq(-1,true)" subsetting="true" /> <!-- Look for missing fanart on FanartTV now -->
|
||||
<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" visible="eq(-6,true)" />
|
||||
<setting type="lsep" label="30010" visible="eq(-7,true)" /><!-- Approximate caching progress (updated on Kodi restart at the latest) -->
|
||||
<setting id="caching_major_artwork" label="30011" type="text" default="$ADDON[plugin.video.plexkodiconnect 39310]" enable="false" visible="eq(-8,true)"/><!-- Plex artwork (posters and backgrounds) left to cache: -->
|
||||
</category>
|
||||
<!--
|
||||
<category label="30235" visible="false">
|
||||
|
|
Loading…
Reference in a new issue