Fix clearing local metadata (#55)

This commit is contained in:
mediaminister 2020-11-10 22:18:41 +00:00 committed by GitHub
parent 209edde50d
commit 909ab94003
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 2 deletions

View File

@ -164,6 +164,10 @@ msgctxt "#30720"
msgid "This video is not available abroad."
msgstr ""
msgctxt "#30721"
msgid "Clearing local metadata failed."
msgstr ""
### SETTINGS
msgctxt "#30800"

View File

@ -165,6 +165,10 @@ msgctxt "#30720"
msgid "This video is not available abroad."
msgstr "Deze video is niet beschikbaar in het buitenland."
msgctxt "#30721"
msgid "Clearing local metadata failed."
msgstr "Wissen van lokale metadata is mislukt."
### SETTINGS
msgctxt "#30800"

View File

@ -3,6 +3,8 @@
from __future__ import absolute_import, division, unicode_literals
import os
from resources.lib import kodiutils
from resources.lib.viervijfzes import CHANNELS
from resources.lib.viervijfzes.content import CACHE_AUTO, CACHE_PREVENT, ContentApi, Program
@ -60,7 +62,8 @@ class Metadata:
cache_path = kodiutils.get_cache_path()
_, files = kodiutils.listdir(cache_path)
for filename in files:
kodiutils.delete(cache_path + filename)
if not kodiutils.delete(os.path.join(cache_path, filename)):
return kodiutils.ok_dialog(message=kodiutils.localize(30721)) # Clearing local metadata failed
kodiutils.set_setting('metadata_last_updated', '0')
kodiutils.ok_dialog(message=kodiutils.localize(30714)) # Local metadata is cleared
return kodiutils.ok_dialog(message=kodiutils.localize(30714)) # Local metadata is cleared