我们从Python开源项目中,提取了以下30个代码示例,用于说明如何使用timer.disabled()。
def __repr__(self): timertype = { TIMERTYPE.NONE: "nothing", TIMERTYPE.WAKEUP: "wakeup", TIMERTYPE.WAKEUPTOSTANDBY: "wakeuptostandby", TIMERTYPE.AUTOSTANDBY: "autostandby", TIMERTYPE.AUTODEEPSTANDBY: "autodeepstandby", TIMERTYPE.STANDBY: "standby", TIMERTYPE.DEEPSTANDBY: "deepstandby", TIMERTYPE.REBOOT: "reboot", TIMERTYPE.RESTART: "restart" }[self.timerType] if not self.disabled: return "PowerTimerEntry(type=%s, begin=%s)" % (timertype, ctime(self.begin)) else: return "PowerTimerEntry(type=%s, begin=%s Disabled)" % (timertype, ctime(self.begin))
def setAutoincreaseEnd(self, entry = None): if not self.autoincrease: return False if entry is None: new_end = int(time()) + self.autoincreasetime else: new_end = entry.begin - 30 dummyentry = PowerTimerEntry(self.begin, new_end, disabled=True, afterEvent = self.afterEvent, timerType = self.timerType) dummyentry.disabled = self.disabled timersanitycheck = TimerSanityCheck(NavigationInstance.instance.PowerManager.timer_list, dummyentry) if not timersanitycheck.check(): simulTimerList = timersanitycheck.getSimulTimerList() if simulTimerList is not None and len(simulTimerList) > 1: new_end = simulTimerList[1].begin new_end -= 30 # 30 Sekunden Prepare-Zeit lassen if new_end <= time(): return False self.end = new_end return True
def setAutoincreaseEnd(self, entry = None): if not self.autoincrease: return False if entry is None: new_end = int(time()) + self.autoincreasetime else: new_end = entry.begin - 30 dummyentry = RecordTimerEntry(self.service_ref, self.begin, new_end, self.name, self.description, self.eit, disabled=True, justplay = self.justplay, afterEvent = self.afterEvent, dirname = self.dirname, tags = self.tags) dummyentry.disabled = self.disabled timersanitycheck = TimerSanityCheck(NavigationInstance.instance.RecordTimer.timer_list, dummyentry) if not timersanitycheck.check(): simulTimerList = timersanitycheck.getSimulTimerList() if simulTimerList is not None and len(simulTimerList) > 1: new_end = simulTimerList[1].begin new_end -= 30 # 30 Sekunden Prepare-Zeit lassen if new_end <= time(): return False self.end = new_end return True
def __init__(self, begin, end, disabled = False, afterEvent = AFTEREVENT.NONE, timerType = TIMERTYPE.WAKEUP, checkOldTimers = False): timer.TimerEntry.__init__(self, int(begin), int(end)) if checkOldTimers: if self.begin < time() - 1209600: self.begin = int(time()) if self.end < self.begin: self.end = self.begin self.dontSave = False self.disabled = disabled self.timer = None self.__record_service = None self.start_prepare = 0 self.timerType = timerType self.afterEvent = afterEvent self.autoincrease = False self.autoincreasetime = 3600 * 24 # 1 day self.autosleepinstandbyonly = 'no' self.autosleepdelay = 60 self.autosleeprepeat = 'once' self.log_entries = [] self.resetState()
def setAutoincreaseEnd(self, entry = None): if not self.autoincrease: return False if entry is None: new_end = int(time()) + self.autoincreasetime else: new_end = entry.begin -30 dummyentry = PowerTimerEntry(self.begin, new_end, disabled=True, afterEvent = self.afterEvent, timerType = self.timerType) dummyentry.disabled = self.disabled timersanitycheck = TimerSanityCheck(NavigationInstance.instance.PowerManager.timer_list, dummyentry) if not timersanitycheck.check(): simulTimerList = timersanitycheck.getSimulTimerList() if simulTimerList is not None and len(simulTimerList) > 1: new_end = simulTimerList[1].begin new_end -= 30 # 30 Sekunden Prepare-Zeit lassen if new_end <= time(): return False self.end = new_end return True
def __init__(self, begin, end, disabled = False, afterEvent = AFTEREVENT.NONE, timerType = TIMERTYPE.WAKEUP, checkOldTimers = False, autosleepdelay = 60): timer.TimerEntry.__init__(self, int(begin), int(end)) if checkOldTimers: if self.begin < time() - 1209600: self.begin = int(time()) if self.end < self.begin: self.end = self.begin self.dontSave = False self.disabled = disabled self.timer = None self.__record_service = None self.start_prepare = 0 self.timerType = timerType self.afterEvent = afterEvent self.autoincrease = False self.autoincreasetime = 3600 * 24 # 1 day self.autosleepinstandbyonly = 'no' self.autosleepdelay = autosleepdelay self.autosleeprepeat = 'once' self.autosleepwindow = 'no' self.autosleepbegin = self.begin self.autosleepend = self.end self.nettraffic = 'no' self.trafficlimit = 100 self.netip = 'no' self.ipadress = "0.0.0.0" self.log_entries = [] self.resetState() self.messageBoxAnswerPending = False #check autopowertimer if (self.timerType == TIMERTYPE.AUTOSTANDBY or self.timerType == TIMERTYPE.AUTODEEPSTANDBY) and not self.disabled and time() > 3600 and self.begin > time(): self.begin = int(time()) #the begin is in the future -> set to current time = no start delay of this timer
def __repr__(self): if not self.disabled: return "RecordTimerEntry(name=%s, begin=%s, serviceref=%s, justplay=%s, isAutoTimer=%s)" % (self.name, ctime(self.begin), self.service_ref, self.justplay, self.isAutoTimer) else: return "RecordTimerEntry(name=%s, begin=%s, serviceref=%s, justplay=%s, isAutoTimer=%s, Disabled)" % (self.name, ctime(self.begin), self.service_ref, self.justplay, self.isAutoTimer)
def doActivate(self, w): # when activating a timer which has already passed, # simply abort the timer. don't run through all the stages. if w.shouldSkip(): w.state = RecordTimerEntry.StateEnded else: # when active returns true, this means "accepted". # otherwise, the current state is kept. # the timer entry itself will fix up the delay then. if w.activate(): w.state += 1 try: self.timer_list.remove(w) except: print '[RecordTimer]: Remove list failed' # did this timer reach the last state? if w.state < RecordTimerEntry.StateEnded: # no, sort it into active list insort(self.timer_list, w) else: # yes. Process repeated, and re-add. if w.repeated: w.processRepeated() w.state = RecordTimerEntry.StateWaiting w.first_try_prepare = 0 # changed from a bool to a counter, not renamed for compatibility with openWebif w.messageBoxAnswerPending = False w.justTriedFreeingTuner = False w.messageString = "" # incremental MessageBox string w.messageStringShow = False self.addTimerEntry(w) else: # correct wrong running timers self.checkWrongRunningTimers() # check for disabled timers, if time as passed set to completed self.cleanupDisabled() # remove old timers as set in config self.cleanupDaily(config.recording.keep_timers.value) insort(self.processed_timers, w) self.stateChanged(w)
def loadTimer(self): if not Directories.fileExists(self.Filename): return try: file = open(self.Filename, 'r') doc = xml.etree.cElementTree.parse(file) file.close() except SyntaxError: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("The timer file (timers.xml) is corrupt and could not be loaded."), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed") print "timers.xml failed to load!" try: os.rename(self.Filename, self.Filename + "_old") except (IOError, OSError): print "renaming broken timer failed" return except IOError: print "timers.xml not found!" return root = doc.getroot() checkit = False timer_text = "" for timer in root.findall("timer"): newTimer = createTimer(timer) conflict_list = self.record(newTimer, ignoreTSC=True, dosave=False, loadtimer=True) if conflict_list: checkit = True if newTimer in conflict_list: timer_text += _("\nTimer '%s' disabled!") % newTimer.name if checkit: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("Timer overlap in timers.xml detected!\nPlease recheck it!") + timer_text, type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed")
def record(self, entry, ignoreTSC=False, dosave=True, loadtimer=False): check_timer_list = self.timer_list[:] timersanitycheck = TimerSanityCheck(check_timer_list,entry) answer = None if not timersanitycheck.check(): if not ignoreTSC: print "[RecordTimer] timer conflict detected!" #print timersanitycheck.getSimulTimerList() return timersanitycheck.getSimulTimerList() else: print "[RecordTimer] ignore timer conflict..." if not dosave and loadtimer: simulTimerList = timersanitycheck.getSimulTimerList() if entry in simulTimerList: entry.disabled = True if entry in check_timer_list: check_timer_list.remove(entry) answer = simulTimerList elif timersanitycheck.doubleCheck(): print "[RecordTimer] ignore double timer..." return None entry.timeChanged() print "[RecordTimer] Record " + str(entry) entry.Timer = self self.addTimerEntry(entry) if dosave: self.saveTimer() return answer
def doActivate(self, w): # when activating a timer which has already passed, # simply abort the timer. don't run trough all the stages. if w.shouldSkip(): w.state = RecordTimerEntry.StateEnded else: # when active returns true, this means "accepted". # otherwise, the current state is kept. # the timer entry itself will fix up the delay then. if w.activate(): w.state += 1 self.timer_list.remove(w) # did this timer reached the last state? if w.state < RecordTimerEntry.StateEnded: # no, sort it into active list insort(self.timer_list, w) else: # yes. Process repeated, and re-add. if w.repeated: w.processRepeated() w.state = RecordTimerEntry.StateWaiting w.first_try_prepare = True self.addTimerEntry(w) else: # correct wrong running timers self.checkWrongRunningTimers() # check for disabled timers, if time as passed set to completed self.cleanupDisabled() # Remove old timers as set in config self.cleanupDaily(config.recording.keep_timers.value) # If we want to keep done timers, re-insert in the active list if config.recording.keep_timers.value > 0 and w not in self.processed_timers: insort(self.processed_timers, w) self.stateChanged(w)
def loadTimer(self): if not Directories.fileExists(self.Filename): return try: doc = xml.etree.cElementTree.parse(self.Filename) except SyntaxError: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("The timer file (timers.xml) is corrupt and could not be loaded."), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed") print "timers.xml failed to load!" try: import os os.rename(self.Filename, self.Filename + "_old") except (IOError, OSError): print "renaming broken timer failed" return except IOError: print "timers.xml not found!" return root = doc.getroot() checkit = False timer_text = "" for timer in root.findall("timer"): newTimer = createTimer(timer) conflict_list = self.record(newTimer, ignoreTSC=True, dosave=False, loadtimer=True) if conflict_list: checkit = True if newTimer in conflict_list: timer_text += _("\nTimer '%s' disabled!") % newTimer.name if checkit: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("Timer overlap in timers.xml detected!\nPlease recheck it!") + timer_text, type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed")
def __repr__(self): timertype = { TIMERTYPE.WAKEUP: "wakeup", TIMERTYPE.WAKEUPTOSTANDBY: "wakeuptostandby", TIMERTYPE.AUTOSTANDBY: "autostandby", TIMERTYPE.AUTODEEPSTANDBY: "autodeepstandby", TIMERTYPE.STANDBY: "standby", TIMERTYPE.DEEPSTANDBY: "deepstandby", TIMERTYPE.REBOOT: "reboot", TIMERTYPE.RESTART: "restart" }[self.timerType] if not self.disabled: return "PowerTimerEntry(type=%s, begin=%s)" % (timertype, ctime(self.begin)) else: return "PowerTimerEntry(type=%s, begin=%s Disabled)" % (timertype, ctime(self.begin))
def createTimer(xml): timertype = str(xml.get("timertype") or "wakeup") timertype = { "wakeup": TIMERTYPE.WAKEUP, "wakeuptostandby": TIMERTYPE.WAKEUPTOSTANDBY, "autostandby": TIMERTYPE.AUTOSTANDBY, "autodeepstandby": TIMERTYPE.AUTODEEPSTANDBY, "standby": TIMERTYPE.STANDBY, "deepstandby": TIMERTYPE.DEEPSTANDBY, "reboot": TIMERTYPE.REBOOT, "restart": TIMERTYPE.RESTART }[timertype] begin = int(xml.get("begin")) end = int(xml.get("end")) repeated = xml.get("repeated").encode("utf-8") disabled = long(xml.get("disabled") or "0") afterevent = str(xml.get("afterevent") or "nothing") afterevent = { "nothing": AFTEREVENT.NONE, "wakeuptostandby": AFTEREVENT.WAKEUPTOSTANDBY, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY }[afterevent] autosleepinstandbyonly = str(xml.get("autosleepinstandbyonly") or "no") autosleepdelay = str(xml.get("autosleepdelay") or "0") autosleeprepeat = str(xml.get("autosleeprepeat") or "once") entry = PowerTimerEntry(begin, end, disabled, afterevent, timertype) entry.repeated = int(repeated) entry.autosleepinstandbyonly = autosleepinstandbyonly entry.autosleepdelay = int(autosleepdelay) entry.autosleeprepeat = autosleeprepeat for l in xml.findall("log"): time = int(l.get("time")) code = int(l.get("code")) msg = l.text.strip().encode("utf-8") entry.log_entries.append((time, code, msg)) return entry
def doActivate(self, w): # when activating a timer which has already passed, # simply abort the timer. don't run trough all the stages. if w.shouldSkip(): w.state = RecordTimerEntry.StateEnded else: # when active returns true, this means "accepted". # otherwise, the current state is kept. # the timer entry itself will fix up the delay then. if w.activate(): w.state += 1 try: self.timer_list.remove(w) except: print '[RecordTimer] Remove list failed' # did this timer reached the last state? if w.state < RecordTimerEntry.StateEnded: # no, sort it into active list insort(self.timer_list, w) else: # yes. Process repeated, and re-add. if w.repeated: w.processRepeated() w.state = RecordTimerEntry.StateWaiting w.first_try_prepare = True self.addTimerEntry(w) else: # correct wrong running timers self.checkWrongRunningTimers() # check for disabled timers, if time as passed set to completed self.cleanupDisabled() # Remove old timers as set in config self.cleanupDaily(config.recording.keep_timers.value) # If we want to keep done timers, re-insert in the active list if config.recording.keep_timers.value > 0: insort(self.processed_timers, w) self.stateChanged(w)
def loadTimer(self): try: file = open(self.Filename, 'r') doc = xml.etree.cElementTree.parse(file) file.close() except SyntaxError: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("The timer file (timers.xml) is corrupt and could not be loaded."), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed") print "[RecordTimer] timers.xml failed to load!" try: os.rename(self.Filename, self.Filename + "_old") except (IOError, OSError): print "[RecordTimer] renaming broken timer failed" return except IOError: print "[RecordTimer] timers.xml not found!" return root = doc.getroot() # put out a message when at least one timer overlaps checkit = False timer_text = "" for timer in root.findall("timer"): newTimer = createTimer(timer) conflict_list = self.record(newTimer, ignoreTSC=True, dosave=False, loadtimer=True) if conflict_list: checkit = True if newTimer in conflict_list: timer_text += _("\nTimer '%s' disabled!") % newTimer.name if checkit: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("Timer overlap in timers.xml detected!\nPlease recheck it!") + timer_text, type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed")
def record(self, entry, ignoreTSC=False, dosave=True, loadtimer=False): check_timer_list = self.timer_list[:] timersanitycheck = TimerSanityCheck(check_timer_list,entry) answer = None if not timersanitycheck.check(): if not ignoreTSC: print "[RecordTimer] timer conflict detected!" print timersanitycheck.getSimulTimerList() return timersanitycheck.getSimulTimerList() else: print "[RecordTimer] ignore timer conflict..." if not dosave and loadtimer: simulTimerList = timersanitycheck.getSimulTimerList() if entry in simulTimerList: entry.disabled = True if entry in check_timer_list: check_timer_list.remove(entry) answer = simulTimerList elif timersanitycheck.doubleCheck(): print "[RecordTimer] ignore double timer..." return None entry.timeChanged() print "[Timer] Record " + str(entry) entry.Timer = self self.addTimerEntry(entry) if dosave: self.saveTimer() return answer
def downloadList(self): if config.plugins.tvcharts.enabled.value: self["info"].setText("Downloading feeds from server ...") getPage(self.feedurl).addCallback(self.downloadListCallback).addErrback(self.downloadListError) else: self["info"].setText("Error: Plugin disabled in Settings ...")
def loadTimer(self): try: doc = xml.etree.cElementTree.parse(self.Filename) except SyntaxError: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("The timer file (timers.xml) is corrupt and could not be loaded."), type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed") print "timers.xml failed to load!" try: import os os.rename(self.Filename, self.Filename + "_old") except (IOError, OSError): print "renaming broken timer failed" return except IOError: print "timers.xml not found!" return root = doc.getroot() checkit = False timer_text = "" for timer in root.findall("timer"): newTimer = createTimer(timer) conflict_list = self.record(newTimer, ignoreTSC=True, dosave=False, loadtimer=True) if conflict_list: checkit = True if newTimer in conflict_list: timer_text += _("\nTimer '%s' disabled!") % newTimer.name if checkit: from Tools.Notifications import AddPopup from Screens.MessageBox import MessageBox AddPopup(_("Timer overlap in timers.xml detected!\nPlease recheck it!") + timer_text, type = MessageBox.TYPE_ERROR, timeout = 0, id = "TimerLoadFailed")
def createTimer(xml): timertype = str(xml.get("timertype") or "wakeup") timertype = { "nothing": TIMERTYPE.NONE, "wakeup": TIMERTYPE.WAKEUP, "wakeuptostandby": TIMERTYPE.WAKEUPTOSTANDBY, "autostandby": TIMERTYPE.AUTOSTANDBY, "autodeepstandby": TIMERTYPE.AUTODEEPSTANDBY, "standby": TIMERTYPE.STANDBY, "deepstandby": TIMERTYPE.DEEPSTANDBY, "reboot": TIMERTYPE.REBOOT, "restart": TIMERTYPE.RESTART }[timertype] begin = int(xml.get("begin")) end = int(xml.get("end")) repeated = xml.get("repeated").encode("utf-8") disabled = long(xml.get("disabled") or "0") afterevent = str(xml.get("afterevent") or "nothing") afterevent = { "nothing": AFTEREVENT.NONE, "wakeup": AFTEREVENT.WAKEUP, "wakeuptostandby": AFTEREVENT.WAKEUPTOSTANDBY, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY }[afterevent] autosleepinstandbyonly = str(xml.get("autosleepinstandbyonly") or "no") autosleepdelay = str(xml.get("autosleepdelay") or "0") autosleeprepeat = str(xml.get("autosleeprepeat") or "once") autosleepwindow = str(xml.get("autosleepwindow") or "no") autosleepbegin = int(xml.get("autosleepbegin") or begin) autosleepend = int(xml.get("autosleepend") or end) nettraffic = str(xml.get("nettraffic") or "no") trafficlimit = int(xml.get("trafficlimit") or 100) netip = str(xml.get("netip") or "no") ipadress = str(xml.get("ipadress") or "0.0.0.0") entry = PowerTimerEntry(begin, end, disabled, afterevent, timertype) entry.repeated = int(repeated) entry.autosleepinstandbyonly = autosleepinstandbyonly entry.autosleepdelay = int(autosleepdelay) entry.autosleeprepeat = autosleeprepeat entry.autosleepwindow = autosleepwindow entry.autosleepbegin = autosleepbegin entry.autosleepend = autosleepend entry.nettraffic = nettraffic entry.trafficlimit = trafficlimit entry.netip = netip entry.ipadress = ipadress for l in xml.findall("log"): ltime = int(l.get("time")) code = int(l.get("code")) msg = l.text.strip().encode("utf-8") entry.log_entries.append((ltime, code, msg)) return entry
def createTimer(xml): begin = int(xml.get("begin")) end = int(xml.get("end")) serviceref = ServiceReference(xml.get("serviceref").encode("utf-8")) description = xml.get("description").encode("utf-8") repeated = xml.get("repeated").encode("utf-8") rename_repeat = long(xml.get("rename_repeat") or "0") disabled = long(xml.get("disabled") or "0") justplay = long(xml.get("justplay") or "0") always_zap = long(xml.get("always_zap") or "0") conflict_detection = long(xml.get("conflict_detection") or "1") afterevent = str(xml.get("afterevent") or "nothing") afterevent = { "nothing": AFTEREVENT.NONE, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY, "auto": AFTEREVENT.AUTO }[afterevent] eit = xml.get("eit") if eit and eit != "None": eit = long(eit) else: eit = None location = xml.get("location") if location and location != "None": location = location.encode("utf-8") else: location = None tags = xml.get("tags") if tags and tags != "None": tags = tags.encode("utf-8").split(' ') else: tags = None descramble = int(xml.get("descramble") or "1") record_ecm = int(xml.get("record_ecm") or "0") isAutoTimer = int(xml.get("isAutoTimer") or "0") name = xml.get("name").encode("utf-8") #filename = xml.get("filename").encode("utf-8") entry = RecordTimerEntry(serviceref, begin, end, name, description, eit, disabled, justplay, afterevent, dirname = location, tags = tags, descramble = descramble, record_ecm = record_ecm, conflict_detection = conflict_detection, isAutoTimer = isAutoTimer, always_zap = always_zap, rename_repeat = rename_repeat) entry.repeated = int(repeated) flags = xml.get("flags") if flags: entry.flags = set(flags.encode("utf-8").split(' ')) for l in xml.findall("log"): time = int(l.get("time")) code = int(l.get("code")) msg = l.text.strip().encode("utf-8") entry.log_entries.append((time, code, msg)) return entry
def openChoiceActionBeforeZap(self): if self.ts_dialog is None: type = _("record") if self.justplay: type = _("zap") elif self.always_zap: type = _("zap and record") message = _("You must switch to the service %s (%s - '%s')!\n") % (type, self.service_ref.getServiceName(), self.name) if self.repeated: message += _("Attention, this is repeated timer!\n") message += _("Timeshift is running. Select an action.\n") choice = [(_("Zap"), "zap"), (_("Don't zap and disable timer"), "disable"), (_("Don't zap and remove timer"), "remove")] if not self.InfoBarInstance.save_timeshift_file: choice.insert(1, (_("Save timeshift in movie dir and zap"), "save_movie")) if self.InfoBarInstance.timeshiftActivated(): choice.insert(0, (_("Save timeshift and zap"), "save")) else: choice.insert(1, (_("Save timeshift and zap"), "save")) else: message += _("Reminder, you have chosen to save timeshift file.") #if self.justplay or self.always_zap: # choice.insert(2, (_("Don't zap"), "continue")) choice.insert(2, (_("Don't zap"), "continue")) def zapAction(choice): start_zap = True if choice: if choice in ("zap", "save", "save_movie"): self.log(8, "zap to recording service") if choice in ("save", "save_movie"): ts = self.InfoBarInstance.getTimeshift() if ts and ts.isTimeshiftEnabled(): if choice =="save_movie": self.InfoBarInstance.save_timeshift_in_movie_dir = True self.InfoBarInstance.save_timeshift_file = True ts.saveTimeshiftFile() del ts self.InfoBarInstance.saveTimeshiftFiles() elif choice == "disable": self.disable() NavigationInstance.instance.RecordTimer.timeChanged(self) start_zap = False self.log(8, "zap canceled by the user, timer disabled") elif choice == "remove": start_zap = False self.afterEvent = AFTEREVENT.NONE NavigationInstance.instance.RecordTimer.removeEntry(self) self.log(8, "zap canceled by the user, timer removed") elif choice == "continue": if self.justplay: self.end = self.begin start_zap = False self.log(8, "zap canceled by the user") if start_zap: if not self.justplay: self.setRecordingPreferredTuner() self.failureCB(True) else: self.log(8, "zapping") NavigationInstance.instance.playService(self.service_ref.ref) self.ts_dialog = self.InfoBarInstance.session.openWithCallback(zapAction, MessageBox, message, simple=True, list=choice, timeout=20)
def createTimer(xml): begin = int(xml.get("begin")) end = int(xml.get("end")) serviceref = ServiceReference(xml.get("serviceref").encode("utf-8")) description = xml.get("description").encode("utf-8") repeated = xml.get("repeated").encode("utf-8") rename_repeat = long(xml.get("rename_repeat") or "1") disabled = long(xml.get("disabled") or "0") justplay = long(xml.get("justplay") or "0") always_zap = long(xml.get("always_zap") or "0") zap_wakeup = str(xml.get("zap_wakeup") or "always") conflict_detection = long(xml.get("conflict_detection") or "1") afterevent = str(xml.get("afterevent") or "nothing") afterevent = { "nothing": AFTEREVENT.NONE, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY, "auto": AFTEREVENT.AUTO }[afterevent] eit = xml.get("eit") if eit and eit != "None": eit = long(eit) else: eit = None location = xml.get("location") if location and location != "None": location = location.encode("utf-8") else: location = None tags = xml.get("tags") if tags and tags != "None": tags = tags.encode("utf-8").split(' ') else: tags = None descramble = int(xml.get("descramble") or "1") record_ecm = int(xml.get("record_ecm") or "0") isAutoTimer = int(xml.get("isAutoTimer") or "0") name = xml.get("name").encode("utf-8") #filename = xml.get("filename").encode("utf-8") entry = RecordTimerEntry(serviceref, begin, end, name, description, eit, disabled, justplay, afterevent, dirname = location, tags = tags, descramble = descramble, record_ecm = record_ecm, isAutoTimer = isAutoTimer, always_zap = always_zap, zap_wakeup = zap_wakeup, rename_repeat = rename_repeat, conflict_detection = conflict_detection) entry.repeated = int(repeated) flags = xml.get("flags") if flags: entry.flags = set(flags.encode("utf-8").split(' ')) for l in xml.findall("log"): time = int(l.get("time")) code = int(l.get("code")) msg = l.text.strip().encode("utf-8") entry.log_entries.append((time, code, msg)) return entry
def openChoiceActionBeforeZap(self): if self.ts_dialog is None: type = _("record") if self.justplay: type = _("zap") elif self.always_zap: type = _("zap and record") message = _("You must switch to the service %s (%s - '%s')!\n") % (type, self.service_ref.getServiceName(), self.name) if self.repeated: message += _("Attention, this is repeated timer!\n") message += _("Timeshift is running. Select an action.\n") choice = [(_("Zap"), "zap"), (_("Don't zap and disable timer"), "disable"), (_("Don't zap and remove timer"), "remove")] if not self.InfoBarInstance.save_timeshift_file: choice.insert(0, (_("Save timeshift and zap"), "save")) else: message += _("Reminder, you have chosen to save timeshift file.") #if self.justplay or self.always_zap: # choice.insert(2, (_("Don't zap"), "continue")) choice.insert(2, (_("Don't zap"), "continue")) def zapAction(choice): start_zap = True if choice: if choice in ("zap", "save"): self.log(8, "zap to recording service") if choice == "save": ts = self.InfoBarInstance.getTimeshift() if ts and ts.isTimeshiftEnabled(): del ts self.InfoBarInstance.save_timeshift_file = True self.InfoBarInstance.SaveTimeshift() elif choice == "disable": self.disable() NavigationInstance.instance.RecordTimer.timeChanged(self) start_zap = False self.log(8, "zap canceled by the user, timer disabled") elif choice == "remove": start_zap = False self.afterEvent = AFTEREVENT.NONE NavigationInstance.instance.RecordTimer.removeEntry(self) self.log(8, "zap canceled by the user, timer removed") elif choice == "continue": if self.justplay: self.end = self.begin start_zap = False self.log(8, "zap canceled by the user") if start_zap: if not self.justplay: self.setRecordingPreferredTuner() self.failureCB(True) else: self.log(8, "zapping") NavigationInstance.instance.playService(self.service_ref.ref) self.ts_dialog = self.InfoBarInstance.session.openWithCallback(zapAction, MessageBox, message, simple=True, list=choice, timeout=20)
def createTimer(xml): begin = int(xml.get("begin")) end = int(xml.get("end")) serviceref = ServiceReference(xml.get("serviceref").encode("utf-8")) description = xml.get("description").encode("utf-8") repeated = xml.get("repeated").encode("utf-8") rename_repeat = long(xml.get("rename_repeat") or "1") disabled = long(xml.get("disabled") or "0") justplay = long(xml.get("justplay") or "0") always_zap = long(xml.get("always_zap") or "0") pipzap = long(xml.get("pipzap") or "0") conflict_detection = long(xml.get("conflict_detection") or "1") afterevent = str(xml.get("afterevent") or "nothing") afterevent = { "nothing": AFTEREVENT.NONE, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY, "auto": AFTEREVENT.AUTO }[afterevent] eit = xml.get("eit") if eit and eit != "None": eit = long(eit) else: eit = None location = xml.get("location") if location and location != "None": location = location.encode("utf-8") else: location = None tags = xml.get("tags") if tags and tags != "None": tags = tags.encode("utf-8").split(' ') else: tags = None descramble = int(xml.get("descramble") or "1") record_ecm = int(xml.get("record_ecm") or "0") isAutoTimer = int(xml.get("isAutoTimer") or "0") name = xml.get("name").encode("utf-8") #filename = xml.get("filename").encode("utf-8") entry = RecordTimerEntry(serviceref, begin, end, name, description, eit, disabled, justplay, afterevent, dirname = location, tags = tags, descramble = descramble, record_ecm = record_ecm, isAutoTimer = isAutoTimer, always_zap = always_zap, rename_repeat = rename_repeat, conflict_detection = conflict_detection, pipzap = pipzap) entry.repeated = int(repeated) flags = xml.get("flags") if flags: entry.flags = set(flags.encode("utf-8").split(' ')) for l in xml.findall("log"): time = int(l.get("time")) code = int(l.get("code")) msg = l.text.strip().encode("utf-8") entry.log_entries.append((time, code, msg)) return entry
def createTimer(xml): begin = int(xml.get("begin")) end = int(xml.get("end")) serviceref = ServiceReference(xml.get("serviceref").encode("utf-8")) description = xml.get("description").encode("utf-8") repeated = xml.get("repeated").encode("utf-8") rename_repeat = long(xml.get("rename_repeat") or "1") disabled = long(xml.get("disabled") or "0") justplay = long(xml.get("justplay") or "0") always_zap = long(xml.get("always_zap") or "0") zap_wakeup = str(xml.get("zap_wakeup") or "always") conflict_detection = long(xml.get("conflict_detection") or "1") afterevent = str(xml.get("afterevent") or "nothing") afterevent = { "nothing": AFTEREVENT.NONE, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY, "auto": AFTEREVENT.AUTO }[afterevent] eit = xml.get("eit") if eit and eit != "None": eit = long(eit) else: eit = None location = xml.get("location") if location and location != "None": location = location.encode("utf-8") else: location = None tags = xml.get("tags") if tags and tags != "None": tags = tags.encode("utf-8").split(' ') else: tags = None descramble = int(xml.get("descramble") or "1") record_ecm = int(xml.get("record_ecm") or "0") name = xml.get("name").encode("utf-8") #filename = xml.get("filename").encode("utf-8") entry = RecordTimerEntry(serviceref, begin, end, name, description, eit, disabled, justplay, afterevent, dirname = location, tags = tags, descramble = descramble, record_ecm = record_ecm, always_zap = always_zap, zap_wakeup = zap_wakeup, rename_repeat = rename_repeat, conflict_detection = conflict_detection) entry.repeated = int(repeated) flags = xml.get("flags") if flags: entry.flags = set(flags.encode("utf-8").split(' ')) for l in xml.findall("log"): time = int(l.get("time")) code = int(l.get("code")) msg = l.text.strip().encode("utf-8") entry.log_entries.append((time, code, msg)) return entry