zaptimers now do wakeup the box from standby and deepstandby
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 17 Feb 2007 18:55:26 +0000 (18:55 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sat, 17 Feb 2007 18:55:26 +0000 (18:55 +0000)
RecordTimer.py
lib/python/Screens/Standby.py
mytest.py

index 1e21091..b18a594 100644 (file)
@@ -236,8 +236,15 @@ class RecordTimerEntry(timer.TimerEntry):
                                return True
 
                        if self.justplay:
                                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")
                                return True
                        else:
                                self.log(11, "start recording")
@@ -437,12 +444,25 @@ class RecordTimer(timer.Timer):
                        file.write(x)
                file.close()
 
                        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
        def getNextRecordingTime(self):
                llen = len(self.timer_list)
                idx = 0
+               now = time.time()
                while idx < llen:
                        timer = self.timer_list[idx]
                while idx < llen:
                        timer = self.timer_list[idx]
-                       if timer.justplay:
+                       if timer.justplay or timer.begin < now:
                                idx += 1
                        else:
                                return timer.begin
                                idx += 1
                        else:
                                return timer.begin
index 88367cf..a781926 100644 (file)
@@ -5,7 +5,7 @@ from Components.AVSwitch import AVSwitch
 from enigma import eDVBVolumecontrol, eDBoxLCD, eServiceReference
 from Components.Sources.Clock import Clock
 
 from enigma import eDVBVolumecontrol, eDBoxLCD, eServiceReference
 from Components.Sources.Clock import Clock
 
-inStandby = False
+inStandby = None
 
 class Standby(Screen):
        def Power(self):
 
 class Standby(Screen):
        def Power(self):
@@ -63,12 +63,11 @@ class Standby(Screen):
 
        def __onShow(self):
                global inStandby
 
        def __onShow(self):
                global inStandby
-               inStandby = True
+               inStandby = self
 
        def __onHide(self):
                global inStandby
 
        def __onHide(self):
                global inStandby
-               inStandby = False
-
+               inStandby = None
 
 class StandbySummary(Screen):
        skin = """
 
 class StandbySummary(Screen):
        skin = """
index 58c5c68..e674a29 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -493,13 +493,21 @@ def runScreenTest():
 
        from time import time
        from Tools.DreamboxHardware import setFPWakeuptime
 
        from time import time
        from Tools.DreamboxHardware import setFPWakeuptime
+       #get next record timer start time
        nextRecordingTime = session.nav.RecordTimer.getNextRecordingTime()
        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:
                else:
-                       setFPWakeuptime(nextRecordingTime - (300))
-       
+                       setFPWakeuptime(startTime - 300)
        session.nav.stopService()
        session.nav.shutdown()
        
        session.nav.stopService()
        session.nav.shutdown()