diff --git a/resources/lib/TextureCache.py b/resources/lib/TextureCache.py index e095cbec..df731dc5 100644 --- a/resources/lib/TextureCache.py +++ b/resources/lib/TextureCache.py @@ -73,6 +73,18 @@ class TextureCache(): except: #extreme short timeouts so we will have a exception, but we don't need the result so pass pass + + def refreshFanart(self,url): + connection = utils.KodiSQL("texture") + cursor = connection.cursor() + cursor.execute("SELECT cachedurl FROM texture WHERE url = ?", (url,)) + result = cursor.fetchone() + if result: + cursor.execute("DELETE FROM texture WHERE url = ?", (url,)) + connection.commit() + else: + self.CacheTexture(url) + cursor.close() def setKodiWebServerDetails(self): diff --git a/resources/lib/Utils.py b/resources/lib/Utils.py index ff6b5506..404109e7 100644 --- a/resources/lib/Utils.py +++ b/resources/lib/Utils.py @@ -54,6 +54,8 @@ def KodiSQL(type="video"): if type == "music": dbPath = getKodiMusicDBPath() + elif type == "texture": + dbPath = xbmc.translatePath("special://database/Textures13.db") else: dbPath = getKodiVideoDBPath() diff --git a/resources/lib/WriteKodiVideoDB.py b/resources/lib/WriteKodiVideoDB.py index ce09d8c0..a33ad204 100644 --- a/resources/lib/WriteKodiVideoDB.py +++ b/resources/lib/WriteKodiVideoDB.py @@ -796,7 +796,10 @@ class WriteKodiVideoDB(): cursor.execute("UPDATE art set url = ? WHERE media_id = ? AND media_type = ? AND type = ?", (imageUrl, kodiId, mediaType, imageType)) #cache fanart and poster in Kodi texture cache - if imageType == "fanart" or imageType == "poster": + if "fanart" in imageType: + utils.logMsg("ArtworkSync", "Adding or Updating Fanart: %s" % imageUrl) + self.textureCache.refreshFanart(imageUrl) + elif "poster" in imageType: self.textureCache.CacheTexture(imageUrl) def setKodiResumePoint(self, fileid, resume_seconds, total_seconds, cursor):