From 909ab940037cb4ce8f6aa9e06e9f86d012055888 Mon Sep 17 00:00:00 2001 From: mediaminister <45148099+mediaminister@users.noreply.github.com> Date: Tue, 10 Nov 2020 22:18:41 +0000 Subject: [PATCH] Fix clearing local metadata (#55) --- resources/language/resource.language.en_gb/strings.po | 4 ++++ resources/language/resource.language.nl_nl/strings.po | 4 ++++ resources/lib/modules/metadata.py | 7 +++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 7a4f1f6..64e56d4 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -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" diff --git a/resources/language/resource.language.nl_nl/strings.po b/resources/language/resource.language.nl_nl/strings.po index 4478175..8d23590 100644 --- a/resources/language/resource.language.nl_nl/strings.po +++ b/resources/language/resource.language.nl_nl/strings.po @@ -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" diff --git a/resources/lib/modules/metadata.py b/resources/lib/modules/metadata.py index 1189e76..5708fc3 100644 --- a/resources/lib/modules/metadata.py +++ b/resources/lib/modules/metadata.py @@ -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