def standbyTimeout(self): if config.usage.standby_to_shutdown_timer_blocktime.value: curtime = localtime(time()) if curtime.tm_year > 1970: #check if the current time is valid curtime = (curtime.tm_hour, curtime.tm_min, curtime.tm_sec) begintime = tuple( config.usage.standby_to_shutdown_timer_blocktime_begin. value) endtime = tuple( config.usage.standby_to_shutdown_timer_blocktime_end.value) if begintime <= endtime and ( curtime >= begintime and curtime < endtime) or begintime > endtime and ( curtime >= begintime or curtime < endtime): duration = (endtime[0] * 3600 + endtime[1] * 60) - ( curtime[0] * 3600 + curtime[1] * 60 + curtime[2]) if duration: if duration < 0: duration += 24 * 3600 self.standbyTimeoutTimer.startLongTimer(duration) return if self.session.screen["TunerInfo"].tuner_use_mask or mediafilesInUse( self.session): self.standbyTimeoutTimer.startLongTimer(600) else: from RecordTimer import RecordTimerEntry RecordTimerEntry.TryQuitMainloop()
def finish(self, *args, **kwargs): if self.showPendingServicesMessageShown: self.msg.close() print("[EPGRefresh] Debug: Refresh finished!") if config.plugins.epgrefresh.enablemessage.value: Notifications.AddPopup(_("EPG refresh finished."), MessageBox.TYPE_INFO, 4, ENDNOTIFICATIONID, domain = NOTIFICATIONDOMAIN) epgrefreshtimer.cleanup() self.maybeStopAdapter() if config.plugins.epgrefresh.epgsave.value: Notifications.AddPopup(_("EPG refresh save."), MessageBox.TYPE_INFO, 4, ENDNOTIFICATIONID, domain = NOTIFICATIONDOMAIN) from enigma import eEPGCache myEpg = None myEpg = eEPGCache.getInstance() myEpg.save() # shutdown if we're supposed to go to standby and not recording # forced scan --> manually started scan / non-forced scan --> automated scan # dontshutdownonabort overrides the shutdown if not self.forcedScan and config.plugins.epgrefresh.afterevent.value \ and not Screens.Standby.inTryQuitMainloop: if (not config.plugins.epgrefresh.dontshutdownonabort.value and self.doStopRunningRefresh) or not self.doStopRunningRefresh: self.forcedScan = False if Screens.Standby.inStandby: RecordTimerEntry.TryQuitMainloop() else: Notifications.AddNotificationWithID("Shutdown", Screens.Standby.TryQuitMainloop, 1, domain = NOTIFICATIONDOMAIN) # reset doStopRunningRefresh here instead of cleanUp as it is needed to avoid shutdown self.doStopRunningRefresh = False self.forcedScan = False self.isrunning = False self._nextTodo()
def DoElektroSleep(self, retval): config_NASenable = True if config.plugins.elektro.NASenable.value == config.plugins.elektro.profile.value else False if config.plugins.elektro.profileShift.value == True: config.plugins.elektro.profile.value = "1" if config.plugins.elektro.profile.value == "2" else "2" config.plugins.elektro.profile.save() self.setNextWakeuptime() if (retval): if not Standby.inTryQuitMainloop: if config.plugins.elektro.NASenable.value == "true" or config_NASenable: ret = NASpowerdown(config.plugins.elektro.NASname.value, config.plugins.elektro.NASuser.value, config.plugins.elektro.NASpass.value, config.plugins.elektro.NAScommand.value, config.plugins.elektro.NASport.value) configfile.save() if Standby.inStandby: RecordTimerEntry.TryQuitMainloop() else: Notifications.AddNotificationWithID( "Shutdown", Standby.TryQuitMainloop, 1) else: # Dont try to sleep until next wakeup self.dontsleep = True #Start the timer again self.TimerSleep.startLongTimer(elektrostarttime)
def finish(self, *args, **kwargs): if self.showPendingServicesMessageShown: self.msg.close() print("[EPGRefresh] Debug: Refresh finished!") if config.plugins.epgrefresh.enablemessage.value: Notifications.AddPopup(_("EPG refresh finished."), MessageBox.TYPE_INFO, 4, ENDNOTIFICATIONID, domain = NOTIFICATIONDOMAIN) epgrefreshtimer.cleanup() self.maybeStopAdapter() if config.plugins.epgrefresh.epgsave.value: Notifications.AddPopup(_("EPG refresh save."), MessageBox.TYPE_INFO, 4, ENDNOTIFICATIONID, domain = NOTIFICATIONDOMAIN) from enigma import eEPGCache myEpg = None myEpg = eEPGCache.getInstance() myEpg.save() # shutdown if we're supposed to go to deepstandby and not recording if not self.forcedScan and config.plugins.epgrefresh.afterevent.value \ and not Screens.Standby.inTryQuitMainloop: self.forcedScan = False if Screens.Standby.inStandby: RecordTimerEntry.TryQuitMainloop() else: Notifications.AddNotificationWithID("Shutdown", Screens.Standby.TryQuitMainloop, 1, domain = NOTIFICATIONDOMAIN) self.forcedScan = False self.isrunning = False self._nextTodo()
def doPowerOffAnswer(self, answer): dont_currentday = time() > self.poweroff_time if answer: if not Standby.inTryQuitMainloop: print "[PowerOffTimer] Goto auto shutdown box." if Standby.inStandby: RecordTimerEntry.TryQuitMainloop() else: Notifications.AddNotificationWithID("Shutdown", Standby.TryQuitMainloop, 1) self.powerStateTimerChanged(dont_currentday=dont_currentday) else: print "[PowerOffTimer] Shutdown canceled by the user (dont_currentday=%s)" % dont_currentday self.powerStateTimerChanged(dont_currentday=dont_currentday)
def finish(self, *args, **kwargs): if not Screens.Standby.inStandby and not config.plugins.epgrefresh.background and config.plugins.epgrefresh.enablemessage.value: Notifications.AddPopup(_("EPG refresh finished."), MessageBox.TYPE_INFO, 4, NOTIFICATIONID) self.forcedScan = False epgrefreshtimer.cleanup() self.maybeStopAdapter() # shutdown if we're supposed to go to deepstandby and not recording if not self.forcedScan and config.plugins.epgrefresh.afterevent.value \ and not Screens.Standby.inTryQuitMainloop: if Screens.Standby.inStandby: RecordTimerEntry.TryQuitMainloop() else: Notifications.AddNotificationWithID( "Shutdown", Screens.Standby.TryQuitMainloop, 1)
def afterAuto(self): if config.plugins.epgShare.afterAuto.value == 1: #self.msgCallback("gehe in Standby") colorprint("gehe in Standby") Notifications.AddNotification(Screens.Standby.Standby) elif config.plugins.epgShare.afterAuto.value == "2": if not NavigationInstance.instance.RecordTimer.isRecording(): #self.msgCallback("gehe in Deep-Standby") colorprint("gehe in Deep-Standby") if Screens.Standby.inStandby: RecordTimerEntry.TryQuitMainloop() else: Notifications.AddNotificationWithID( "Shutdown", Screens.Standby.TryQuitMainloop, 1) else: #self.msgCallback("Eine laufenden Aufnahme verhindert den Deep-Standby") colorprint( "Eine laufenden Aufnahme verhindert den Deep-Standby")
def gotoDeepStandby(self, answer): if answer: if config.plugins.serienRec.afterAutocheck.value == "2": if not NavigationInstance.instance.RecordTimer.isRecording(): for each in self.messageList: Notifications.RemovePopup(each[3]) print "[SerienRecorder] gehe in Deep-Standby" SRLogger.writeLog("gehe in Deep-Standby") if Screens.Standby.inStandby: from RecordTimer import RecordTimerEntry RecordTimerEntry.TryQuitMainloop() else: Notifications.AddNotificationWithID("Shutdown", Screens.Standby.TryQuitMainloop, 1) else: print "[SerienRecorder] Eine laufende Aufnahme verhindert den Deep-Standby" SRLogger.writeLog("Eine laufende Aufnahme verhindert den Deep-Standby") else: print "[SerienRecorder] gehe in Standby" SRLogger.writeLog("gehe in Standby") Notifications.AddNotification(Screens.Standby.Standby)
def check(self): # Simulation ggf. stoppen if self.timer.state > TimerEntry.StateWaiting and self.simulate_recordService: self.stop_simulation() # VPS wurde wieder deaktiviert oder Timer wurde beendet if self.timer is None or self.timer.state == TimerEntry.StateEnded or self.timer.cancelled: self.program_abort() self.stop_simulation() return -1 if self.timer.vpsplugin_enabled == False or config.plugins.vps.enabled.value == False: if self.activated_auto_increase: self.timer.autoincrease = False self.program_abort() self.stop_simulation() return -1 self.nextExecution = 180 if config.plugins.vps.initial_time.value < 2 and self.timer.vpsplugin_overwrite: initial_time = 120 else: initial_time = config.plugins.vps.initial_time.value * 60 if self.timer.vpsplugin_overwrite == True: if self.timer.state == TimerEntry.StateWaiting or self.timer.state == TimerEntry.StatePrepared: # Startzeit verschieben if (self.timer.begin - 60) < time(): if self.org_timer_begin == 0: self.org_timer_begin = self.timer.begin elif (self.org_timer_begin + self.max_extending_timer) < time(): # Sendung begann immer noch nicht -> abbrechen self.timer.abort() self.session.nav.RecordTimer.doActivate(self.timer) self.program_abort() self.stop_simulation() self.timer.log( 0, "[VPS] abort timer, waited enough to find Event-ID" ) return -1 self.timer.begin += 60 if (self.timer.end - self.timer.begin) < 300: self.timer.end += 180 # auf Timer-Konflikt prüfen timersanitycheck = TimerSanityCheck( self.session.nav.RecordTimer.timer_list, self.timer) if not timersanitycheck.check(): self.timer.abort() self.session.nav.RecordTimer.doActivate(self.timer) self.program_abort() self.stop_simulation() self.timer.log( 0, "[VPS] abort timer due to TimerSanityCheck") return -1 self.session.nav.RecordTimer.timeChanged(self.timer) if 30 < self.nextExecution: self.nextExecution = 30 # Programm starten if not self.program_running: if self.timer.state == TimerEntry.StateRunning: self.program_start() elif initial_time > 0: if (self.timer.begin - initial_time) <= time(): self.program_start() else: n = self.timer.begin - initial_time - time() if n < self.nextExecution: self.nextExecution = n if self.timer.state == TimerEntry.StateRunning: if self.activated_auto_increase and self.org_timer_end != 0 and ( self.org_timer_end + (4 * 3600)) < time(): # Aufnahme läuft seit 4 Stunden im Autoincrease -> abbrechen self.timer.autoincrease = False self.activated_auto_increase = False self.dont_restart_program = True self.program_abort() self.stop_simulation() self.timer.log(0, "[VPS] stop recording, too much autoincrease") try: if self.timer.vpsplugin_wasTimerWakeup: self.timer.vpsplugin_wasTimerWakeup = False if not Screens.Standby.inTryQuitMainloop: RecordTimerEntry.TryQuitMainloop(False) except: pass return self.nextExecution
def standbyTimeout(self): from RecordTimer import RecordTimerEntry RecordTimerEntry.TryQuitMainloop()
def standbyTimeout(self): print "goto deep3" from RecordTimer import RecordTimerEntry RecordTimerEntry.TryQuitMainloop()
def activate(self): next_state = self.state + 1 self.log(5, "activating state %d" % next_state) if next_state == self.StatePrepared: if self.tryPrepare(): self.log(6, "prepare ok, waiting for begin") # create file to "reserve" the filename # because another recording at the same time on another service can try to record the same event # i.e. cable / sat.. then the second recording needs an own extension... when we create the file # here than calculateFilename is happy if not self.justplay: open(self.Filename + ".ts", "w").close() # fine. it worked, resources are allocated. self.next_activation = self.begin self.backoff = 0 return True self.log(7, "prepare failed") if self.first_try_prepare: self.first_try_prepare = False cur_ref = NavigationInstance.instance.getCurrentlyPlayingServiceReference( ) if cur_ref and not cur_ref.getPath(): if not config.recording.asktozap.value: self.log(8, "asking user to zap away") if config.plugins.merlinEpgCenter.showTimerMessages.value: self.session.openWithCallback( self.failureCB, MessageBox, _("A timer failed to record!\nDisable TV and try again?\n" ), timeout=20) else: # zap without asking self.log(9, "zap without asking") if config.plugins.merlinEpgCenter.showTimerMessages.value: self.session.open( MessageBox, _("In order to record a timer, the TV was switched to the recording service!\n" ), type=MessageBox.TYPE_INFO, timeout=config.merlin2. timeout_message_channel_switch.value) self.failureCB(True) elif cur_ref: self.log( 8, "currently running service is not a live service.. so stop it makes no sense" ) else: self.log( 8, "currently no service running... so we dont need to stop it" ) return False elif next_state == self.StateRunning: # if this timer has been cancelled, just go to "end" state. if self.cancelled: return True if self.justplay: if Screens.Standby.inStandby: self.log(11, "wakeup and zap") #set service to zap after standby Screens.Standby.inStandby.prev_running_service = self.service_ref.ref #wakeup standby Screens.Standby.inStandby.Power() else: self.log(11, "zapping") NavigationInstance.instance.playService( self.service_ref.ref) return True else: self.log(11, "start recording") record_res = self.record_service.start() if record_res: self.log(13, "start record returned %d" % record_res) self.do_backoff() # retry self.begin = time() + self.backoff return False return True elif next_state == self.StateEnded: old_end = self.end if self.setAutoincreaseEnd(): self.log( 12, "autoincrase recording %d minute(s)" % int( (self.end - old_end) / 60)) self.state -= 1 return True self.log(12, "stop recording") if not self.justplay: NavigationInstance.instance.stopRecordService( self.record_service) self.record_service = None if self.afterEvent == AFTEREVENT.STANDBY: if not Screens.Standby.inStandby and config.plugins.merlinEpgCenter.showTimerMessages.value: # not already in standby self.session.openWithCallback( self.sendStandbyNotification, MessageBox, _("A finished record timer wants to set your\nDreambox to standby. Do that now?" ), timeout=20) elif self.afterEvent == AFTEREVENT.DEEPSTANDBY: if not Screens.Standby.inTryQuitMainloop: # not a shutdown messagebox is open if Screens.Standby.inStandby: # in standby RecordTimerEntry.TryQuitMainloop( ) # start shutdown handling without screen elif config.plugins.merlinEpgCenter.showTimerMessages.value: self.session.openWithCallback( self.sendTryQuitMainloopNotification, MessageBox, _("A finished record timer wants to shut down\nyour Dreambox. Shutdown now?" ), timeout=20) return True
def finish(self, *args, **kwargs): if self.showPendingServicesMessageShown: self.msg.close() print("[EPGRefresh] Debug: Refresh finished!") if config.plugins.epgrefresh.enablemessage.value: Notifications.AddPopup(_("EPG refresh finished."), MessageBox.TYPE_INFO, 4, ENDNOTIFICATIONID, domain=NOTIFICATIONDOMAIN) epgrefreshtimer.cleanup() self.maybeStopAdapter() if config.plugins.epgrefresh.epgsave.value: Notifications.AddPopup(_("EPG refresh save."), MessageBox.TYPE_INFO, 4, ENDNOTIFICATIONID, domain=NOTIFICATIONDOMAIN) from enigma import eEPGCache myEpg = None myEpg = eEPGCache.getInstance() myEpg.save() force_auto_shutdown = self.session.nav.wasTimerWakeup() and \ config.plugins.epgrefresh.afterevent.value == "auto" and \ Screens.Standby.inStandby and config.misc.standbyCounter.value == 1 and \ config.misc.prev_wakeup_time.value == config.plugins.epgrefresh.wakeup_time.value if not self.forcedScan: # shutdown if config.plugins.epgrefresh.afterevent.value == "standby" or force_auto_shutdown: if not Screens.Standby.inTryQuitMainloop: if (not config.plugins.epgrefresh.dontshutdownonabort.value and self.doStopRunningRefresh ) or not self.doStopRunningRefresh: self.forcedScan = False if Screens.Standby.inStandby: RecordTimerEntry.TryQuitMainloop() else: Notifications.AddNotificationWithCallback( self.sendTryQuitMainloopNotification, MessageBox, _("EPGRefresh wants to shut down\nyour Dreambox. Shutdown now?" ), timeout=10, domain=NOTIFICATIONDOMAIN) # idle elif config.plugins.epgrefresh.afterevent.value == "idle": if not Screens.Standby.inStandby: Notifications.AddNotificationWithCallback( self.sendStandbyNotification, MessageBox, _("EPGRefresh wants to set your\nDreambox to idle. Do that now?" ), timeout=10, domain=NOTIFICATIONDOMAIN) self.doStopRunningRefresh = False self.forcedScan = False self.isrunning = False self._nextTodo()