From 150b45d5ccdcf29f18accfea178899e1b07db746 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Wed, 12 Apr 2017 18:52:54 +0200 Subject: [PATCH] Hotfix: Revert Cache missing artwork on PKC startup - Should fix #239, #269 - Seems like another Kodi process messes with the artwork caches, delaying the PKC one for minutes --- resources/lib/artwork.py | 34 ---------------------------------- resources/lib/librarysync.py | 9 ++------- 2 files changed, 2 insertions(+), 41 deletions(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 1336687f..1cd6143b 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -126,40 +126,6 @@ def double_urldecode(text): return unquote(unquote(text)) -def get_uncached_artwork(): - """ - Returns a list of URLs that haven't been cached yet - """ - all_urls = [] - cached_urls = [] - result = [] - connection = kodiSQL('video') - cursor = connection.cursor() - # Get all artwork urls - cursor.execute("SELECT url FROM art WHERE media_type != 'actor'") - for url in cursor.fetchall(): - all_urls.append(url[0]) - connection.close() - connection = kodiSQL('music') - cursor = connection.cursor() - cursor.execute("SELECT url FROM art") - for url in cursor.fetchall(): - all_urls.append(url[0]) - connection.close() - # Get the cached urls - connection = kodiSQL('texture') - cursor = connection.cursor() - cursor.execute("SELECT url FROM texture") - for url in cursor.fetchall(): - cached_urls.append(url[0]) - connection.close() - for url in all_urls: - if url not in cached_urls: - result.append(url) - log.info('%s artwork urls have not been cached yet' % len(result)) - return result - - @ThreadMethodsAdditionalStop('plex_shouldStop') @ThreadMethods class Image_Cache_Thread(Thread): diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 8de3a96a..4e8218e9 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -15,14 +15,13 @@ from utils import window, settings, getUnixTimestamp, sourcesXML,\ ThreadMethods, ThreadMethodsAdditionalStop, LogTime, getScreensaver,\ setScreensaver, playlistXSP, language as lang, DateToKodi, reset,\ advancedSettingsXML, tryDecode, deletePlaylists, deleteNodes, \ - ThreadMethodsAdditionalSuspend, create_actor_db_index, tryEncode, dialog + ThreadMethodsAdditionalSuspend, create_actor_db_index, dialog import downloadutils import itemtypes import plexdb_functions as plexdb import kodidb_functions as kodidb import userclient import videonodes -import artwork import variables as v from PlexFunctions import GetPlexMetadata, GetAllPlexLeaves, scrobble, \ @@ -1808,11 +1807,6 @@ class LibrarySync(Thread): # Initialize time offset Kodi - PMS self.syncPMStime() lastSync = getUnixTimestamp() - if settings('enableTextureCache') == "true": - # Start caching artwork that has not been cached yet - for url in artwork.get_uncached_artwork(): - artwork.ARTWORK_QUEUE.put( - artwork.double_urlencode(tryEncode((url)))) if settings('FanartTV') == 'true': # Start getting additional missing artwork with plexdb.Get_Plex_DB() as plex_db: @@ -1898,6 +1892,7 @@ class LibrarySync(Thread): 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: