Skip to content

Commit

Permalink
Use new settings.xml format
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michaelarnauts authored and dagwieers committed May 12, 2020
1 parent e7d2452 commit 05c3cb8
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 18 deletions.
30 changes: 29 additions & 1 deletion resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ msgid "Refreshing"
msgstr ""

msgctxt "#30802"
msgid "Refresh interval [I](in hours)[/I]"
msgid "Refresh interval"
msgstr ""

msgctxt "#30803"
Expand All @@ -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 ""
32 changes: 30 additions & 2 deletions resources/language/resource.language.nl_nl/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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…"
Expand All @@ -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"
10 changes: 7 additions & 3 deletions resources/lib/kodiutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
85 changes: 73 additions & 12 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,76 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="30800"> <!-- Sources -->
<setting id="last_refreshed" visible="false"/>
<setting label="30801" type="lsep"/> <!-- Refreshing -->
<setting label="30802" type="select" id="refresh_interval" default="24" values="1|2|3|4|6|12|24" /> <!-- Every x hour -->
<setting label="30803" type="action" action="RunScript(service.iptv.manager,refresh)"/> <!-- Force refresh now -->
<?xml version="1.0" encoding="utf-8" ?>
<settings version="1">
<section id="iptv.manager" label="IPTV Manager">
<category id="sources" label="30800">
<group id="refreshing" label="30801">
<setting id="last_refreshed" type="integer">
<level>0</level>
<default>0</default>
<control type="edit" format="integer"/>
<visible>false</visible>
</setting>
<setting id="refresh_interval" type="integer" label="30802">
<level>0</level>
<default>24</default> <!-- Every x hour -->
<control type="spinner" format="integer">
<popup>false</popup>
</control>
<constraints>
<options>
<option label="30901">1</option>
<option label="30902">2</option>
<option label="30903">3</option>
<option label="30904">4</option>
<option label="30906">6</option>
<option label="30912">12</option>
<option label="30924">24</option>
</options>
</constraints>
</setting>
<setting id="iptv_refresh" type="action" label="30803">
<level>0</level>
<default/>
<!-- Force refresh now -->
<control type="button" format="action">
<data>RunScript(service.iptv.manager,refresh)</data>
</control>
</setting>
</group>
</category>
<category label="30820"> <!-- IPTV Simple -->
<setting label="30821" type="lsep"/> <!-- Configuration -->
<setting label="30822" type="action" option="close" action="RunScript(service.iptv.manager,setup-iptv-simple)"/> <!-- Configure IPTV Simple automatically -->
<setting label="30823" type="action" option="close" action="Addon.OpenSettings(pvr.iptvsimple)" enable="System.HasAddon(pvr.iptvsimple)"/> <!-- Open IPTV Simple settings -->
<setting label="30824" type="bool" id="iptv_simple_restart" default="true" enable="System.HasAddon(pvr.iptvsimple)"/> <!-- Automatically restart IPTV Simple -->
<category id="iptvsimple" label="30820">
<group id="configuration" label="30821">
<setting id="iptv_setup" type="action" label="30822">
<level>0</level>
<default/>
<constraints>
<close>true</close>
</constraints>
<!-- Configure IPTV Simple automatically -->
<control type="button" format="action">
<data>RunScript(service.iptv.manager,setup-iptv-simple)</data>
</control>
</setting>
<setting id="iptv_settings" type="action" label="30823">
<level>0</level>
<default/>
<!-- Open IPTV Simple settings -->
<control type="button" format="action">
<data>Addon.OpenSettings(pvr.iptvsimple)</data>
<close>true</close>
</control>
<!-- dependencies>
<dependency type="enable" setting="System.HasAddon(pvr.iptvsimple)"></dependency>
</dependencies -->
</setting>
<setting id="iptv_simple_restart" type="boolean" label="30824">
<level>0</level>
<default>true</default>
<control type="toggle"/>
<!-- dependencies>
<dependency type="enable" setting="System.HasAddon(pvr.iptvsimple)"></dependency>
</dependencies -->
</setting>
</group>
</category>
</section>
</settings>

0 comments on commit 05c3cb8

Please sign in to comment.