+class RecordTimerEntry(timer.TimerEntry, object):
+######### the following static methods and members are only in use when the box is in (soft) standby
+ receiveRecordEvents = False
+
+ @staticmethod
+ def shutdown():
+ quitMainloop(1)
+
+ @staticmethod
+ def staticGotRecordEvent(recservice, event):
+ if event == iRecordableService.evEnd:
+ print "RecordTimer.staticGotRecordEvent(iRecordableService.evEnd)"
+ recordings = NavigationInstance.instance.getRecordings()
+ if not recordings: # no more recordings exist
+ rec_time = NavigationInstance.instance.RecordTimer.getNextRecordingTime()
+ if rec_time > 0 and (rec_time - time.time()) < 360:
+ print "another recording starts in", rec_time - time.time(), "seconds... do not shutdown yet"
+ else:
+ print "no starting records in the next 360 seconds... immediate shutdown"
+ RecordTimerEntry.shutdown() # immediate shutdown
+ elif event == iRecordableService.evStart:
+ print "RecordTimer.staticGotRecordEvent(iRecordableService.evStart)"
+
+ @staticmethod
+ def stopTryQuitMainloop():
+ print "RecordTimer.stopTryQuitMainloop"
+ NavigationInstance.instance.record_event.remove(RecordTimerEntry.staticGotRecordEvent)
+ RecordTimerEntry.receiveRecordEvents = False
+
+ @staticmethod
+ def TryQuitMainloop(default_yes = True):
+ if not RecordTimerEntry.receiveRecordEvents:
+ print "RecordTimer.TryQuitMainloop"
+ NavigationInstance.instance.record_event.append(RecordTimerEntry.staticGotRecordEvent)
+ RecordTimerEntry.receiveRecordEvents = True
+ # send fake event.. to check if another recordings are running or
+ # other timers start in a few seconds
+ RecordTimerEntry.staticGotRecordEvent(None, iRecordableService.evEnd)
+ # send normal notification for the case the user leave the standby now..
+ Notifications.AddNotification(Screens.Standby.TryQuitMainloop, 1, onSessionOpenCallback=RecordTimerEntry.stopTryQuitMainloop, default_yes = default_yes)
+#################################################################
+
+ def __init__(self, serviceref, begin, end, name, description, eit, disabled = False, justplay = False, afterEvent = AFTEREVENT.AUTO, checkOldTimers = False, dirname = None, tags = None):