From: ghost Date: Tue, 2 Dec 2008 14:16:49 +0000 (+0100) Subject: add new after record timer event behavior "auto".. and use it as default X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=a9f7393e1d00eb89b8282aae0ddc4f6da33d9ca1 add new after record timer event behavior "auto".. and use it as default --- diff --git a/Navigation.py b/Navigation.py index 42733cb..715e886 100644 --- a/Navigation.py +++ b/Navigation.py @@ -11,7 +11,7 @@ import ServiceReference # TODO: remove pNavgation, eNavigation and rewrite this stuff in python. class Navigation: - def __init__(self): + def __init__(self, nextRecordTimerAfterEventActionAuto=False): if NavigationInstance.instance is not None: raise NavigationInstance.instance @@ -33,7 +33,7 @@ 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 len(self.getRecordings()) or abs(self.RecordTimer.getNextRecordingTime() - time()) <= 360: + 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 self.SleepTimer = SleepTimer.SleepTimer() diff --git a/RecordTimer.py b/RecordTimer.py index 28b878a..cac475d 100644 --- a/RecordTimer.py +++ b/RecordTimer.py @@ -47,6 +47,7 @@ class AFTEREVENT: NONE = 0 STANDBY = 1 DEEPSTANDBY = 2 + AUTO = 3 # please do not translate log messages class RecordTimerEntry(timer.TimerEntry, object): @@ -91,7 +92,7 @@ class RecordTimerEntry(timer.TimerEntry, object): 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.NONE, checkOldTimers = False, dirname = None, tags = None): + def __init__(self, serviceref, begin, end, name, description, eit, disabled = False, justplay = False, afterEvent = AFTEREVENT.AUTO, checkOldTimers = False, dirname = None, tags = None): timer.TimerEntry.__init__(self, int(begin), int(end)) if checkOldTimers == True: @@ -361,7 +362,12 @@ def createTimer(xml): disabled = long(xml.getAttribute("disabled") or "0") justplay = long(xml.getAttribute("justplay") or "0") afterevent = str(xml.getAttribute("afterevent") or "nothing") - afterevent = { "nothing": AFTEREVENT.NONE, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY }[afterevent] + afterevent = { + "nothing": AFTEREVENT.NONE, + "standby": AFTEREVENT.STANDBY, + "deepstandby": AFTEREVENT.DEEPSTANDBY, + "auto": AFTEREVENT.AUTO + }[afterevent] if xml.hasAttribute("eit") and xml.getAttribute("eit") != "None": eit = long(xml.getAttribute("eit")) else: @@ -493,7 +499,12 @@ class RecordTimer(timer.Timer): list.append(' repeated="' + str(int(timer.repeated)) + '"') list.append(' name="' + str(stringToXML(timer.name)) + '"') list.append(' description="' + str(stringToXML(timer.description)) + '"') - list.append(' afterevent="' + str(stringToXML({ AFTEREVENT.NONE: "nothing", AFTEREVENT.STANDBY: "standby", AFTEREVENT.DEEPSTANDBY: "deepstandby" }[timer.afterEvent])) + '"') + list.append(' afterevent="' + str(stringToXML({ + AFTEREVENT.NONE: "nothing", + AFTEREVENT.STANDBY: "standby", + AFTEREVENT.DEEPSTANDBY: "deepstandby", + AFTEREVENT.AUTO: "auto" + }[timer.afterEvent])) + '"') if timer.eit is not None: list.append(' eit="' + str(timer.eit) + '"') if timer.dirname is not None: @@ -538,6 +549,18 @@ class RecordTimer(timer.Timer): return timer.begin return -1 + def isNextRecordAfterEventActionAuto(self): + now = time.time() + t = None + for timer in self.timer_list: + if timer.justplay or timer.begin < now: + continue + if t is None or t.begin == timer.begin: + t = timer + if t.afterEvent == AFTEREVENT.AUTO: + return True + return False + def record(self, entry, ignoreTSC=False, dosave=True): #wird von loadTimer mit dosave=False aufgerufen timersanitycheck = TimerSanityCheck(self.timer_list,entry) if not timersanitycheck.check(): diff --git a/lib/python/Screens/TimerEntry.py b/lib/python/Screens/TimerEntry.py index 1774061..be8b524 100644 --- a/lib/python/Screens/TimerEntry.py +++ b/lib/python/Screens/TimerEntry.py @@ -46,7 +46,12 @@ class TimerEntry(Screen, ConfigListScreen): def createConfig(self): justplay = self.timer.justplay - afterevent = { AFTEREVENT.NONE: "nothing", AFTEREVENT.DEEPSTANDBY: "deepstandby", AFTEREVENT.STANDBY: "standby"}[self.timer.afterEvent] + afterevent = { + AFTEREVENT.NONE: "nothing", + AFTEREVENT.DEEPSTANDBY: "deepstandby", + AFTEREVENT.STANDBY: "standby", + AFTEREVENT.AUTO: "auto" + }[self.timer.afterEvent] weekday_table = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] @@ -84,7 +89,7 @@ class TimerEntry(Screen, ConfigListScreen): day[weekday] = 1 self.timerentry_justplay = ConfigSelection(choices = [("zap", _("zap")), ("record", _("record"))], default = {0: "record", 1: "zap"}[justplay]) - self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby"))], default = afterevent) + self.timerentry_afterevent = ConfigSelection(choices = [("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", _("go to deep standby")), ("auto", _("auto"))], default = afterevent) self.timerentry_type = ConfigSelection(choices = [("once",_("once")), ("repeated", _("repeated"))], default = type) self.timerentry_name = ConfigText(default = self.timer.name, visible_width = 50, fixed_size = False) self.timerentry_description = ConfigText(default = self.timer.description, visible_width = 50, fixed_size = False) @@ -250,7 +255,12 @@ class TimerEntry(Screen, ConfigListScreen): self.timer.description = self.timerentry_description.value self.timer.justplay = self.timerentry_justplay.value == "zap" self.timer.resetRepeated() - self.timer.afterEvent = {"nothing": AFTEREVENT.NONE, "deepstandby": AFTEREVENT.DEEPSTANDBY, "standby": AFTEREVENT.STANDBY}[self.timerentry_afterevent.value] + self.timer.afterEvent = { + "nothing": AFTEREVENT.NONE, + "deepstandby": AFTEREVENT.DEEPSTANDBY, + "standby": AFTEREVENT.STANDBY, + "auto": AFTEREVENT.AUTO + }[self.timerentry_afterevent.value] self.timer.service_ref = self.timerentry_service_ref self.timer.tags = self.timerentry_tags