def createConfig(self): TimerEntryBase.createConfig(self) afterevent = { AFTEREVENT.NONE: "nothing", AFTEREVENT.WAKEUPTOSTANDBY: "wakeuptostandby", AFTEREVENT.STANDBY: "standby", AFTEREVENT.DEEPSTANDBY: "deepstandby" }[self.timer.afterEvent] 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.timer.timerType] autosleepinstandbyonly = self.timer.autosleepinstandbyonly autosleepdelay = self.timer.autosleepdelay autosleeprepeat = self.timer.autosleeprepeat if SystemInfo["DeepstandbySupport"]: shutdownString = _("go to deep standby") else: shutdownString = _("shut down") self.timerentry_timertype = ConfigSelection(choices=[ ("wakeup", _("wakeup")), ("wakeuptostandby", _("wakeup to standby")), ("autostandby", _("auto standby")), ("autodeepstandby", _("auto deepstandby")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("reboot", _("reboot system")), ("restart", _("restart GUI")) ], default=timertype) self.timerentry_afterevent = ConfigSelection(choices=[ ("nothing", _("do nothing")), ("wakeuptostandby", _("wakeup to standby")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("nothing", _("do nothing")) ], default=afterevent) self.timerentry_autosleepdelay = ConfigInteger(default=autosleepdelay, limits=(10, 300)) self.timerentry_autosleeprepeat = ConfigSelection( choices=[("once", _("once")), ("repeated", _("repeated"))], default=autosleeprepeat) self.timerentry_autosleepinstandbyonly = ConfigSelection( choices=[("yes", _("Yes")), ("no", _("No"))], default=autosleepinstandbyonly) self.timerentry_showendtime = ConfigYesNo( default=(((self.timer.end - self.timer.begin) / 60) > 1))
def getBeginEnd(self): begin, end = TimerEntryBase.getBeginEnd(self) # if the timer type is a Zap and no end is set, set duration to 1 second so time is shown in EPG's. if self.timerentry_justplay.value == "zap": if not self.timerentry_showendtime.value: end = begin + (config.recording.margin_before.value * 60) + 1 return begin, end
def keySave(self): if not self.timerentry_showendtime.value: self.timerentry_endtime.value = self.timerentry_starttime.value self.timer.resetRepeated() self.timer.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 }[self.timerentry_timertype.value] self.timer.afterEvent = { "nothing": AFTEREVENT.NONE, "wakeuptostandby": AFTEREVENT.WAKEUPTOSTANDBY, "standby": AFTEREVENT.STANDBY, "deepstandby": AFTEREVENT.DEEPSTANDBY }[self.timerentry_afterevent.value] if self.timerentry_type.value == "once": self.timer.begin, self.timer.end = self.getBeginEnd() if self.timerentry_timertype.value == "autostandby" or self.timerentry_timertype.value == "autodeepstandby": self.timer.begin = int(time()) + 10 self.timer.end = self.timer.begin self.timer.autosleepinstandbyonly = self.timerentry_autosleepinstandbyonly.value self.timer.autosleepdelay = self.timerentry_autosleepdelay.value self.timer.autosleeprepeat = self.timerentry_autosleeprepeat.value # Ensure that the timer repeated is cleared if we have an autosleeprepeat if self.timerentry_type.value == "repeated": self.timer.resetRepeated() self.timerentry_type.value = "once" # Stop it being set again TimerEntryBase.keySave(self) self.saveTimer() self.close((True, self.timer))
def keySelect(self): cur = self["config"].getCurrent() if cur and cur[1] == self.timerentry_service: self.session.openWithCallback( self.finishedChannelSelection, Screens.ChannelSelection.SimpleChannelSelection, _("Select channel to record from"), currentBouquet=True) elif cur and cur[1] == self.timerentry_dirname: self.session.openWithCallback( self.pathSelected, MovieLocationBox, _("Select target folder"), self.timerentry_dirname.value, minFree=100 # We require at least 100MB free space ) elif cur and cur[1] == self.timerentry_tagsset: self.session.openWithCallback(self.tagEditFinished, getPreferredTagEditor(), self.timerentry_tags) elif cur and isinstance(cur[1], ConfigText): self.renameEntry() else: TimerEntryBase.keySelect(self)
def decrementEnd(self): if self.timerentry_showendtime.value or self.timerentry_justplay.value != "zap": TimerEntryBase.decrementEnd(self)
def createConfig(self): TimerEntryBase.createConfig(self) justplay = self.timer.justplay always_zap = self.timer.always_zap pipzap = self.timer.pipzap rename_repeat = self.timer.rename_repeat conflict_detection = self.timer.conflict_detection afterevent = { AFTEREVENT.NONE: "nothing", AFTEREVENT.DEEPSTANDBY: "deepstandby", AFTEREVENT.STANDBY: "standby", AFTEREVENT.AUTO: "auto" }[self.timer.afterEvent] if self.timer.record_ecm and self.timer.descramble: recordingtype = "descrambled+ecm" elif self.timer.record_ecm: recordingtype = "scrambled+ecm" elif self.timer.descramble: recordingtype = "normal" self.timerentry_justplay = ConfigSelection( choices=[("zap", _("zap")), ("record", _("record")), ("zap+record", _("zap and record"))], default={ 0: "record", 1: "zap", 2: "zap+record" }[justplay + 2 * always_zap]) if SystemInfo["DeepstandbySupport"]: shutdownString = _("go to deep standby") else: shutdownString = _("shut down") self.timerentry_afterevent = ConfigSelection(choices=[ ("nothing", _("do nothing")), ("standby", _("go to standby")), ("deepstandby", shutdownString), ("auto", _("auto")) ], default=afterevent) self.timerentry_recordingtype = ConfigSelection(choices=[ ("normal", _("normal")), ("descrambled+ecm", _("descramble and record ecm")), ("scrambled+ecm", _("don't descramble, record ecm")) ], default=recordingtype) self.timerentry_name = ConfigText(default=self.timer.name.replace( '\x86', '').replace('\x87', ''), visible_width=50, fixed_size=False) self.timerentry_description = ConfigText( default=self.timer.description, visible_width=50, fixed_size=False) self.timerentry_tags = self.timer.tags[:] # if no tags found, make name of event default tag set. if not self.timerentry_tags: tagname = self.timer.name.strip() if tagname: tagname = tagname[0].upper() + tagname[1:].replace(" ", "_") self.timerentry_tags.append(tagname) self.timerentry_tagsset = ConfigSelection(choices=[ not self.timerentry_tags and "None" or " ".join(self.timerentry_tags) ]) self.timerentry_renamerepeat = ConfigYesNo(default=rename_repeat) self.timerentry_pipzap = ConfigYesNo(default=pipzap) self.timerentry_conflictdetection = ConfigYesNo( default=conflict_detection) self.timerentry_showendtime = ConfigSelection(default=False, choices=[ (True, _("yes")), (False, _("no")) ]) default = self.timer.dirname or defaultMoviePath() tmp = config.movielist.videodirs.value if default not in tmp: tmp.append(default) self.timerentry_dirname = ConfigSelection(default=default, choices=tmp) # FIXME some service-chooser needed here servicename = "N/A" try: # no current service available? servicename = str(self.timer.service_ref.getServiceName()) except: pass self.timerentry_service_ref = self.timer.service_ref self.timerentry_service = ConfigSelection([servicename])
def __init__(self, session, timer): TimerEntryBase.__init__(self, session, timer, "timerentry")
def keySave(self, result=None): if not self.timerentry_service_ref.isRecordable(): self.session.openWithCallback( self.selectChannelSelector, MessageBox, _("You didn't select a channel to record from."), MessageBox.TYPE_ERROR) return self.timer.name = self.timerentry_name.value self.timer.description = self.timerentry_description.value self.timer.justplay = self.timerentry_justplay.value == "zap" self.timer.always_zap = self.timerentry_justplay.value == "zap+record" self.timer.pipzap = self.timerentry_pipzap.value self.timer.rename_repeat = self.timerentry_renamerepeat.value self.timer.conflict_detection = self.timerentry_conflictdetection.value if self.timerentry_justplay.value == "zap": if not self.timerentry_showendtime.value: self.timerentry_endtime.value = self.timerentry_starttime.value self.timer.afterEvent = { "nothing": AFTEREVENT.NONE, "deepstandby": AFTEREVENT.DEEPSTANDBY, "standby": AFTEREVENT.STANDBY, "auto": AFTEREVENT.AUTO }[self.timerentry_afterevent.value] # There is no point doing anything after a Zap-only timer! # For a start, you can't actually configure anything in the menu, but # leaving it as AUTO means that the code may try to shutdown at Zap time # if the Zap timer woke the box up. # if self.timer.justplay: self.timer.afterEvent = AFTEREVENT.NONE self.timer.descramble = { "normal": True, "descrambled+ecm": True, "scrambled+ecm": False, }[self.timerentry_recordingtype.value] self.timer.record_ecm = { "normal": False, "descrambled+ecm": True, "scrambled+ecm": True, }[self.timerentry_recordingtype.value] self.timer.service_ref = self.timerentry_service_ref self.timer.tags = self.timerentry_tags if self.timer.dirname or self.timerentry_dirname.value != defaultMoviePath( ): self.timer.dirname = self.timerentry_dirname.value config.movielist.last_timer_videodir.value = self.timer.dirname config.movielist.last_timer_videodir.save() if self.timerentry_type.value == "once": self.timer.begin, self.timer.end = self.getBeginEnd() TimerEntryBase.keySave(self) if self.timer.eit is not None: event = eEPGCache.getInstance().lookupEventId( self.timer.service_ref.ref, self.timer.eit) if event: n = event.getNumOfLinkageServices() if n > 1: tlist = [] ref = self.session.nav.getCurrentlyPlayingServiceOrGroup() parent = self.timer.service_ref.ref selection = 0 for x in range(n): i = event.getLinkageService(parent, x) if i.toString() == ref.toString(): selection = x tlist.append((i.getName(), i)) self.session.openWithCallback( self.subserviceSelected, ChoiceBox, title=_("Please select a subservice to record..."), list=tlist, selection=selection) return elif n > 0: parent = self.timer.service_ref.ref self.timer.service_ref = ServiceReference( event.getLinkageService(parent, 0)) self.saveTimer() self.close((True, self.timer))
def decrementEnd(self): if self.timerentry_showendtime.value: TimerEntryBase.decrementEnd(self)
def decrementStart(self): if self.timerentry_timertype.value not in ("autostandby", "autodeepstandby"): TimerEntryBase.decrementStart(self)