Navigation: delay the 'shutdown after recording' decision with 30s
authorpieterg <pieterg@users.sourceforge.net>
Tue, 28 Jun 2011 22:56:16 +0000 (00:56 +0200)
committerpieterg <pieterg@users.sourceforge.net>
Tue, 28 Jun 2011 22:56:16 +0000 (00:56 +0200)
The systemtime might nog have been synced yet, so early after startup.
This could cause the recording start check to fail.
Delaying the check with 30s avoids the race.

Navigation.py

index 5128bb6..f205331 100644 (file)
@@ -1,4 +1,4 @@
-from enigma import eServiceCenter, eServiceReference, pNavigation, getBestPlayableServiceReference, iPlayableService
+from enigma import eServiceCenter, eServiceReference, eTimer, pNavigation, getBestPlayableServiceReference, iPlayableService
 from Components.ParentalControl import parentalControl
 from Tools.BoundFunction import boundFunction
 from Tools.DreamboxHardware import setFPWakeuptime, getFPWakeuptime, getFPWasTimerWakeup, clearFPWasTimerWakeup
@@ -33,11 +33,20 @@ class Navigation:
                        clearFPWasTimerWakeup()
                        if getFPWasTimerWakeup(): # sanity check to detect if the FP driver is working correct!
                                print "buggy fp driver detected!!! please update drivers.... ignore timer wakeup!"
-                       elif nextRecordTimerAfterEventActionAuto and (len(self.getRecordings()) or abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360):
-                               if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
-                                       RecordTimer.RecordTimerEntry.TryQuitMainloop(False) # start shutdown handling
+                       elif nextRecordTimerAfterEventActionAuto:
+                               # We need to give the systemclock the chance to sync with the transponder time, 
+                               # before we will make the decision about whether or not we need to shutdown 
+                               # after the upcoming recording has completed
+                               self.recordshutdowntimer = eTimer()
+                               self.recordshutdowntimer.callback.append(self.checkShutdownAfterRecording)
+                               self.recordshutdowntimer.start(30000, True)
                self.SleepTimer = SleepTimer.SleepTimer()
 
+       def checkShutdownAfterRecording(self):
+               if len(self.getRecordings()) or abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360:
+                       if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open
+                               RecordTimer.RecordTimerEntry.TryQuitMainloop(False) # start shutdown handling
+
        def dispatchEvent(self, i):
                for x in self.event:
                        x(i)