Skip to content

Commit

Permalink
Add delay setting #4
Browse files Browse the repository at this point in the history
  • Loading branch information
eracknaphobia committed Dec 11, 2024
1 parent 0d6a13f commit ea28355
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.nhlscores" name="NHL Scores" version="2023.12.27+matrix.1" provider-name="eracknaphobia">
<addon id="script.nhlscores" name="NHL Scores" version="2024.12.11+matrix.1" provider-name="eracknaphobia">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.pytz" />
Expand All @@ -12,7 +12,7 @@
<description lang="en_GB">Live scoring and game updates via kodi notifications
</description>
<news>
- Fixed for upstream api changes
- Add ability to set a delay before displaying notifications
</news>
<language>en</language>
<platform>all</platform>
Expand Down
4 changes: 4 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ msgctxt "#30330"
msgid "Seconds to Display"
msgstr ""

msgctxt "#30335"
msgid "Seconds to Delay Notifictaions"
msgstr ""

msgctxt "#30340"
msgid "Include Goal Description"
msgstr ""
Expand Down
2 changes: 2 additions & 0 deletions resources/lib/scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ def check_if_changed(self, new_item, old_item):
if self.addon.getSetting(id="goal_desc") == 'true' and new_item['headshot'] != '': img = new_item['headshot']

if title is not None and message is not None:
# Delay displaying notification X seconds
self.monitor.waitForAbort(int(self.addon.getSetting(id="delay_seconds")))
self.notify(title, message, img)
self.monitor.waitForAbort(self.display_seconds + 5)

Expand Down
12 changes: 12 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
<popup>false</popup>
</control>
</setting>
<setting id="delay_seconds" type="integer" label="30335" help="">
<level>0</level>
<default>0</default>
<constraints>
<minimum>0</minimum>
<step>5</step>
<maximum>180</maximum>
</constraints>
<control type="slider" format="integer">
<popup>false</popup>
</control>
</setting>
<setting id="goal_desc" type="boolean" label="30340" help="">
<level>0</level>
<default>true</default>
Expand Down

0 comments on commit ea28355

Please sign in to comment.