From c072450d6cf917a149b341e702131fdad8fae706 Mon Sep 17 00:00:00 2001 From: zim514 Date: Sun, 2 Jul 2023 22:54:14 +0000 Subject: [PATCH] [script.service.hue] 1.4.17 --- script.service.hue/addon.xml | 11 ++++++-- .../resource.language.zh_cn/strings.po | 4 +-- script.service.hue/resources/lib/ambigroup.py | 28 ++++++++++--------- .../resources/lib/hueconnection.py | 2 ++ script.service.hue/resources/lib/kodiutils.py | 2 +- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/script.service.hue/addon.xml b/script.service.hue/addon.xml index 3a20be1ded..a6fd9d1658 100644 --- a/script.service.hue/addon.xml +++ b/script.service.hue/addon.xml @@ -1,4 +1,4 @@ - + @@ -21,7 +21,14 @@ https://github.com/zim514/script.service.hue https://forum.kodi.tv/showthread.php?tid=344886 - v1.4.15 + 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 diff --git a/script.service.hue/resources/language/resource.language.zh_cn/strings.po b/script.service.hue/resources/language/resource.language.zh_cn/strings.po index fcc0983d00..101641aa2d 100644 --- a/script.service.hue/resources/language/resource.language.zh_cn/strings.po +++ b/script.service.hue/resources/language/resource.language.zh_cn/strings.po @@ -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 \n" "Language-Team: Chinese (China) \n" "Language: zh_cn\n" @@ -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" diff --git a/script.service.hue/resources/lib/ambigroup.py b/script.service.hue/resources/lib/ambigroup.py index 670e9b6316..a38c4f8593 100644 --- a/script.service.hue/resources/lib/ambigroup.py +++ b/script.service.hue/resources/lib/ambigroup.py @@ -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 diff --git a/script.service.hue/resources/lib/hueconnection.py b/script.service.hue/resources/lib/hueconnection.py index a1e6714086..61f99af1ab 100644 --- a/script.service.hue/resources/lib/hueconnection.py +++ b/script.service.hue/resources/lib/hueconnection.py @@ -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}") diff --git a/script.service.hue/resources/lib/kodiutils.py b/script.service.hue/resources/lib/kodiutils.py index c1cd08b657..d571e6fac1 100644 --- a/script.service.hue/resources/lib/kodiutils.py +++ b/script.service.hue/resources/lib/kodiutils.py @@ -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)