Finetunes for recordings from deepstandby
authorLittlesat <littlesat99@yahoo.com>
Fri, 6 Sep 2013 18:20:10 +0000 (20:20 +0200)
committerLittlesat <littlesat99@yahoo.com>
Fri, 6 Sep 2013 18:20:10 +0000 (20:20 +0200)
Stop service at first standby when the clock/time is known
Add flag to go only to deepstandby when the first standby was initiated by
coming from deepstandby

Navigation.py
RecordTimer.py

index 75e7c91..f80d21f 100644 (file)
@@ -3,7 +3,7 @@ from Components.ParentalControl import parentalControl
 from Tools.BoundFunction import boundFunction
 from Tools.StbHardware import setFPWakeuptime, getFPWakeuptime, getFPWasTimerWakeup
 from Tools import Notifications
-from time import time
+from time import time, localtime
 import RecordTimer
 import Screens.Standby
 import NavigationInstance
@@ -34,6 +34,19 @@ class Navigation:
                self.__wasTimerWakeup = getFPWasTimerWakeup()
                if self.__wasTimerWakeup:
                        Notifications.AddNotification(Screens.Standby.Standby)
+                       RecordTimer.RecordTimerEntry.firstStandby = True
+                       self.stopServiceInStandbyTimer = eTimer()
+                       self.stopServiceInStandbyTimer.callback.append(self.stopServiceInStandby)
+                       self.stopServiceInStandbyTimer.start(3000, True)
+
+       def stopServiceInStandby(self):
+               if Screens.Standby.inStandby:
+                       if localtime(time()).tm_year != 1970: #if time is known we can stop the service
+                               Screens.Standby.inStandby.prev_running_service = self.currentlyPlayingServiceOrGroup
+                               Screens.Standby.inStandby.paused_service = None
+                               self.stopService()
+                       else:
+                               self.stopServiceInStandbyTimer.start(3000, True)
 
        def wasTimerWakeup(self):
                return self.__wasTimerWakeup
index f951fc9..968f17c 100644 (file)
@@ -72,6 +72,7 @@ def findSafeRecordPath(dirname):
 class RecordTimerEntry(timer.TimerEntry, object):
 ######### the following static methods and members are only in use when the box is in (soft) standby
        receiveRecordEvents = False
+       firstStandby = False
 
        @staticmethod
        def shutdown():
@@ -359,7 +360,8 @@ class RecordTimerEntry(timer.TimerEntry, object):
                        if not self.justplay:
                                NavigationInstance.instance.stopRecordService(self.record_service)
                                self.record_service = None
-                       if self.afterEvent == AFTEREVENT.DEEPSTANDBY or (Screens.Standby.inStandby or self.wasInStandby) and NavigationInstance.instance.wasTimerWakeup() and config.misc.standbyCounter.value == 1:
+                       if self.afterEvent == AFTEREVENT.DEEPSTANDBY or (Screens.Standby.inStandby or self.wasInStandby) and NavigationInstance.instance.wasTimerWakeup() and \
+                               config.misc.standbyCounter.value == 1 and self.firstStandby:
                                if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
                                        if Screens.Standby.inStandby: # in standby
                                                RecordTimerEntry.TryQuitMainloop() # start shutdown handling without screen