From 9ecb6467a3050622282ee9ff92a594aea2537131 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Mon, 11 May 2020 17:06:19 +0200 Subject: [PATCH] Use new settings.xml format Implement the new settings format. Since we are targetting Leia and Matrix only, we might as well move now to the newt settings.xml format. --- .../resource.language.en_gb/strings.po | 30 ++++++- .../resource.language.nl_nl/strings.po | 32 ++++++- resources/lib/kodiutils.py | 10 ++- resources/settings.xml | 85 ++++++++++++++++--- 4 files changed, 139 insertions(+), 18 deletions(-) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 7ecfc70..ba6ef91 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -45,7 +45,7 @@ msgid "Refreshing" msgstr "" msgctxt "#30802" -msgid "Refresh interval [I](in hours)[/I]" +msgid "Refresh interval" msgstr "" msgctxt "#30803" @@ -71,3 +71,31 @@ msgstr "" msgctxt "#30824" msgid "Automatically restart IPTV Simple to refresh the data" msgstr "" + +msgctxt "#30901" +msgid "Every hour" +msgstr "" + +msgctxt "#30902" +msgid "Every 2 hours" +msgstr "" + +msgctxt "#30903" +msgid "Every 3 hours" +msgstr "" + +msgctxt "#30904" +msgid "Every 4 hours" +msgstr "" + +msgctxt "#30906" +msgid "Every 6 hours" +msgstr "" + +msgctxt "#30912" +msgid "Every 12 hours" +msgstr "" + +msgctxt "#30924" +msgid "Every day" +msgstr "" diff --git a/resources/language/resource.language.nl_nl/strings.po b/resources/language/resource.language.nl_nl/strings.po index 1d84936..ca30839 100644 --- a/resources/language/resource.language.nl_nl/strings.po +++ b/resources/language/resource.language.nl_nl/strings.po @@ -46,8 +46,8 @@ msgid "Refreshing" msgstr "Verniewen" msgctxt "#30802" -msgid "Refresh interval [I](in hours)[/I]" -msgstr "Vernieuwsingsinterval [I](in uren)[/I]" +msgid "Refresh interval" +msgstr "Vernieuwsingsinterval" msgctxt "#30803" msgid "Refresh channels and guide now…" @@ -72,3 +72,31 @@ msgstr "Open de IPTV Simple instellingen…" msgctxt "#30824" msgid "Automatically restart IPTV Simple to refresh the data" msgstr "Herstart IPTV Simple automatisch om de data te vernieuwen" + +msgctxt "#30901" +msgid "Every hour" +msgstr "Elk uur" + +msgctxt "#30902" +msgid "Every 2 hours" +msgstr "Elke 2 uur" + +msgctxt "#30903" +msgid "Every 3 hours" +msgstr "Elke 3 uur" + +msgctxt "#30904" +msgid "Every 4 hours" +msgstr "Elke 4 uur" + +msgctxt "#30906" +msgid "Every 6 hours" +msgstr "Elke 6 uur" + +msgctxt "#30912" +msgid "Every 12 hours" +msgstr "Elke 12 uur" + +msgctxt "#30924" +msgid "Every day" +msgstr "Elke dag" diff --git a/resources/lib/kodiutils.py b/resources/lib/kodiutils.py index 47d7e53..6659d53 100644 --- a/resources/lib/kodiutils.py +++ b/resources/lib/kodiutils.py @@ -199,9 +199,13 @@ def get_setting_int(key, default=None): """Get an add-on setting as integer""" # ADDON.getSettingInt(key) doesn't work in Leia for settings without "number" try: - return int(get_setting(key, default)) - except ValueError: # Occurs when not an integer - return default + return ADDON.getSettingInt(key) + except (AttributeError, TypeError): # On Krypton or older, or when not a float + value = get_setting(key, default) + try: + return int(value) + except ValueError: + return default except RuntimeError: # Occurs when the add-on is disabled return default diff --git a/resources/settings.xml b/resources/settings.xml index 4c99ece..b5695fe 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -1,15 +1,76 @@ - - - - - - - + + +
+ + + + 0 + 0 + + false + + + 0 + 24 + + false + + + + + + + + + + + + + + + 0 + + + + RunScript(service.iptv.manager,refresh) + + + - - - - - + + + + 0 + + + true + + + + RunScript(service.iptv.manager,setup-iptv-simple) + + + + 0 + + + + Addon.OpenSettings(pvr.iptvsimple) + true + + + + + 0 + true + + + + +