def update_schedule(self, result=None, retval=None, extra_args=None): nowTime = time() print '[NTP]: setting E2 time:', nowTime setRTCtime(nowTime) eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) self.timer.startLongTimer( int(config.misc.useNTPminutes.getValue()) * 60)
def keyGo(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent() and self["config"].getCurrent()[1] if sel == self.ST.syncNTPtime: if os.path.exists("/usr/sbin/ntpdate"): cmd = '/usr/sbin/ntpdate -v -u %s && echo "\n"' % self.ST.ip.value self.session.open(MyConsole, _("Time sync with NTP..."), [cmd]) elif os.path.exists("/usr/sbin/ntpd"): cmd = '/usr/sbin/ntpd -dnqp %s' % self.ST.ip.value self.session.open(MyConsole, _("Time sync with NTP..."), [cmd]) else: self.session.open(MessageBox,"'ntpd' / " + _("'ntpdate' not installed !"), MessageBox.TYPE_ERROR, timeout = 3) elif sel == self.ST.syncDVBtime: try: if not self.syncTimer.isActive(): self.old_time = time.time() self.oldtime = strftime("%Y:%m:%d %H:%M",localtime()) eDVBLocalTimeHandler.getInstance().syncDVBTime() self.syncTimer.start(5000, True) except: if os.path.exists("/usr/bin/dvbdate"): cmd = '/usr/bin/dvbdate -p -s -f && echo "\n"' self.session.open(MyConsole, _("Time sync with DVB..."), [cmd]) else: self.session.open(MessageBox,_("'dvbdate' not installed !"), MessageBox.TYPE_ERROR, timeout = 3) elif sel == self.ST.syncManually: ChangeTimeWizzard(self.session)
def keyGo(self): ConfigListScreen.keyOK(self) sel = self["config"].getCurrent() and self["config"].getCurrent()[1] if sel == self.ST.syncNTPtime: if os.path.exists("/usr/sbin/ntpdate"): cmd = '/usr/sbin/ntpdate -v -u %s && echo "\n"' % self.ST.ip.value self.session.open(SystemTimeConsole, _("Syncing with NTP server..."), [cmd]) elif os.path.exists("/usr/sbin/ntpd"): cmd = '/usr/sbin/ntpd -dnqp %s' % self.ST.ip.value self.session.open(SystemTimeConsole, _("Syncing with NTP server..."), [cmd]) else: self.session.open(MessageBox,"'ntpd' / " + _("'ntpdate' is not installed!"), MessageBox.TYPE_ERROR, timeout=3) elif sel == self.ST.syncDVBtime: try: if not self.syncTimer.isActive(): self.old_time = time.time() self.oldtime = time.strftime("%Y:%m:%d %H:%M",time.localtime()) eDVBLocalTimeHandler.getInstance().syncDVBTime() self.messagebox = self.session.openWithCallback(self.messageboxSessionClose, MessageBox, _("Syncing... Please wait."), MessageBox.TYPE_INFO) self.syncTimer.start(5000, True) except: if os.path.exists("/usr/bin/dvbdate"): cmd = '/usr/bin/dvbdate -p -s -f && echo "\n"' self.session.open(SystemTimeConsole, _("Syncing with current transponder..."), [cmd]) else: self.session.open(MessageBox,_("'dvbdate' is not installed!"), MessageBox.TYPE_ERROR, timeout=3) elif sel == self.ST.syncManually: ChangeTimeWizzard(self.session)
def timesyncChanged(configElement): if configElement.value == "dvb" or not GetIPsFromNetworkInterfaces(): eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) eEPGCache.getInstance().timeUpdated() if configElement.value == "dvb" and os.path.islink('/etc/network/if-up.d/ntpdate-sync'): Console().ePopen("sed -i '/ntpdate-sync/d' /etc/cron/crontabs/root;unlink /etc/network/if-up.d/ntpdate-sync") else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) eEPGCache.getInstance().timeUpdated() if not os.path.islink('/etc/network/if-up.d/ntpdate-sync'): Console().ePopen("echo '30 * * * * /usr/bin/ntpdate-sync silent' >>/etc/cron/crontabs/root;ln -s /usr/bin/ntpdate-sync /etc/network/if-up.d/ntpdate-sync")
def update_schedule(self, result=None, retval=None, extra_args=None): if retval and result: print("[NetworkTime] Error %d: Unable to synchronize the time!\n%s" % (retval, result.strip())) nowTime = time() if nowTime > 10000: print('[NetworkTime] setting E2 time:', nowTime) setRTCtime(nowTime) eDVBLocalTimeHandler.getInstance().setUseDVBTime(config.misc.SyncTimeUsing.value == "dvb") eEPGCache.getInstance().timeUpdated() self.timer.startLongTimer(int(config.misc.useNTPminutes.value if config.misc.SyncTimeUsing.value == "ntp" else config.misc.useNTPminutes.default) * 60) else: print('[NetworkTime] NO TIME SET') self.timer.startLongTimer(10)
def cancel(self): nowTime = time.time() if nowTime > 1388534400: setRTCtime(nowTime) if config.plugins.SystemTime.choiceSystemTime.value == "0": eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) try: eEPGCache.getInstance().timeUpdated() except: pass Console.cancel(self)
def update_schedule(self, result = None, retval = None, extra_args = None): if eDVBLocalTimeHandler.getInstance().ready(): nowTime = time() if nowTime > 1388534400: setRTCtime(nowTime) if config.plugins.SystemTime.choiceSystemTime.value == "0": eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) try: eEPGCache.getInstance().timeUpdated() except: pass
def update_schedule(self, result=None, retval=None, extra_args=None): if eDVBLocalTimeHandler.getInstance().ready(): nowTime = time() if nowTime > 1388534400: setRTCtime(nowTime) if config.plugins.SystemTime.choiceSystemTime.value == "0": eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) try: eEPGCache.getInstance().timeUpdated() except: pass
def updateSchedule(self, data=None, retVal=None, extraArgs=None): if retVal and data: print("[NetworkTime] Error %d: Unable to synchronize the time!\n%s" % (retVal, data.strip())) nowTime = time() if nowTime > 10000: timeSource = config.misc.SyncTimeUsing.value print("[NetworkTime] Setting time to '%s' (%s) from '%s'." % (ctime(nowTime), str(nowTime), config.misc.SyncTimeUsing.toDisplayString(timeSource))) setRTCtime(nowTime) eDVBLocalTimeHandler.getInstance().setUseDVBTime(timeSource == "0") eEPGCache.getInstance().timeUpdated() self.timer.startLongTimer(int(config.misc.useNTPminutes.value) * 60) else: print("[NetworkTime] System time not yet available.") self.timer.startLongTimer(10)
def __init__(self): BirthdayStore.__init__(self) Timer.__init__(self) # this is used to detect settings changes, because we only want to change preremind timers if a different value was saved by the user config.plugins.birthdayreminder.preremindChanged.addNotifier(self.cbPreremindChanged, initial_call = False) config.plugins.birthdayreminder.notificationTimeChanged.addNotifier(self.cbNotificationTimeChanged, initial_call = False) # let's wait for the system time being up to date before starting the timers. needed when the box was powered off if not eDVBLocalTimeHandler.getInstance().ready(): eDVBLocalTimeHandler.getInstance().m_timeUpdated.get().append(self.startTimer) else: self.start() self.startNetworking()
def update_schedule(self, result = None, retval = None, extra_args = None): nowTime = time() if nowTime > 10000: print '[NTP]: setting E2 time:',nowTime setRTCtime(nowTime) if config.misc.SyncTimeUsing.value == "1": eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) eEPGCache.getInstance().timeUpdated() self.timer.startLongTimer(int(config.misc.useNTPminutes.value) * 60) else: print 'NO TIME SET' self.timer.startLongTimer(10)
def update_schedule(self, result=None, retval=None, extra_args=None): nowTime = time() if nowTime > 10000: print '[NetworkTime] setting E2 time:', nowTime setRTCtime(nowTime) if config.misc.SyncTimeUsing.value == "1": eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) eEPGCache.getInstance().timeUpdated() self.timer.startLongTimer( int(config.misc.useNTPminutes.value) * 60) else: print '[NetworkTime] NO TIME SET' self.timer.startLongTimer(10)
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() self.paused_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = True self.infoBarInstance.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self): BirthdayStore.__init__(self) Timer.__init__(self) # this is used to detect settings changes, because we only want to change preremind timers if a different value was saved by the user config.plugins.birthdayreminder.preremindChanged.addNotifier(self.cbPreremindChanged, initial_call = False) config.plugins.birthdayreminder.notificationTimeChanged.addNotifier(self.cbNotificationTimeChanged, initial_call = False) # let's wait for the system time being up to date before starting the timers. needed when the box was powered off if not eDVBLocalTimeHandler.getInstance().ready(): self.local_time_handler_conn = eDVBLocalTimeHandler.getInstance().m_timeUpdated.connect(self.startTimer) else: self.start() self.startNetworking() self.broadcastPort = None self.transferServerPort = None
def timeCallback(isCallback=True): """Time Callback/Autostart management.""" thInstance = eDVBLocalTimeHandler.getInstance() if isCallback: # NOTE: this assumes the clock is actually ready when called back # this may not be true, but we prefer silently dying to waiting forever thInstance.m_timeUpdated.get().remove(timeCallback) elif not thInstance.ready(): thInstance.m_timeUpdated.get().append(timeCallback) return if config.plugins.epgrefresh.wakeup.value: now = localtime() begin = int(mktime( (now.tm_year, now.tm_mon, now.tm_mday, config.plugins.epgrefresh.begin.value[0], config.plugins.epgrefresh.begin.value[1], 0, now.tm_wday, now.tm_yday, now.tm_isdst) )) # booted +- 6min from begin of timespan cur_day = int(now.tm_wday) if abs(time() - begin) < 360 and config.plugins.epgrefresh_extra.day_refresh[cur_day].value: from Tools.Notifications import AddNotificationWithCallback from Tools.BoundFunction import boundFunction # XXX: we use a notification because this will be suppressed otherwise AddNotificationWithCallback( boundFunction(standbyQuestionCallback, epgrefresh.session), MessageBox, _("This might have been an automated bootup to refresh the EPG. For this to happen it is recommended to put the receiver to Standby.\nDo you want to do this now?"), timeout = 30 ) epgrefresh.start()
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() self.paused_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = True self.infoBarInstance.pauseService() else: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def _processTimerWakeup(self): now = time() timeHandlerCallbacks = eDVBLocalTimeHandler.getInstance().m_timeUpdated.get() if self.__nextRecordTimerAfterEventActionAuto and now < eDVBLocalTimeHandler.timeOK: # 01.01.2004 print '[Navigation] RECTIMER: wakeup to standby but system time not set.' if self._processTimerWakeup not in timeHandlerCallbacks: timeHandlerCallbacks.append(self._processTimerWakeup) return if self._processTimerWakeup in timeHandlerCallbacks: timeHandlerCallbacks.remove(self._processTimerWakeup) if self.__nextRecordTimerAfterEventActionAuto and abs(self.RecordTimer.getNextRecordingTime() - now) <= 360: print '[Navigation] 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) elif self.__nextPowerManagerAfterEventActionAuto: print '[Navigation] POWERTIMER: wakeup to standby detected.' f = open("/tmp/was_powertimer_wakeup", "w") f.write('1') f.close() # as a PowerTimer WakeToStandby was actiond to it. self.standbytimer = eTimer() self.standbytimer.callback.append(self.gotostandby) self.standbytimer.start(15000, True)
def __init__(self, session): Screen.__init__(self, session) self.skinName = 'Standby' self.avswitch = AVSwitch() print 'enter standby' if getMachineProcModel() in 'ini-7012': if path.exists('/proc/stb/lcd/symbol_scrambled'): open('/proc/stb/lcd/symbol_scrambled', 'w').write('0') if path.exists('/proc/stb/lcd/symbol_1080p'): open('/proc/stb/lcd/symbol_1080p', 'w').write('0') if path.exists('/proc/stb/lcd/symbol_1080i'): open('/proc/stb/lcd/symbol_1080i', 'w').write('0') if path.exists('/proc/stb/lcd/symbol_720p'): open('/proc/stb/lcd/symbol_720p', 'w').write('0') if path.exists('/proc/stb/lcd/symbol_576i'): open('/proc/stb/lcd/symbol_576i', 'w').write('0') if path.exists('/proc/stb/lcd/symbol_576p'): open('/proc/stb/lcd/symbol_576p', 'w').write('0') if path.exists('/proc/stb/lcd/symbol_hd'): open('/proc/stb/lcd/symbol_hd', 'w').write('0') if path.exists('/proc/stb/lcd/symbol_dolby_audio'): open('/proc/stb/lcd/symbol_dolby_audio', 'w').write('0') if path.exists('/proc/stb/lcd/symbol_mp3'): open('/proc/stb/lcd/symbol_mp3', 'w').write('0') self['actions'] = ActionMap(['StandbyActions'], {'power': self.Power, 'discrete_on': self.Power}, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None self.setMute() if SystemInfo['Display'] and SystemInfo['LCDMiniTV']: setLCDModeMinitTV('0') self.paused_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(':', 1)[1].startswith('/'): self.paused_service = True self.infoBarInstance.pauseService() else: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, 'showPiP') and self.infoBarInstance.showPiP() if SystemInfo['ScartSwitch']: self.avswitch.setInput('SCART') else: self.avswitch.setInput('AUX') self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def _processTimerWakeup(self): now = time() timeHandlerCallbacks = eDVBLocalTimeHandler.getInstance( ).m_timeUpdated.get() if self.__nextRecordTimerAfterEventActionAuto and now < eDVBLocalTimeHandler.timeOK: print( '[Navigation] RECTIMER: wakeup to standby but system time not set.' ) if self._processTimerWakeup not in timeHandlerCallbacks: timeHandlerCallbacks.append(self._processTimerWakeup) return if self._processTimerWakeup in timeHandlerCallbacks: timeHandlerCallbacks.remove(self._processTimerWakeup) if self.__nextRecordTimerAfterEventActionAuto and abs( self.RecordTimer.getNextRecordingTime() - now) <= 360: print('[Navigation] RECTIMER: wakeup to standby detected.') open("/tmp/was_rectimer_wakeup", "w").write("1") # 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) elif self.__nextPowerManagerAfterEventActionAuto: print('[Navigation] POWERTIMER: wakeup to standby detected.') open("/tmp/was_powertimer_wakeup", "w").write("1") # as a PowerTimer WakeToStandby was actiond to it. self.standbytimer = eTimer() self.standbytimer.callback.append(self.gotostandby) self.standbytimer.start(15000, True)
def __init__(self, session): Screen.__init__(self, session) self.skinName = "Standby" self.avswitch = AVSwitch() print "[Standby] enter standby" self["actions"] = ActionMap(["StandbyActions"], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]: # set LCDminiTV off setLCDMiniTVMode("0") self.paused_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup( ) service = self.prev_running_service and self.prev_running_service.toString( ) if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = True self.infoBarInstance.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr( self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session): Screen.__init__(self, session) self.skinName = "Standby" self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]: # set LCDminiTV off setLCDModeMinitTV("0") self.paused_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.startswith("1:") and service.rsplit(":", 1)[1].startswith("/"): self.paused_service = self.session.current_dialog self.paused_service.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: from Screens.InfoBar import InfoBar InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") if int(config.usage.hdd_standby_in_standby.value) != -1: # HDD standby timer value (box in standby) / -1 = same as when box is active for hdd in harddiskmanager.HDDList(): hdd[1].setIdleTime(int(config.usage.hdd_standby_in_standby.value)) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap(["StandbyActions"], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() self.paused_service = None self.prev_running_service = None if self.session.current_dialog: if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append( self.stopService) elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES: self.paused_service = self.session.current_dialog self.paused_service.pauseService() if self.session.pipshown: from Screens.InfoBar import InfoBar InfoBar.instance and hasattr( InfoBar.instance, "showPiP") and InfoBar.instance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") open("/proc/stb/hdmi/output", "w").write("off") gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() self.paused_service = None self.prev_running_service = None if self.session.current_dialog: if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES: self.paused_service = self.session.current_dialog self.paused_service.pauseService() if self.session.pipshown: from Screens.InfoBar import InfoBar InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") open("/proc/stb/hdmi/output", "w").write("off") gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def startTimer(self, bForceStart=False, iRemainingSeconds=0): curStartYear = time.localtime().tm_year if curStartYear < 2011: # Time has not yet been set from transponder, wait until it has been set eDVBLocalTimeHandler.getInstance().m_timeUpdated.get().append( self.gotTime) else: bDoStandardInit = True if bForceStart: self.enabled = True else: self.enabled = config.plugins.KiddyTimer.enabled.value if (self.enabled == True and self.timerHasToRun()) or bForceStart: # This command may be double, just made to be sure, the observer is stopped when the real timer starts self.stopObserve() # Date of the current day self.currentDay = time.strftime("%d.%m.%Y", time.localtime()) # First check for Cheat- attempts by kids if self.detectCheatAttempt(): config.plugins.KiddyTimer.remainingTime.value = 0 configfile.save() bForceStart = True elif iRemainingSeconds > 0: self.resetTimer(setTime=iRemainingSeconds) bDoStandardInit = False elif self.currentDay != config.plugins.KiddyTimer.lastStartDay.getValue( ): self.resetTimer() bDoStandardInit = False if bDoStandardInit: self.setCurrentDayTime() self.setSessionTime( config.plugins.KiddyTimer.remainingTime.getValue()) self.setRemainingTime(self.sessionTime) self.setSessionStartTime() self.setPluginStatus("RUNNING") self.toggleActiveState(True) if not bForceStart: self.askForActivation() else: self.startLoop() else: if (self.enabled == True): self.startObserve()
def DoChangeTimeRestart(self, answer): if answer is None: self.skipChangeTime(_("answer is None")) if answer is False: self.skipChangeTime(_("you were not confirming")) else: os.system("date %s" % (self.newtime)) nowTime = time.time() if nowTime > 1388534400: setRTCtime(nowTime) if config.plugins.SystemTime.choiceSystemTime.value == "0": eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) try: eEPGCache.getInstance().timeUpdated() except: pass
def DoChangeTimeRestart(self, answer): if answer is None: self.skipChangeTime(_("No answer given.")) if answer is False: self.skipChangeTime(_("No confirmation given.")) else: Console().ePopen("date %s" % self.newtime) nowTime = time.time() if nowTime > 1514808000: setRTCtime(nowTime) if config.plugins.SystemTime.choiceSystemTime.value == "0": eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) try: eEPGCache.getInstance().timeUpdated() except: pass
def __init__(self, session): Screen.__init__(self, session) self.skinName = 'Standby' self.avswitch = AVSwitch() print '[Standby] enter standby' self['actions'] = ActionMap(['StandbyActions'], { 'power': self.Power, 'discrete_on': self.Power }, -1) globalActionMap.setEnabled(False) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None self.setMute() if SystemInfo['Display'] and SystemInfo['LCDMiniTV']: setLCDModeMinitTV('0') self.paused_service = None self.prev_running_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup( ) service = self.prev_running_service and self.prev_running_service.toString( ) if service: if service.startswith('1:') and service.rsplit( ':', 1)[1].startswith('/'): self.paused_service = self.session.current_dialog self.paused_service.pauseService() else: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append( self.stopService) if self.session.pipshown: from Screens.InfoBar import InfoBar InfoBar.instance and hasattr( InfoBar.instance, 'showPiP') and InfoBar.instance.showPiP() if SystemInfo['ScartSwitch']: self.avswitch.setInput('SCART') else: self.avswitch.setInput('AUX') if getBrandOEM() in 'fulan': open('/proc/stb/hdmi/output', 'w').write('off') if int(config.usage.hdd_standby_in_standby.value) != -1: for hdd in harddiskmanager.HDDList(): hdd[1].setIdleTime( int(config.usage.hdd_standby_in_standby.value)) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose) return
def __init__(self, session): Screen.__init__(self, session) self.skinName = "Standby" self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() self.paused_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = True self.infoBarInstance.pauseService() else: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") if (getBrandOEM() in ('fulan')): open("/proc/stb/hdmi/output", "w").write("off") self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def startTimer(self,bForceStart=False,iRemainingSeconds=0): curStartYear = time.localtime().tm_year if curStartYear < 2011: # Time has not yet been set from transponder, wait until it has been set eDVBLocalTimeHandler.getInstance().m_timeUpdated.get().append(self.gotTime) else: bDoStandardInit = True if bForceStart: self.enabled = True else: self.enabled = config.plugins.KiddyTimer.enabled.value if (self.enabled == True and self.timerHasToRun()) or bForceStart: # This command may be double, just made to be sure, the observer is stopped when the real timer starts self.stopObserve() # Date of the current day self.currentDay = time.strftime("%d.%m.%Y" , time.localtime()) # First check for Cheat- attempts by kids if self.detectCheatAttempt(): config.plugins.KiddyTimer.remainingTime.value = 0 configfile.save() bForceStart = True elif iRemainingSeconds > 0: self.resetTimer(setTime=iRemainingSeconds) bDoStandardInit = False elif self.currentDay != config.plugins.KiddyTimer.lastStartDay.getValue(): self.resetTimer() bDoStandardInit = False if bDoStandardInit: self.setCurrentDayTime() self.setSessionTime(config.plugins.KiddyTimer.remainingTime.getValue()) self.setRemainingTime(self.sessionTime) self.setSessionStartTime() self.setPluginStatus("RUNNING") self.toggleActiveState(True) if not bForceStart: self.askForActivation() else: self.startLoop() else: if (self.enabled == True): self.startObserve()
def timeCallback(isCallback=True): """Time Callback/Autostart management.""" thInstance = eDVBLocalTimeHandler.getInstance() if isCallback: # NOTE: this assumes the clock is actually ready when called back # this may not be true, but we prefer silently dying to waiting forever thInstance.m_timeUpdated.get().remove(timeCallback) elif not thInstance.ready(): thInstance.m_timeUpdated.get().append(timeCallback) return epgrefresh.start()
def keyGreen(self): if self.ST.syncNTPcoldstart.value: if self.prev_ip != self.ST.ip.value or self.prev_wifi_delay != config.plugins.SystemTime.wifi_delay.value: self.removeNTPcoldstart() self.addNTPcoldstart() else: self.removeNTPcoldstart() if self.ST.useRTCstart.value: self.addUseRTC() else: self.removeUseRTC() if self.ST.choiceSystemTime.value == "0": eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) config.misc.useTransponderTime.value = True config.misc.useTransponderTime.save() else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) config.misc.useTransponderTime.value = False config.misc.useTransponderTime.save() removeNetworkStart() self.ST.save() configfile.save() self.session.openWithCallback(self.restartGuiNow, MessageBox, _("Restart the GUI now?"), MessageBox.TYPE_YESNO, default = False)
def keyGreen(self): if self.ST.syncNTPcoldstart.value: if self.prev_ip != self.ST.ip.value or self.prev_wifi_delay != config.plugins.SystemTime.wifi_delay.value: self.removeNTPcoldstart() self.addNTPcoldstart() else: self.removeNTPcoldstart() if self.ST.useRTCstart.value: self.addUseRTC() else: self.removeUseRTC() if self.ST.choiceSystemTime.value == "0": eDVBLocalTimeHandler.getInstance().setUseDVBTime(True) config.misc.useTransponderTime.value = True config.misc.useTransponderTime.save() else: eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) config.misc.useTransponderTime.value = False config.misc.useTransponderTime.save() removeNetworkStart() self.ST.save() configfile.save() self.close()
def __init__(self, session): Screen.__init__(self, session) self.skinName = 'Standby' self.avswitch = AVSwitch() print '[Standby] enter standby' self['actions'] = ActionMap(['StandbyActions'], {'power': self.Power, 'discrete_on': self.Power}, -1) globalActionMap.setEnabled(False) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None self.setMute() if SystemInfo['Display'] and SystemInfo['LCDMiniTV']: setLCDModeMinitTV('0') self.paused_service = None self.prev_running_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.startswith('1:') and service.rsplit(':', 1)[1].startswith('/'): self.paused_service = self.session.current_dialog self.paused_service.pauseService() else: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: from Screens.InfoBar import InfoBar InfoBar.instance and hasattr(InfoBar.instance, 'showPiP') and InfoBar.instance.showPiP() if SystemInfo['ScartSwitch']: self.avswitch.setInput('SCART') else: self.avswitch.setInput('AUX') if getBrandOEM() in 'fulan': open('/proc/stb/hdmi/output', 'w').write('off') if int(config.usage.hdd_standby_in_standby.value) != -1: for hdd in harddiskmanager.HDDList(): hdd[1].setIdleTime(int(config.usage.hdd_standby_in_standby.value)) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose) return
def __init__(self): self.session = None self.wait_nextday = self.dont_currentday = False self.poweroff_time = self.nextday_time = -1 self.wait_nextday_time = 300 self.doPowerOffTimer = eTimer() self.doPowerOffTimer.callback.append(self.doPowerOffRun) self.timeHandler = None if config.usage.poweroff_enabled.value: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler: if self.timeHandler.ready(): self.timeHandler = None self.powerStateTimerChanged() else: self.timeHandler.m_timeUpdated.get().append(self.powerStateTimerChanged)
def __init__(self, session): Screen.__init__(self, session) self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power }, -1) globalActionMap.setEnabled(False) #mute adc self.setMute() self.paused_service = None self.prev_running_service = None self.connected_time_handler = False if self.session.current_dialog: if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS: #get currently playing service reference self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceReference() #stop actual played dvb-service self.session.nav.stopService() elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES: self.paused_service = self.session.current_dialog self.paused_service.pauseService() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose) if config.misc.standbyCounter.value == 0 and config.misc.useTransponderTime.value: th = eDVBLocalTimeHandler.getInstance() if not th.ready(): refstr = config.servicelist.lastmode.value == 'tv' and config.tv.lastservice.value or config.radio.lastservice.value ref = eServiceReference(refstr) if ref.valid(): th.m_timeUpdated.get().append(self.timeReady) self.connected_time_handler = True self.session.nav.playService(ref)
def __init__(self, session): Screen.__init__(self, session) self.avswitch = AVSwitch() print "enter standby" self["actions"] = ActionMap(["StandbyActions"], {"power": self.Power}, -1) globalActionMap.setEnabled(False) #mute adc self.setMute() self.paused_service = None self.prev_running_service = None self.time_handler_conn = False if self.session.current_dialog: if self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_STOPS: #get currently playing service reference self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceReference( ) #stop actual played dvb-service self.session.nav.stopService() elif self.session.current_dialog.ALLOW_SUSPEND == Screen.SUSPEND_PAUSES: self.paused_service = self.session.current_dialog self.paused_service.pauseService() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose) if config.misc.standbyCounter.value == 0 and config.misc.useTransponderTime.value: th = eDVBLocalTimeHandler.getInstance() if not th.ready(): refstr = config.servicelist.lastmode.value == 'tv' and config.tv.lastservice.value or config.radio.lastservice.value ref = eServiceReference(refstr) if ref.valid(): self.time_handler_conn = th.m_timeUpdated.connect( self.timeReady) self.session.nav.playService(ref, False, False)
def __init__(self, session): Screen.__init__(self, session) self.skinName = "Standby" self.avswitch = AVSwitch() print "[Standby] enter standby" if os.path.exists("/usr/scripts/standby_enter.sh"): Console().ePopen("/usr/scripts/standby_enter.sh") self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None self.setMute() if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]: # set LCDminiTV off setLCDMiniTVMode("0") self.paused_service = self.paused_action = False self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() if Components.ParentalControl.parentalControl.isProtected(self.prev_running_service): self.prev_running_service = eServiceReference(config.tv.lastservice.value) service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = hasattr(self.session.current_dialog, "pauseService") and hasattr(self.session.current_dialog, "unPauseService") and self.session.current_dialog or self.infoBarInstance self.paused_action = hasattr(self.paused_service, "seekstate") and hasattr(self.paused_service, "SEEK_STATE_PLAY") and self.paused_service.seekstate == self.paused_service.SEEK_STATE_PLAY self.paused_action and self.paused_service.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session): Screen.__init__(self, session) self.skinName = "Standby" self.avswitch = AVSwitch() print "[Standby] enter standby" if path.exists("/usr/scripts/standby_enter.sh"): Console().ePopen("/usr/scripts/standby_enter.sh") self["actions"] = ActionMap(["StandbyActions"], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None self.setMute() if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]: # set LCDminiTV off setLCDMiniTVMode("0") self.paused_service = self.paused_action = False self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup( ) if Components.ParentalControl.parentalControl.isProtected( self.prev_running_service): self.prev_running_service = eServiceReference( config.tv.lastservice.value) service = self.prev_running_service and self.prev_running_service.toString( ) if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = hasattr( self.session.current_dialog, "pauseService") and hasattr( self.session.current_dialog, "unPauseService" ) and self.session.current_dialog or self.infoBarInstance self.paused_action = hasattr( self.paused_service, "seekstate" ) and hasattr( self.paused_service, "SEEK_STATE_PLAY" ) and self.paused_service.seekstate == self.paused_service.SEEK_STATE_PLAY self.paused_action and self.paused_service.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr( self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") if getBrandOEM() in ('dinobot') or SystemInfo["HasHiSi"]: try: open("/proc/stb/hdmi/output", "w").write("off") except: pass self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def timeReady(self): if self.connected_time_handler: th = eDVBLocalTimeHandler.getInstance() th.m_timeUpdated.get().remove(self.timeReady) self.connected_time_handler = False self.session.nav.stopService()
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print("[Standby] enter standby") SystemInfo["StandbyState"] = True if os.path.exists("/usr/script/standby_enter.sh"): Console().ePopen("/usr/script/standby_enter.sh") self["actions"] = ActionMap(["StandbyActions"], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar from Screens.SleepTimerEdit import isNextWakeupTime self.infoBarInstance = InfoBar.instance self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.standbyWakeupTimer = eTimer() self.standbyWakeupTimer.callback.append(self.standbyWakeup) self.timeHandler = None self.setMute() self.paused_service = self.paused_action = False self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup( ) if Components.ParentalControl.parentalControl.isProtected( self.prev_running_service): self.prev_running_service = eServiceReference( config.tv.lastservice.value) service = self.prev_running_service and self.prev_running_service.toString( ) if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = hasattr( self.session.current_dialog, "pauseService") and hasattr( self.session.current_dialog, "unPauseService" ) and self.session.current_dialog or self.infoBarInstance self.paused_action = hasattr( self.paused_service, "seekstate" ) and hasattr( self.paused_service, "SEEK_STATE_PLAY" ) and self.paused_service.seekstate == self.paused_service.SEEK_STATE_PLAY self.paused_action and self.paused_service.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr( self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") if SystemInfo["HiSilicon"]: try: open("/proc/stb/hdmi/output", "w").write("off") except: pass if SystemInfo["AmlogicFamily"]: try: open("/sys/class/leds/led-sys/brightness", "w").write("0") except: pass try: open("/sys/class/cec/cmd", "w").write("0f 36") except: pass gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) gotoWakeupTime = isNextWakeupTime(True) if gotoWakeupTime != -1: curtime = localtime(time()) if curtime.tm_year > 1970: wakeup_time = int(gotoWakeupTime - time()) if wakeup_time > 0: self.standbyWakeupTimer.startLongTimer(wakeup_time) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "[Standby] enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar from Screens.SleepTimerEdit import isNextWakeupTime self.infoBarInstance = InfoBar.instance self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.standbyWakeupTimer = eTimer() self.standbyWakeupTimer.callback.append(self.standbyWakeup) self.timeHandler = None self.setMute() self.paused_service = self.paused_action = False self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() if Components.ParentalControl.parentalControl.isProtected(self.prev_running_service): self.prev_running_service = eServiceReference(config.tv.lastservice.value) service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = hasattr(self.session.current_dialog, "pauseService") and hasattr(self.session.current_dialog, "unPauseService") and self.session.current_dialog or self.infoBarInstance self.paused_action = hasattr(self.paused_service, "seekstate") and hasattr(self.paused_service, "SEEK_STATE_PLAY") and self.paused_service.seekstate == self.paused_service.SEEK_STATE_PLAY self.paused_action and self.paused_service.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: if config.misc.SyncTimeUsing.value == 0: self.timeHandler.m_timeUpdated.get().append(self.stopService) else: self.standbyStopServiceTimer.startLongTimer(5) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") if (getBrandOEM() in ('fulan')): open("/proc/stb/hdmi/output", "w").write("off") if int(config.usage.hdd_standby_in_standby.value) != -1: # HDD standby timer value (box in standby) / -1 = same as when box is active for hdd in harddiskmanager.HDDList(): hdd[1].setIdleTime(int(config.usage.hdd_standby_in_standby.value)) gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) gotoWakeupTime = isNextWakeupTime(True) if gotoWakeupTime != -1: curtime = localtime(time()) if curtime.tm_year > 1970: wakeup_time = int(gotoWakeupTime - time()) if wakeup_time > 0: self.standbyWakeupTimer.startLongTimer(wakeup_time) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def update_schedule(self, result = None, retval = None, extra_args = None): nowTime = time() print '[NTP]: setting E2 time:',nowTime setRTCtime(nowTime) eDVBLocalTimeHandler.getInstance().setUseDVBTime(False) self.timer.startLongTimer(int(config.misc.useNTPminutes.getValue()) * 60)
def gotTime(self): eDVBLocalTimeHandler.getInstance().m_timeUpdated.get().remove(self.gotTime) self.startTimer()
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "[Standby] enter standby" if os.path.exists("/usr/script/standby_enter.sh"): Console().ePopen("/usr/script/standby_enter.sh") self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar from Screens.SleepTimerEdit import isNextWakeupTime self.infoBarInstance = InfoBar.instance self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.standbyWakeupTimer = eTimer() self.standbyWakeupTimer.callback.append(self.standbyWakeup) self.timeHandler = None self.setMute() self.paused_service = self.paused_action = False self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() if Components.ParentalControl.parentalControl.isProtected(self.prev_running_service): self.prev_running_service = eServiceReference(config.tv.lastservice.value) service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = hasattr(self.session.current_dialog, "pauseService") and hasattr(self.session.current_dialog, "unPauseService") and self.session.current_dialog or self.infoBarInstance self.paused_action = hasattr(self.paused_service, "seekstate") and hasattr(self.paused_service, "SEEK_STATE_PLAY") and self.paused_service.seekstate == self.paused_service.SEEK_STATE_PLAY self.paused_action and self.paused_service.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) gotoWakeupTime = isNextWakeupTime(True) if gotoWakeupTime != -1: curtime = localtime(time()) if curtime.tm_year > 1970: wakeup_time = int(gotoWakeupTime - time()) if wakeup_time > 0: self.standbyWakeupTimer.startLongTimer(wakeup_time) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session): Screen.__init__(self, session) self.skinName = "Standby" self.avswitch = AVSwitch() print "[Standby] enter standby" if getBoxType() in ('ini-7012', 'ini-7012au'): if path.exists("/proc/stb/lcd/symbol_scrambled"): open("/proc/stb/lcd/symbol_scrambled", "w").write("0") if path.exists("/proc/stb/lcd/symbol_1080p"): open("/proc/stb/lcd/symbol_1080p", "w").write("0") if path.exists("/proc/stb/lcd/symbol_1080i"): open("/proc/stb/lcd/symbol_1080i", "w").write("0") if path.exists("/proc/stb/lcd/symbol_720p"): open("/proc/stb/lcd/symbol_720p", "w").write("0") if path.exists("/proc/stb/lcd/symbol_576i"): open("/proc/stb/lcd/symbol_576i", "w").write("0") if path.exists("/proc/stb/lcd/symbol_576p"): open("/proc/stb/lcd/symbol_576p", "w").write("0") if path.exists("/proc/stb/lcd/symbol_hd"): open("/proc/stb/lcd/symbol_hd", "w").write("0") if path.exists("/proc/stb/lcd/symbol_dolby_audio"): open("/proc/stb/lcd/symbol_dolby_audio", "w").write("0") if path.exists("/proc/stb/lcd/symbol_mp3"): open("/proc/stb/lcd/symbol_mp3", "w").write("0") self["actions"] = ActionMap(["StandbyActions"], { "power": self.Power, "discrete_on": self.Power, "deepstandby": self.deepStandby, }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None # mute adc self.setMute() self.paused_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = True self.infoBarInstance.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr(self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() self.videoOff() self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def gotTime(self): eDVBLocalTimeHandler.getInstance().m_timeUpdated.get().remove( self.gotTime) self.startTimer()
def startTimer(self): eDVBLocalTimeHandler.getInstance().m_timeUpdated.get().remove(self.startTimer) self.start() self.startNetworking()
def __init__(self, session): Screen.__init__(self, session) self.skinName = "Standby" self.avswitch = AVSwitch() print "[Standby] enter standby" self["actions"] = ActionMap( [ "StandbyActions" ], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None #mute adc self.setMute() if SystemInfo["Display"] and SystemInfo["LCDMiniTV"]: # set LCDminiTV off setLCDModeMinitTV("0") self.paused_service = None self.prev_running_service = None self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup() service = self.prev_running_service and self.prev_running_service.toString() if service: if service.startswith("1:") and service.rsplit(":", 1)[1].startswith("/"): self.paused_service = self.session.current_dialog self.paused_service.pauseService() else: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: from Screens.InfoBar import InfoBar InfoBar.instance and hasattr(InfoBar.instance, "showPiP") and InfoBar.instance.showPiP() #set input to vcr scart if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") if (getBrandOEM() in ('fulan')): open("/proc/stb/hdmi/output", "w").write("off") if int(config.usage.hdd_standby_in_standby.value) != -1: # HDD standby timer value (box in standby) / -1 = same as when box is active for hdd in harddiskmanager.HDDList(): hdd[1].setIdleTime(int(config.usage.hdd_standby_in_standby.value)) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "[Standby] enter standby" if os.path.exists("/usr/script/standby_enter.sh"): Console().ePopen("/usr/script/standby_enter.sh") self["actions"] = ActionMap(["StandbyActions"], { "power": self.Power, "discrete_on": self.Power }, -1) globalActionMap.setEnabled(False) from Screens.InfoBar import InfoBar self.infoBarInstance = InfoBar.instance self.StandbyCounterIncrease = StandbyCounterIncrease self.standbyTimeoutTimer = eTimer() self.standbyTimeoutTimer.callback.append(self.standbyTimeout) self.standbyStopServiceTimer = eTimer() self.standbyStopServiceTimer.callback.append(self.stopService) self.timeHandler = None self.setMute() self.paused_service = self.paused_action = False self.prev_running_service = self.session.nav.getCurrentlyPlayingServiceOrGroup( ) if Components.ParentalControl.parentalControl.isProtected( self.prev_running_service): self.prev_running_service = eServiceReference( config.tv.lastservice.value) service = self.prev_running_service and self.prev_running_service.toString( ) if service: if service.rsplit(":", 1)[1].startswith("/"): self.paused_service = hasattr( self.session.current_dialog, "pauseService") and hasattr( self.session.current_dialog, "unPauseService" ) and self.session.current_dialog or self.infoBarInstance self.paused_action = hasattr( self.paused_service, "seekstate" ) and hasattr( self.paused_service, "SEEK_STATE_PLAY" ) and self.paused_service.seekstate == self.paused_service.SEEK_STATE_PLAY self.paused_action and self.paused_service.pauseService() if not self.paused_service: self.timeHandler = eDVBLocalTimeHandler.getInstance() if self.timeHandler.ready(): if self.session.nav.getCurrentlyPlayingServiceOrGroup(): self.stopService() else: self.standbyStopServiceTimer.startLongTimer(5) self.timeHandler = None else: self.timeHandler.m_timeUpdated.get().append(self.stopService) if self.session.pipshown: self.infoBarInstance and hasattr( self.infoBarInstance, "showPiP") and self.infoBarInstance.showPiP() if SystemInfo["ScartSwitch"]: self.avswitch.setInput("SCART") else: self.avswitch.setInput("AUX") gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value) if gotoShutdownTime: self.standbyTimeoutTimer.startLongTimer(gotoShutdownTime) self.onFirstExecBegin.append(self.__onFirstExecBegin) self.onClose.append(self.__onClose)