From 5cea57e935c98607ec1894f4fa669c8a7b67e38c Mon Sep 17 00:00:00 2001 From: Croneter Date: Sun, 29 Apr 2018 12:39:29 +0200 Subject: [PATCH 1/8] Use list instead of set --- resources/lib/entrypoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/entrypoint.py b/resources/lib/entrypoint.py index 1bd5318e..7ec66d72 100644 --- a/resources/lib/entrypoint.py +++ b/resources/lib/entrypoint.py @@ -369,7 +369,7 @@ def getRecentEpisodes(viewid, mediatype, tagname, limit): append_show_title = settings('RecentTvAppendShow') == 'true' append_sxxexx = settings('RecentTvAppendSeason') == 'true' # First we get a list of all the TV shows - filtered by tag - allshowsIds = set() + allshowsIds = list() params = { 'sort': {'order': "descending", 'method': "dateadded"}, 'filter': {'operator': "is", 'field': "tag", 'value': "%s" % tagname}, From 51f47452f29bf57a797506bc1507cb2f9589270a Mon Sep 17 00:00:00 2001 From: Croneter Date: Sun, 29 Apr 2018 14:11:03 +0200 Subject: [PATCH 2/8] Add toggle to deactivate image caching during playback - Partially fixes #451 - you can now disable image caching during playback --- resources/language/resource.language.en_gb/strings.po | 5 +++++ resources/lib/artwork.py | 9 ++++++--- resources/settings.xml | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index db179cee..292beee7 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -41,6 +41,11 @@ msgctxt "#30005" msgid "Username: " msgstr "" +# PKC settings artwork: Enable image caching during Kodi playback +msgctxt "#30009" +msgid "Enable image caching during Kodi playback (restart Kodi!)" +msgstr "" + # Button text msgctxt "#30012" msgid "OK" diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 1c39b806..d4e1e80d 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -22,6 +22,10 @@ LOG = getLogger("PLEX." + __name__) # Disable annoying requests warnings requests.packages.urllib3.disable_warnings() ARTWORK_QUEUE = Queue() +IMAGE_CACHING_SUSPENDS = ['SUSPEND_LIBRARY_THREAD', 'DB_SCAN', 'STOP_SYNC'] +if not settings('imageSyncDuringPlayback') == 'true': + IMAGE_CACHING_SUSPENDS.append('SUSPEND_SYNC') + ############################################################################### @@ -33,9 +37,7 @@ def double_urldecode(text): return unquote(unquote(text)) -@thread_methods(add_suspends=['SUSPEND_LIBRARY_THREAD', - 'DB_SCAN', - 'STOP_SYNC']) +@thread_methods(add_suspends=IMAGE_CACHING_SUSPENDS) class Image_Cache_Thread(Thread): sleep_between = 50 # Potentially issues with limited number of threads @@ -47,6 +49,7 @@ class Image_Cache_Thread(Thread): Thread.__init__(self) def run(self): + LOG.info("---===### Starting Image_Cache_Thread ###===---") stopped = self.stopped suspended = self.suspended queue = self.queue diff --git a/resources/settings.xml b/resources/settings.xml index fea2ad2d..928c125f 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -125,6 +125,7 @@ + + From 62d6c8fe458fc3dfe5b7804d3c897035ecdccc35 Mon Sep 17 00:00:00 2001 From: Croneter Date: Sun, 29 Apr 2018 14:14:31 +0200 Subject: [PATCH 4/8] Increase timeout between syncing images - Partially fixes #457 --- resources/lib/artwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 2b4d609b..8b0ce224 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -39,7 +39,7 @@ def double_urldecode(text): @thread_methods(add_suspends=IMAGE_CACHING_SUSPENDS) class Image_Cache_Thread(Thread): - sleep_between = 50 + sleep_between = 100 # Potentially issues with limited number of threads # Hence let Kodi wait till download is successful timeout = (35.1, 35.1) From 1ca2bdba79015d873a76e2e9c08b36d823bc0e72 Mon Sep 17 00:00:00 2001 From: Croneter Date: Sun, 29 Apr 2018 14:16:56 +0200 Subject: [PATCH 5/8] Less logging --- resources/lib/artwork.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 8b0ce224..fb62a00a 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -148,8 +148,6 @@ class Artwork(): (typus, )) artworks.extend(cursor.fetchall()) connection.close() - LOG.debug('artworks: %s', artworks) - LOG.debug('artworks: %s', len(artworks)) artworks_to_cache = list() connection = kodi_sql('texture') cursor = connection.cursor() From 559bd5408fd14a431ef0664e2101d4c22b7ba7a6 Mon Sep 17 00:00:00 2001 From: Croneter Date: Sun, 29 Apr 2018 14:26:53 +0200 Subject: [PATCH 6/8] Optimize startup of image caching --- resources/lib/librarysync.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index e94d35c0..c15aac44 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -1586,12 +1586,12 @@ class LibrarySync(Thread): if settings('FanartTV') == 'true': self.sync_fanart() LOG.info('Done initial sync on Kodi startup') + artwork.Artwork().cache_major_artwork() + self.fanartthread.start() else: LOG.info('Startup sync has not yet been successful') window('plex_dbScan', clear=True) state.DB_SCAN = False - artwork.Artwork().cache_major_artwork() - self.fanartthread.start() # Currently no db scan, so we can start a new scan elif state.DB_SCAN is False: From f87a63167421245b289739d28996573768f4d170 Mon Sep 17 00:00:00 2001 From: Croneter Date: Sun, 29 Apr 2018 14:39:08 +0200 Subject: [PATCH 7/8] Revert "Increase timeout between syncing images" This reverts commit 62d6c8fe458fc3dfe5b7804d3c897035ecdccc35. --- resources/lib/artwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index fb62a00a..a6592016 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -39,7 +39,7 @@ def double_urldecode(text): @thread_methods(add_suspends=IMAGE_CACHING_SUSPENDS) class Image_Cache_Thread(Thread): - sleep_between = 100 + sleep_between = 50 # Potentially issues with limited number of threads # Hence let Kodi wait till download is successful timeout = (35.1, 35.1) From 0807ce53149f6ee221c2cc4df5e86cd2bceff6b3 Mon Sep 17 00:00:00 2001 From: Croneter Date: Sun, 29 Apr 2018 14:39:36 +0200 Subject: [PATCH 8/8] Increase timeout between syncing images --- resources/lib/artwork.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index a6592016..84d7b612 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -39,7 +39,7 @@ def double_urldecode(text): @thread_methods(add_suspends=IMAGE_CACHING_SUSPENDS) class Image_Cache_Thread(Thread): - sleep_between = 50 + sleep_between = 200 # Potentially issues with limited number of threads # Hence let Kodi wait till download is successful timeout = (35.1, 35.1)