Merge branch 'Pavuucek-hotfixes' into hotfixes

This commit is contained in:
croneter 2018-01-28 14:04:21 +01:00
commit 8c4d00da3d

View file

@ -6,6 +6,7 @@ from Queue import Queue, Empty
from shutil import rmtree
from urllib import quote_plus, unquote
from threading import Thread
from os import makedirs
import requests
from xbmc import sleep, translatePath
@ -136,6 +137,7 @@ class Artwork():
path = tryDecode(translatePath("special://thumbnails/"))
if exists_dir(path):
rmtree(path, ignore_errors=True)
self.restoreCacheDirectories()
# remove all existing data from texture DB
connection = kodiSQL('texture')
@ -335,7 +337,14 @@ class Artwork():
LOG.debug("Deleting cached thumbnail: %s" % path)
if exists(path):
rmtree(tryDecode(path), ignore_errors=True)
self.restoreCacheDirectories()
cursor.execute("DELETE FROM texture WHERE url = ?", (url,))
connection.commit()
finally:
connection.close()
def restoreCacheDirectories(self):
LOG.info("Restoring cache directories...")
paths = ("","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","Video","plex")
for p in paths:
makedirs(tryDecode(translatePath("special://thumbnails/%s" % p)))