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 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))