def __init__(self, nextRecordTimerAfterEventActionAuto=False, nextPowerManagerAfterEventActionAuto=False): if NavigationInstance.instance is not None: raise NavigationInstance.instance NavigationInstance.instance = self self.ServiceHandler = eServiceCenter.getInstance() import Navigation as Nav Nav.navcore = self self.pnav = pNavigation() self.pnav.m_event.get().append(self.dispatchEvent) self.pnav.m_record_event.get().append(self.dispatchRecordEvent) self.event = [] self.record_event = [] self.currentlyPlayingServiceReference = None self.currentlyPlayingServiceOrGroup = None self.currentlyPlayingService = None self.RecordTimer = RecordTimer.RecordTimer() self.PowerTimer = PowerTimer.PowerTimer() self.__wasTimerWakeup = False self.__nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto self.__nextPowerManagerAfterEventActionAuto = nextPowerManagerAfterEventActionAuto if getFPWasTimerWakeup(): self.__wasTimerWakeup = True self._processTimerWakeup() self.__isRestartUI = config.misc.RestartUI.value startup_to_standby = config.usage.startup_to_standby.value wakeup_time_type = config.misc.prev_wakeup_time_type.value wakeup_timer_enabled = False if config.usage.remote_fallback_import_restart.value: ImportChannels() if self.__wasTimerWakeup: wakeup_timer_enabled = wakeup_time_type == 3 and config.misc.prev_wakeup_time.value if not wakeup_timer_enabled: RecordTimer.RecordTimerEntry.setWasInDeepStandby() if config.misc.RestartUI.value: config.misc.RestartUI.value = False config.misc.RestartUI.save() configfile.save() else: if config.usage.remote_fallback_import.value and not config.usage.remote_fallback_import_restart.value: ImportChannels() if startup_to_standby == "yes" or self.__wasTimerWakeup and config.misc.prev_wakeup_time.value and ( wakeup_time_type == 0 or wakeup_time_type == 1 or (wakeup_time_type == 3 and startup_to_standby == "except")): if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotification( Screens.Standby.Standby, wakeup_timer_enabled and 1 or True) if config.misc.prev_wakeup_time.value: config.misc.prev_wakeup_time.value = 0 config.misc.prev_wakeup_time.save() configfile.save()
def __onClose(self): global inStandby inStandby = None self.standbyTimeoutTimer.stop() self.standbyStopServiceTimer.stop() self.standbyWakeupTimer.stop() self.timeHandler and self.timeHandler.m_timeUpdated.get().remove( self.stopService) if self.paused_service: self.paused_action and self.paused_service.unPauseService() elif self.prev_running_service: service = self.prev_running_service.toString() if config.servicelist.startupservice_onstandby.value: self.session.nav.playService( eServiceReference(config.servicelist.startupservice.value)) from Screens.InfoBar import InfoBar InfoBar.instance and InfoBar.instance.servicelist.correctChannelNumber( ) else: self.session.nav.playService(self.prev_running_service) self.session.screen["Standby"].boolean = False globalActionMap.setEnabled(True) if RecordTimer.RecordTimerEntry.receiveRecordEvents: RecordTimer.RecordTimerEntry.stopTryQuitMainloop() self.avswitch.setInput("ENCODER") self.leaveMute() if os.path.exists("/usr/script/standby_leave.sh"): Console().ePopen("/usr/script/standby_leave.sh") if config.usage.remote_fallback_import_standby.value: ImportChannels()
def run(self): if self.avahiselect.value == "ip": config.usage.remote_fallback.value = "http://%d.%d.%d.%d:%d" % ( tuple(self.ip.value) + (self.port.value, )) elif self.avahiselect.value != "url": config.usage.remote_fallback.value = self.avahiselect.value if self.avahiselect_seperate.value == "ip": config.usage.remote_fallback_import_url.value = "http://%d.%d.%d.%d:%d" % ( tuple(self.ip_seperate.value) + (self.port_seperate.value, )) elif self.avahiselect_seperate.value == "same": config.usage.remote_fallback_import_url.value = "" elif self.avahiselect_seperate.value != "url": config.usage.remote_fallback_import_url.value = self.avahiselect_seperate.value if config.usage.remote_fallback_import_url.value == config.usage.remote_fallback.value: config.usage.remote_fallback_import_url.value = "" config.usage.remote_fallback_enabled.save() config.usage.remote_fallback_import.save() config.usage.remote_fallback_import_url.save() config.usage.remote_fallback_import_restart.save() config.usage.remote_fallback_import_standby.save() config.usage.remote_fallback_extension_menu.save() config.usage.remote_fallback_ok.save() config.usage.remote_fallback_nok.save() config.usage.remote_fallback.save() config.usage.remote_fallback_external_timer.save() config.usage.remote_fallback_openwebif_customize.save() config.usage.remote_fallback_openwebif_userid.save() config.usage.remote_fallback_openwebif_password.save() config.usage.remote_fallback_openwebif_port.save() configfile.save() if not self.remote_fallback_prev and config.usage.remote_fallback_import.value: ImportChannels() self.close(False)
def __init__(self, nextRecordTimerAfterEventActionAuto=False): if NavigationInstance.instance is not None: raise NavigationInstance.instance NavigationInstance.instance = self self.ServiceHandler = eServiceCenter.getInstance() import Navigation as Nav Nav.navcore = self self.pnav = pNavigation() self.pnav.m_event.get().append(self.dispatchEvent) self.pnav.m_record_event.get().append(self.dispatchRecordEvent) self.event = [] self.record_event = [] self.currentlyPlayingServiceReference = None self.currentlyPlayingServiceOrGroup = None self.currentlyPlayingService = None self.RecordTimer = None for p in plugins.getPlugins(PluginDescriptor.WHERE_RECORDTIMER): self.RecordTimer = p() if self.RecordTimer: break if not self.RecordTimer: self.RecordTimer = RecordTimer.RecordTimer() self.nextRecordTimerAfterEventActionAuto = nextRecordTimerAfterEventActionAuto self.__wasTimerWakeup = False self.__wasRecTimerWakeup = False self.syncCount = 0 self.__isRestartUI = config.misc.RestartUI.value startup_to_standby = config.usage.startup_to_standby.value wakeup_time_type = config.misc.prev_wakeup_time_type.value wasTimerWakeup = getFPWasTimerWakeup() if not wasTimerWakeup: #work-around for boxes where driver not sent was_timer_wakeup signal to e2 print "[NAVIGATION] getNextRecordingTime= %s" % self.RecordTimer.getNextRecordingTime( ) print "[NAVIGATION] current Time=%s" % time() print "[NAVIGATION] timediff=%s" % abs( self.RecordTimer.getNextRecordingTime() - time()) if time( ) <= 31536000: # check for NTP-time sync, if no sync, wait for transponder time self.timesynctimer = eTimer() self.timesynctimer.callback.append(self.TimeSynctimer) self.timesynctimer.start(5000, True) print "[NAVIGATION] wait for time sync" elif abs( self.RecordTimer.getNextRecordingTime() - time() ) <= 360: # if there is a recording sheduled in the next 5 mins, set the wasTimerWakeup flag wasTimerWakeup = True f = open("/tmp/was_timer_wakeup_workaround.txt", "w") file = f.write(str(wasTimerWakeup)) f.close() print "[NAVIGATION] wasTimerWakeup = %s" % wasTimerWakeup if wasTimerWakeup: self.__wasTimerWakeup = True if time() <= 31536000: self.timesynctimer = eTimer() self.timesynctimer.callback.append(self.TimeSynctimer) self.timesynctimer.start(5000, True) print "[NAVIGATION] wait for time sync" elif nextRecordTimerAfterEventActionAuto and abs( self.RecordTimer.getNextRecordingTime() - time()) <= 360: self.__wasRecTimerWakeup = True print 'RECTIMER: wakeup to standby detected.' f = open("/tmp/was_rectimer_wakeup", "w") f.write('1') f.close() # as we woke the box to record, place the box in standby. self.standbytimer = eTimer() self.standbytimer.callback.append(self.gotostandby) self.standbytimer.start(15000, True) if config.usage.remote_fallback_import_restart.value: ImportChannels() if config.misc.RestartUI.value: config.misc.RestartUI.value = False config.misc.RestartUI.save() configfile.save() else: if config.usage.remote_fallback_import.value and not config.usage.remote_fallback_import_restart.value: ImportChannels() if startup_to_standby == "yes" or self.__wasTimerWakeup and config.misc.prev_wakeup_time.value and ( (wakeup_time_type == 0 or wakeup_time_type == 1) or (wakeup_time_type == 3 and startup_to_standby == "except")): if not Screens.Standby.inTryQuitMainloop: Notifications.AddNotification(Screens.Standby.Standby) if config.misc.prev_wakeup_time.value: config.misc.prev_wakeup_time.value = 0 config.misc.prev_wakeup_time.save() configfile.save()