From f5192bfabed2f571b7824236d4d39694b8eb0efe Mon Sep 17 00:00:00 2001 From: FrAcTi0N Date: Tue, 12 Feb 2019 21:45:11 +0100 Subject: [PATCH] Option for delayed CECActivateSource Added option to delay running CECActivateSource because remote control was not working on some TVs after wakeup. Added slider to settings under CEC to select delay from 0 to 15 seconds Added option to settings to show popup on delayed CECActivateSource --- resources/language/resource.language.en_gb/strings.po | 8 ++++++++ resources/settings.xml | 2 ++ screensaver.py | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 1da8bad..f2247c4 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -81,6 +81,14 @@ msgctxt "#33117" msgid "CEC on Android (kernel)" msgstr "CEC on Android (kernel)" +msgctxt "#33118" +msgid "CEC timeout on wakeup (seconds)" +msgstr "CEC timeout on wakeup (seconds)" + +msgctxt "#33119" +msgid "CEC - Display notification on delayed wakeup" +msgstr "CEC - Display notification on delayed wakeup" + msgctxt "#33200" msgid "Power" msgstr "Power" diff --git a/resources/settings.xml b/resources/settings.xml index a47beb6..885a623 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -3,6 +3,8 @@ + + diff --git a/screensaver.py b/screensaver.py index bf5c66d..aee2ea0 100644 --- a/screensaver.py +++ b/screensaver.py @@ -4,7 +4,7 @@ import xbmc import xbmcaddon import xbmcgui - +import time def log_error(msg='', level=xbmc.LOGERROR): xbmc.log(msg='[%s] %s' % (addon_name, msg), level=level) @@ -129,6 +129,10 @@ def exit(self): if display_method != 0: log_notice(msg='Turn display signal back on using method %s' % display_method) if display_method == '1': # CEC (built-in) + cec_timeout_number = int(cec_timeout) + if cec_timeout_message== 'true' and cec_timeout_number > 0: popup(msg="Cec activation delayed by %s s" % (cec_timeout_number),heading="Delayed activation") + time.sleep(cec_timeout_number) + if cec_timeout_message== 'true' and cec_timeout_number > 0: popup(msg="Cec activated",heading="Delayed activation") run_builtin('CECActivateSource') elif display_method == '2': # No Signal on Raspberry Pi (using vcgencmd) run_command(['vcgencmd', 'display_power', '1']) @@ -155,6 +159,8 @@ def exit(self): addon_path = addon.getAddonInfo('path') addon_icon = addon.getAddonInfo('icon') display_method = addon.getSetting('display_method') + cec_timeout = addon.getSetting('cec_timeout') + cec_timeout_message = addon.getSetting('cec_timeout_message') power_method = addon.getSetting('power_method') logoff = addon.getSetting('logoff') mute = addon.getSetting('mute')