Use a wasInDeepstandby flag for timerhandling
authorLittlesat <littlesat99@yahoo.com>
Thu, 26 Sep 2013 07:05:07 +0000 (09:05 +0200)
committerLittlesat <littlesat99@yahoo.com>
Thu, 26 Sep 2013 07:05:07 +0000 (09:05 +0200)
This allow more time to retreive a receiver time and reduces a chance that
a recording was missed. Probably I can later remove the 30 sec delay
completely

In addition add some recommendations from Dima73 - but a bit different

Navigation.py
RecordTimer.py

index 9eb60db..b7f7741 100644 (file)
@@ -42,11 +42,10 @@ class Navigation:
                        eActionMap.getInstance().bindAction('', -maxint - 1, self.keypress)
 
        def checkShutdownAfterRecording(self):
-               if len(self.getRecordings()) or abs(self.RecordTimer.getNextTimerTime() - time()) <= 360:
+               if RecordTimer.chechForRecordings():
                        if Screens.Standby.inStandby: #In case some plugin did put the receiver already in standby
                                config.misc.standbyCounter.value = 0
-                       else:
-                               Notifications.AddNotification(Screens.Standby.Standby, StandbyCounterIncrease=False)
+                       RecordTimer.RecordTimerEntry.wasInDeepStandby = True
                        self.keypress() #this ensures to unbind the keypress detection  
 
        def keypress(self, key=None, flag=1):
index 1d76332..602fb82 100644 (file)
@@ -71,13 +71,14 @@ def findSafeRecordPath(dirname):
 def chechForRecordings():
        if NavigationInstance.instance.getRecordings():
                return True
-       rec_time = NavigationInstance.instance.RecordTimer.getNextRecordingTime()
+       rec_time = NavigationInstance.instance.RecordTimer.getNextTimerTime()
        return rec_time > 0 and (rec_time - time()) < 360
 
 # please do not translate log messages
 class RecordTimerEntry(timer.TimerEntry, object):
 ######### the following static methods and members are only in use when the box is in (soft) standby
        wasInStandby = False
+       wasInDeepStandby = False
        receiveRecordEvents = False
 
        @staticmethod
@@ -90,6 +91,7 @@ class RecordTimerEntry(timer.TimerEntry, object):
        def setWasInStandby():
                if not RecordTimerEntry.wasInStandby:
                        RecordTimerEntry.wasInStandby = True
+                       RecordTimerEntry.wasInDeepStandby = False
                        eActionMap.getInstance().bindAction('', -maxint - 1, RecordTimerEntry.keypress)
 
        @staticmethod
@@ -281,6 +283,8 @@ class RecordTimerEntry(timer.TimerEntry, object):
                                        #wakeup standby
                                        Screens.Standby.inStandby.Power()
                                else:
+                                       if RecordTimerEntry.wasInDeepStandby:
+                                               RecordTimerEntry.setWasInStandby()
                                        cur_zap_ref = NavigationInstance.instance.getCurrentlyPlayingServiceReference()
                                        if cur_zap_ref and not cur_zap_ref.getPath():# we do not zap away if it is no live service
                                                Notifications.AddNotification(MessageBox, _("In order to record a timer, the TV was switched to the recording service!\n"), type=MessageBox.TYPE_INFO, timeout=20)
@@ -341,11 +345,19 @@ class RecordTimerEntry(timer.TimerEntry, object):
                                        #wakeup standby
                                        Screens.Standby.inStandby.Power()
                                else:
+                                       if RecordTimerEntry.wasInDeepStandby:
+                                               RecordTimerEntry.setWasInStandby()
                                        self.log(11, "zapping")
                                        NavigationInstance.instance.playService(self.service_ref.ref)
                                return True
                        else:
                                self.log(11, "start recording")
+
+                               if RecordTimerEntry.wasInDeepStandby:
+                                       RecordTimerEntry.wasInDeepStandby = False
+                                       if not Screens.Standby.inStandby:
+                                               Notifications.AddNotification(Screens.Standby.Standby, StandbyCounterIncrease=False)
+
                                record_res = self.record_service.start()
                                
                                if record_res: