mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 02:36:10 +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
|
# ask to rest all existing or not
|
||||||
if dialog(type_="yesno", heading="{emby}", line1=lang(33044)):
|
if dialog(type_="yesno", heading="{emby}", line1=lang(33044)):
|
||||||
log.info("Resetting all cache data first")
|
log.info("Resetting all cache data first")
|
||||||
self._delete_cache()
|
self.delete_cache()
|
||||||
|
|
||||||
# Cache all entries in video DB
|
# Cache all entries in video DB
|
||||||
self._cache_all_video_entries(pdialog)
|
self._cache_all_video_entries(pdialog)
|
||||||
|
@ -207,7 +207,7 @@ class Artwork(object):
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _delete_cache(cls):
|
def delete_cache(cls):
|
||||||
# Remove all existing textures first
|
# Remove all existing textures first
|
||||||
path = xbmc.translatePath('special://thumbnails/').decode('utf-8')
|
path = xbmc.translatePath('special://thumbnails/').decode('utf-8')
|
||||||
if xbmcvfs.exists(path):
|
if xbmcvfs.exists(path):
|
||||||
|
@ -223,7 +223,7 @@ class Artwork(object):
|
||||||
filename = os.path.join(path.encode('utf-8') + directory, file_)
|
filename = os.path.join(path.encode('utf-8') + directory, file_)
|
||||||
|
|
||||||
xbmcvfs.delete(filename)
|
xbmcvfs.delete(filename)
|
||||||
log.info("deleted: %s", filename)
|
log.debug("deleted: %s", filename)
|
||||||
|
|
||||||
# remove all existing data from texture DB
|
# remove all existing data from texture DB
|
||||||
conn = kodiSQL('texture')
|
conn = kodiSQL('texture')
|
||||||
|
|
|
@ -396,32 +396,11 @@ def reset():
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
# Offer to wipe cached thumbnails
|
# Offer to wipe cached thumbnails
|
||||||
resp = dialog.yesno(language(29999), language(33086))
|
if dialog.yesno(language(29999), language(33086)):
|
||||||
if resp:
|
log.warn("Resetting all cached artwork")
|
||||||
log.warn("Resetting all cached artwork.")
|
|
||||||
# Remove all existing textures first
|
# Remove all existing textures first
|
||||||
path = xbmc.translatePath("special://thumbnails/").decode('utf-8')
|
import artwork
|
||||||
if xbmcvfs.exists(path):
|
artwork.Artwork().delete_cache()
|
||||||
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()
|
|
||||||
|
|
||||||
# reset the install run flag
|
# reset the install run flag
|
||||||
settings('SyncInstallRunDone', value="false")
|
settings('SyncInstallRunDone', value="false")
|
||||||
|
|
Loading…
Reference in a new issue