From dd6b7236b87a06c700ee8e3d7686230ea8e13159 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Sat, 17 Feb 2007 18:55:26 +0000 Subject: [PATCH] zaptimers now do wakeup the box from standby and deepstandby --- RecordTimer.py | 26 +++++++++++++++++++++++--- lib/python/Screens/Standby.py | 7 +++---- mytest.py | 18 +++++++++++++----- 3 files changed, 39 insertions(+), 12 deletions(-) diff --git a/RecordTimer.py b/RecordTimer.py index 1e21091d..b18a594d 100644 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -236,8 +236,15 @@ class RecordTimerEntry(timer.TimerEntry): return True if self.justplay: - self.log(11, "zapping") - NavigationInstance.instance.playService(self.service_ref.ref) + if Screens.Standby.inStandby: + self.log(11, "wakeup and zap") + #set service to zap after standby + Screens.Standby.inStandby.prev_running_service = self.service_ref.ref + #wakeup standby + Screens.Standby.inStandby.Power() + else: + self.log(11, "zapping") + NavigationInstance.instance.playService(self.service_ref.ref) return True else: self.log(11, "start recording") @@ -437,12 +444,25 @@ class RecordTimer(timer.Timer): file.write(x) file.close() + def getNextZapTime(self): + llen = len(self.timer_list) + idx = 0 + now = time.time() + while idx < llen: + timer = self.timer_list[idx] + if not timer.justplay or timer.begin < now: + idx += 1 + else: + return timer.begin + return -1 + def getNextRecordingTime(self): llen = len(self.timer_list) idx = 0 + now = time.time() while idx < llen: timer = self.timer_list[idx] - if timer.justplay: + if timer.justplay or timer.begin < now: idx += 1 else: return timer.begin diff --git a/lib/python/Screens/Standby.py b/lib/python/Screens/Standby.py index 88367cf7..a7819268 100644 --- a/lib/python/Screens/Standby.py +++ b/lib/python/Screens/Standby.py @@ -5,7 +5,7 @@ from Components.AVSwitch import AVSwitch from enigma import eDVBVolumecontrol, eDBoxLCD, eServiceReference from Components.Sources.Clock import Clock -inStandby = False +inStandby = None class Standby(Screen): def Power(self): @@ -63,12 +63,11 @@ class Standby(Screen): def __onShow(self): global inStandby - inStandby = True + inStandby = self def __onHide(self): global inStandby - inStandby = False - + inStandby = None class StandbySummary(Screen): skin = """ diff --git a/mytest.py b/mytest.py index 58c5c680..e674a295 100644 --- a/mytest.py +++ b/mytest.py @@ -493,13 +493,21 @@ def runScreenTest(): from time import time from Tools.DreamboxHardware import setFPWakeuptime + #get next record timer start time nextRecordingTime = session.nav.RecordTimer.getNextRecordingTime() - if nextRecordingTime != -1: - if (nextRecordingTime - time() < 330): # no time to switch box back on - setFPWakeuptime(time() + 30) # so switch back on in 30 seconds + #get next zap timer start time + nextZapTime = session.nav.RecordTimer.getNextZapTime() + #get currentTime + nowTime = time() + if nextZapTime != -1 and nextRecordingTime != -1: + startTime = nextZapTime < nextRecordingTime and nextZapTime or nextRecordingTime + else: + startTime = nextZapTime != -1 and nextZapTime or nextRecordingTime + if startTime != -1: + if (startTime - nowTime < 330): # no time to switch box back on + setFPWakeuptime(nowTime + 30) # so switch back on in 30 seconds else: - setFPWakeuptime(nextRecordingTime - (300)) - + setFPWakeuptime(startTime - 300) session.nav.stopService() session.nav.shutdown() -- 2.30.2