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
This commit is contained in:
tomkat83 2017-04-12 18:52:54 +02:00
parent 1731204b14
commit 150b45d5cc
2 changed files with 2 additions and 41 deletions

View file

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

View file

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