From d01cf199e500d2cd3ba733d6b5b1638425a83f19 Mon Sep 17 00:00:00 2001 From: tomkat83 Date: Mon, 14 Mar 2016 11:47:14 +0100 Subject: [PATCH] New fix item episode thumbs not caching --- resources/lib/PlexFunctions.py | 1 - resources/lib/artwork.py | 2 +- resources/lib/itemtypes.py | 21 +++++++++++++++++---- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/resources/lib/PlexFunctions.py b/resources/lib/PlexFunctions.py index e8c4ace3..d8e7e835 100644 --- a/resources/lib/PlexFunctions.py +++ b/resources/lib/PlexFunctions.py @@ -3,7 +3,6 @@ from urllib import urlencode from ast import literal_eval from urlparse import urlparse, parse_qs import re -import time from xbmcaddon import Addon diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 75988e63..68adf648 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -421,7 +421,7 @@ class Artwork(): cursor.execute(query, (imageUrl, kodiId, mediaType, imageType)) # Cache fanart and poster in Kodi texture cache - if cacheimage and imageType in ("fanart", "poster"): + if cacheimage and imageType in ("fanart", "poster", "thumb"): self.CacheTexture(imageUrl) def deleteArtwork(self, kodiid, mediatype, cursor): diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 458b072b..e75913b8 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -43,6 +43,8 @@ class Items(object): self.artwork = artwork.Artwork() self.emby = embyserver.Read_EmbyServer() + self.userid = utils.window('currUserId') + self.server = utils.window('pms_server') def __enter__(self): """ @@ -1445,8 +1447,21 @@ class TVShows(Items): people = API.getPeopleList() kodi_db.addPeople(episodeid, people, "episode") # Process artwork - artworks = API.getAllArtwork() - artwork.addOrUpdateArt(artworks['Primary'], episodeid, "episode", "thumb", kodicursor) + # Wide "screenshot" of particular episode + poster = item.attrib.get('thumb') + if poster: + poster = API.addPlexCredentialsToUrl( + "%s%s" % (self.server, poster)) + artwork.addOrUpdateArt( + poster, episodeid, "episode", "thumb", kodicursor) + # poster of TV show itself + # poster = item.attrib.get('grandparentThumb') + # if poster: + # poster = API.addPlexCredentialsToUrl( + # "%s%s" % (self.server, poster)) + # artwork.addOrUpdateArt( + # poster, episodeid, "episode", "poster", kodicursor) + # Process stream details streams = API.getMediaStreams() kodi_db.addStreams(fileid, streams, runtime) @@ -1609,8 +1624,6 @@ class Music(Items): self.enableimportsongrating = utils.settings('enableImportSongRating') == "true" self.enableexportsongrating = utils.settings('enableExportSongRating') == "true" self.enableupdatesongrating = utils.settings('enableUpdateSongRating') == "true" - self.userid = utils.window('currUserId') - self.server = utils.window('pms_server') def __enter__(self): """