Add extra inactvity detection block timer
authorlittlesat <littlesat99@yahoo.com>
Tue, 7 Apr 2015 14:55:06 +0000 (16:55 +0200)
committerlittlesat <littlesat99@yahoo.com>
Tue, 7 Apr 2015 14:55:06 +0000 (16:55 +0200)
For when you're sleeping at night and working overday...

lib/python/Components/UsageConfig.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/SleepTimerEdit.py

index 1ed1d54..02368b2 100644 (file)
@@ -138,8 +138,11 @@ def InitUsageConfig():
                choicelist.append(("%d" % i, _("Standby in ") + h))
        config.usage.inactivity_timer = ConfigSelection(default = "0", choices = choicelist)
        config.usage.inactivity_timer_blocktime = ConfigYesNo(default = True)
-       config.usage.inactivity_timer_blocktime_begin = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
+       config.usage.inactivity_timer_blocktime_begin = ConfigClock(default = time.mktime((0, 0, 0, 18, 0, 0, 0, 0, 0)))
        config.usage.inactivity_timer_blocktime_end = ConfigClock(default = time.mktime((0, 0, 0, 23, 0, 0, 0, 0, 0)))
+       config.usage.inactivity_timer_blocktime_extra = ConfigYesNo(default = False)
+       config.usage.inactivity_timer_blocktime_extra_begin = ConfigClock(default = time.mktime((0, 0, 0, 6, 0, 0, 0, 0, 0)))
+       config.usage.inactivity_timer_blocktime_extra_end = ConfigClock(default = time.mktime((0, 0, 0, 9, 0, 0, 0, 0, 0)))
 
        choicelist = [("0", _("Disabled")),("event_standby", _("Standby after current event"))]
        for i in range(900, 7201, 900):
index a1cc269..fab0f59 100644 (file)
@@ -3246,7 +3246,10 @@ class InfoBarPowersaver:
                                curtime = (curtime.tm_hour, curtime.tm_min, curtime.tm_sec)
                                begintime = tuple(config.usage.inactivity_timer_blocktime_begin.value)
                                endtime = tuple(config.usage.inactivity_timer_blocktime_end.value)
-                               if begintime <= endtime and (curtime >= begintime and curtime < endtime) or begintime > endtime and (curtime >= begintime or curtime < endtime):
+                               begintime_extra = tuple(config.usage.inactivity_timer_blocktime_extra_begin.value)
+                               endtime_extra = tuple(config.usage.inactivity_timer_blocktime_extra_end.value)
+                               if begintime <= endtime and (curtime >= begintime and curtime < endtime) or begintime > endtime and (curtime >= begintime or curtime < endtime) or config.usage.inactivity_timer_blocktime_extra.value and\
+                               (begintime_extra <= endtime_extra and (curtime >= begintime_extra and curtime < endtime_extra) or begintime_extra > endtime_extra and (curtime >= begintime_extra or curtime < endtime_extra)):
                                        duration = (endtime[0]*3600 + endtime[1]*60) - (curtime[0]*3600 + curtime[1]*60 + curtime[2])
                                        if duration:
                                                if duration < 0:
index 1df7d78..77acb59 100644 (file)
@@ -59,6 +59,16 @@ class SleepTimerEdit(ConfigListScreen, Screen):
                                self.list.append(getConfigListEntry(_("End time to ignore inactivity sleeptimer"),
                                        config.usage.inactivity_timer_blocktime_end,
                                        _("Specify the end time until the inactivity sleeptimer should be ignored")))
+                               self.list.append(getConfigListEntry(_("Specify extra timeframe to ignore inactivity sleeptimer"),
+                                       config.usage.inactivity_timer_blocktime_extra,
+                                       _("When enabled you can specify an extra timeframe were the inactivity sleeptimer is ignored. Not the detection is disabled during this timeframe but the inactivity timeout is disabled")))
+                               if config.usage.inactivity_timer_blocktime_extra.value:
+                                       self.list.append(getConfigListEntry(_("Extra start time to ignore inactivity sleeptimer"),
+                                               config.usage.inactivity_timer_blocktime_extra_begin,
+                                               _("Specify the extra start time when the inactivity sleeptimer should be ignored")))
+                                       self.list.append(getConfigListEntry(_("Extra end time to ignore inactivity sleeptimer"),
+                                               config.usage.inactivity_timer_blocktime_extra_end,
+                                               _("Specify the extra end time until the inactivity sleeptimer should be ignored")))
                self.list.append(getConfigListEntry(_("Shutdown when in Standby"),
                        config.usage.standby_to_shutdown_timer,
                        _("Configure the duration when the receiver should go to shut down in case the receiver is in standby mode.")))