Skip to content

Commit

Permalink
[script.service.hue] 1.4.17
Browse files Browse the repository at this point in the history
  • Loading branch information
zim514 committed Jul 2, 2023
1 parent 59c7e32 commit c072450
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
11 changes: 9 additions & 2 deletions script.service.hue/addon.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<addon id="script.service.hue" name="Hue Service" provider-name="zim514" version="1.4.15">
<addon id="script.service.hue" name="Hue Service" provider-name="zim514" version="1.4.17">

<requires>
<import addon="xbmc.python" version="3.0.0"/>
Expand All @@ -21,7 +21,14 @@
</assets>
<source>https://github.com/zim514/script.service.hue</source>
<forum>https://forum.kodi.tv/showthread.php?tid=344886</forum>
<news>v1.4.15
<news>v1.4.17
- Fix ambilight crash on sunset / activation when no video is playing
- Ignore Bridge throttle errors during discovery

v1.4.16
- Translations updates from Weblate

v1.4.15
- Fix 'disable during daylight' option
- Localisation updates from Weblate
- Improved connection error handling
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2023-03-25 05:16+0000\n"
"PO-Revision-Date: 2023-05-09 06:24+0000\n"
"Last-Translator: taxigps <[email protected]>\n"
"Language-Team: Chinese (China) <https://kodi.weblate.cloud/projects/kodi-add-ons-scripts/script-service-hue/zh_cn/>\n"
"Language: zh_cn\n"
Expand Down Expand Up @@ -66,7 +66,7 @@ msgstr "桥接器"

msgctxt "#30501"
msgid "Discover Hue Bridge / Enter IP"
msgstr "Discover Hue Bridge / Enter IP"
msgstr "发现 Hue 桥接器 / 输入 IP"

msgctxt "#30502"
msgid "Bridge IP"
Expand Down
28 changes: 15 additions & 13 deletions script.service.hue/resources/lib/ambigroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,25 @@ def _force_on(ambi_lights, bridge, saved_light_states):
def onAVStarted(self):
xbmc.log(f"Ambilight AV Started. Group enabled: {self.enabled} , isPlayingVideo: {self.isPlayingVideo()}, isPlayingAudio: {self.isPlayingAudio()}, self.playbackType(): {self.playback_type()}")
# xbmc.log(f"Ambilight Settings: Interval: {self.update_interval}, transitionTime: {self.transition_time}")
self.state = STATE_PLAYING
if self.enabled:
# save light state
self.saved_light_states = self._get_light_states(self.ambi_lights, self.bridge)

self.video_info_tag = self.getVideoInfoTag()
if self.isPlayingVideo():
if self.enabled and self.check_active_time() and self.check_video_activation(self.video_info_tag):
if self.isPlayingVideo():
self.state = STATE_PLAYING
if self.enabled:
# save light state
self.saved_light_states = self._get_light_states(self.ambi_lights, self.bridge)

self.video_info_tag = self.getVideoInfoTag()
if self.isPlayingVideo():
if self.enabled and self.check_active_time() and self.check_video_activation(self.video_info_tag):

if self.disable_labs:
self._stop_effects()
if self.disable_labs:
self._stop_effects()

if self.force_on:
self._force_on(self.ambi_lights, self.bridge, self.saved_light_states)
if self.force_on:
self._force_on(self.ambi_lights, self.bridge, self.saved_light_states)

ambi_loop_thread = Thread(target=self._ambi_loop, name="_ambi_loop", daemon=True)
ambi_loop_thread.start()
ambi_loop_thread = Thread(target=self._ambi_loop, name="_ambi_loop", daemon=True)
ambi_loop_thread.start()

def onPlayBackStopped(self):
# always stop ambilight even if group is disabled or it'll run forever
Expand Down
2 changes: 2 additions & 0 deletions script.service.hue/resources/lib/hueconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def _discover_nupnp(self):
req = ""
try:
req = requests.get('https://discovery.meethue.com/')
if req.status_code == 429:
return None
result = req.json()
except requests.exceptions.RequestException as error:
xbmc.log(f"[script.service.hue] Nupnp failed: {error}")
Expand Down
2 changes: 1 addition & 1 deletion script.service.hue/resources/lib/kodiutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def cache_get(key: str):
return None


def cache_set(key, data):
def cache_set(key: str, data):
data_str = json.dumps(data)
# xbmc.log(f"[script.service.hue] Cache Set: {key}, {data_str} - {data_type}")
cache_window.setProperty(f"{ADDONID}.{key}]", data_str)
Expand Down

0 comments on commit c072450

Please sign in to comment.