Fix setting to cache all textures to Kodi
This commit is contained in:
parent
ca6bb4e8ca
commit
703f2fb37d
5 changed files with 13 additions and 42 deletions
|
@ -172,8 +172,7 @@ class Main():
|
||||||
utils.window('plex_runLibScan', value="full")
|
utils.window('plex_runLibScan', value="full")
|
||||||
|
|
||||||
elif mode == "texturecache":
|
elif mode == "texturecache":
|
||||||
import artwork
|
utils.window('plex_runLibScan', value='del_textures')
|
||||||
artwork.Artwork().fullTextureCacheSync()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
entrypoint.doMainListing()
|
entrypoint.doMainListing()
|
||||||
|
|
|
@ -453,7 +453,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- Plex Artwork.py -->
|
<!-- Plex Artwork.py -->
|
||||||
<string id="39250">Running the image cache process can take some time. Are you sure you want continue?</string>
|
<string id="39250">Running the image cache process can take some time. It will happen in the background. Are you sure you want continue?</string>
|
||||||
<string id="39251">Reset all existing cache data first?</string>
|
<string id="39251">Reset all existing cache data first?</string>
|
||||||
|
|
||||||
<!-- Plex PlexAPI.py -->
|
<!-- Plex PlexAPI.py -->
|
||||||
|
|
|
@ -391,7 +391,7 @@
|
||||||
|
|
||||||
|
|
||||||
<!-- Plex Artwork.py -->
|
<!-- Plex Artwork.py -->
|
||||||
<string id="39250">Alle Plex Bilder in Kodi zwischenzuspeichern kann sehr lange dauern. Möchten Sie wirklich fortfahren?</string>
|
<string id="39250">Alle Plex Bilder in Kodi zwischenzuspeichern kann lange dauern. Es wird im Hintergrund stattfinden. Möchten Sie wirklich fortfahren?</string>
|
||||||
<string id="39251">Sollen erst alle bestehenden Bilder im Cache gelöscht werden?</string>
|
<string id="39251">Sollen erst alle bestehenden Bilder im Cache gelöscht werden?</string>
|
||||||
|
|
||||||
<!-- Plex PlexAPI.py -->
|
<!-- Plex PlexAPI.py -->
|
||||||
|
|
|
@ -191,7 +191,7 @@ class Image_Cache_Thread(Thread):
|
||||||
break
|
break
|
||||||
queue.task_done()
|
queue.task_done()
|
||||||
# Sleep for a bit to reduce CPU strain
|
# Sleep for a bit to reduce CPU strain
|
||||||
xbmc.sleep(20)
|
xbmc.sleep(50)
|
||||||
log.info("---===### Stopped Image_Cache_Thread ###===---")
|
log.info("---===### Stopped Image_Cache_Thread ###===---")
|
||||||
|
|
||||||
|
|
||||||
|
@ -214,9 +214,6 @@ class Artwork():
|
||||||
|
|
||||||
log.info("Doing Image Cache Sync")
|
log.info("Doing Image Cache Sync")
|
||||||
|
|
||||||
pdialog = xbmcgui.DialogProgress()
|
|
||||||
pdialog.create("PlexKodiConnect", "Image Cache Sync")
|
|
||||||
|
|
||||||
# ask to rest all existing or not
|
# ask to rest all existing or not
|
||||||
if xbmcgui.Dialog().yesno(
|
if xbmcgui.Dialog().yesno(
|
||||||
"Image Texture Cache", lang(39251), ""):
|
"Image Texture Cache", lang(39251), ""):
|
||||||
|
@ -256,53 +253,22 @@ class Artwork():
|
||||||
cursor.execute("SELECT url FROM art WHERE media_type != 'actor'")
|
cursor.execute("SELECT url FROM art WHERE media_type != 'actor'")
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
total = len(result)
|
total = len(result)
|
||||||
log.info("Image cache sync about to process %s images" % total)
|
log.info("Image cache sync about to process %s video images" % total)
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
count = 0
|
|
||||||
for url in result:
|
for url in result:
|
||||||
if pdialog.iscanceled():
|
|
||||||
break
|
|
||||||
|
|
||||||
percentage = int((float(count) / float(total))*100)
|
|
||||||
message = "%s of %s (%s)" % (count, total, self.imageCacheThreads)
|
|
||||||
pdialog.update(percentage, "%s %s" % (lang(33045), message))
|
|
||||||
self.cacheTexture(url[0])
|
self.cacheTexture(url[0])
|
||||||
count += 1
|
|
||||||
# Cache all entries in music DB
|
# Cache all entries in music DB
|
||||||
connection = kodiSQL('music')
|
connection = kodiSQL('music')
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
cursor.execute("SELECT url FROM art")
|
cursor.execute("SELECT url FROM art")
|
||||||
result = cursor.fetchall()
|
result = cursor.fetchall()
|
||||||
total = len(result)
|
total = len(result)
|
||||||
log.info("Image cache sync about to process %s images" % total)
|
log.info("Image cache sync about to process %s music images" % total)
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
||||||
count = 0
|
|
||||||
for url in result:
|
for url in result:
|
||||||
if pdialog.iscanceled():
|
|
||||||
break
|
|
||||||
|
|
||||||
percentage = int((float(count) / float(total))*100)
|
|
||||||
message = "%s of %s" % (count, total)
|
|
||||||
pdialog.update(percentage, "%s %s" % (lang(33045), message))
|
|
||||||
self.cacheTexture(url[0])
|
self.cacheTexture(url[0])
|
||||||
count += 1
|
log.info('Done throwing URLs to art download daemon')
|
||||||
pdialog.update(100, "%s %s"
|
|
||||||
% (lang(33046), len(self.imageCacheThreads)))
|
|
||||||
log.info("Waiting for all threads to exit")
|
|
||||||
while len(self.imageCacheThreads):
|
|
||||||
with self.lock:
|
|
||||||
for thread in self.imageCacheThreads:
|
|
||||||
if thread.is_finished:
|
|
||||||
self.imageCacheThreads.remove(thread)
|
|
||||||
pdialog.update(100, "%s %s"
|
|
||||||
% (lang(33046), len(self.imageCacheThreads)))
|
|
||||||
log.info("Waiting for all threads to exit: %s"
|
|
||||||
% len(self.imageCacheThreads))
|
|
||||||
xbmc.sleep(500)
|
|
||||||
|
|
||||||
pdialog.close()
|
|
||||||
|
|
||||||
def cacheTexture(self, url):
|
def cacheTexture(self, url):
|
||||||
# Cache a single image url to the texture cache
|
# Cache a single image url to the texture cache
|
||||||
|
|
|
@ -1803,6 +1803,12 @@ class LibrarySync(Thread):
|
||||||
line1=lang(39223),
|
line1=lang(39223),
|
||||||
nolabel=lang(39224),
|
nolabel=lang(39224),
|
||||||
yeslabel=lang(39225)))
|
yeslabel=lang(39225)))
|
||||||
|
elif window('plex_runLibScan') == 'del_textures':
|
||||||
|
window('plex_runLibScan', clear=True)
|
||||||
|
window('plex_dbScan', value="true")
|
||||||
|
import artwork
|
||||||
|
artwork.Artwork().fullTextureCacheSync()
|
||||||
|
window('plex_dbScan', clear=True)
|
||||||
else:
|
else:
|
||||||
now = getUnixTimestamp()
|
now = getUnixTimestamp()
|
||||||
if (now - lastSync > fullSyncInterval and
|
if (now - lastSync > fullSyncInterval and
|
||||||
|
|
Loading…
Reference in a new issue