mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Update delete cache method
This commit is contained in:
parent
24b572674d
commit
b4414648dc
2 changed files with 7 additions and 28 deletions
|
@ -142,7 +142,7 @@ class Artwork(object):
|
|||
# ask to rest all existing or not
|
||||
if dialog(type_="yesno", heading="{emby}", line1=lang(33044)):
|
||||
log.info("Resetting all cache data first")
|
||||
self._delete_cache()
|
||||
self.delete_cache()
|
||||
|
||||
# Cache all entries in video DB
|
||||
self._cache_all_video_entries(pdialog)
|
||||
|
@ -207,7 +207,7 @@ class Artwork(object):
|
|||
count += 1
|
||||
|
||||
@classmethod
|
||||
def _delete_cache(cls):
|
||||
def delete_cache(cls):
|
||||
# Remove all existing textures first
|
||||
path = xbmc.translatePath('special://thumbnails/').decode('utf-8')
|
||||
if xbmcvfs.exists(path):
|
||||
|
@ -223,7 +223,7 @@ class Artwork(object):
|
|||
filename = os.path.join(path.encode('utf-8') + directory, file_)
|
||||
|
||||
xbmcvfs.delete(filename)
|
||||
log.info("deleted: %s", filename)
|
||||
log.debug("deleted: %s", filename)
|
||||
|
||||
# remove all existing data from texture DB
|
||||
conn = kodiSQL('texture')
|
||||
|
|
|
@ -396,32 +396,11 @@ def reset():
|
|||
cursor.close()
|
||||
|
||||
# Offer to wipe cached thumbnails
|
||||
resp = dialog.yesno(language(29999), language(33086))
|
||||
if resp:
|
||||
log.warn("Resetting all cached artwork.")
|
||||
if dialog.yesno(language(29999), language(33086)):
|
||||
log.warn("Resetting all cached artwork")
|
||||
# Remove all existing textures first
|
||||
path = xbmc.translatePath("special://thumbnails/").decode('utf-8')
|
||||
if xbmcvfs.exists(path):
|
||||
allDirs, allFiles = xbmcvfs.listdir(path)
|
||||
for dir in allDirs:
|
||||
allDirs, allFiles = xbmcvfs.listdir(path+dir)
|
||||
for file in allFiles:
|
||||
if os.path.supports_unicode_filenames:
|
||||
xbmcvfs.delete(os.path.join(path+dir.decode('utf-8'),file.decode('utf-8')))
|
||||
else:
|
||||
xbmcvfs.delete(os.path.join(path.encode('utf-8')+dir,file))
|
||||
|
||||
# remove all existing data from texture DB
|
||||
connection = kodiSQL('texture')
|
||||
cursor = connection.cursor()
|
||||
cursor.execute('SELECT tbl_name FROM sqlite_master WHERE type="table"')
|
||||
rows = cursor.fetchall()
|
||||
for row in rows:
|
||||
tableName = row[0]
|
||||
if(tableName != "version"):
|
||||
cursor.execute("DELETE FROM " + tableName)
|
||||
connection.commit()
|
||||
cursor.close()
|
||||
import artwork
|
||||
artwork.Artwork().delete_cache()
|
||||
|
||||
# reset the install run flag
|
||||
settings('SyncInstallRunDone', value="false")
|
||||
|
|
Loading…
Reference in a new issue