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" 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 runScreenTest(): config.misc.startCounter.value += 1 config.misc.startCounter.save() profile("readPluginList") enigma.pauseInit() plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) enigma.resumeInit() profile("Init:Session") nav = Navigation() session = Session(desktop=enigma.getDesktop(0), summary_desktop=enigma.getDesktop(1), navigation=nav) CiHandler.setSession(session) screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ] profile("wizards") screensToRun += wizardManager.getWizards() screensToRun.append((100, InfoBar.InfoBar)) screensToRun.sort() enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey) def runNextScreen(session, screensToRun, *result): if result: enigma.quitMainloop(*result) return screen = screensToRun[0][1] args = screensToRun[0][2:] if screensToRun: session.openWithCallback( boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args) else: session.open(screen, *args) config.misc.epgcache_filename.addNotifier(setEPGCachePath) runNextScreen(session, screensToRun) profile("Init:VolumeControl") vol = VolumeControl(session) profile("Init:PowerKey") power = PowerKey(session) # we need session.scart to access it from within menu.xml session.scart = AutoScartControl(session) profile("Init:Trashcan") import Tools.Trashcan Tools.Trashcan.init(session) profile("RunReactor") profile_final() runReactor() profile("wakeup") from time import time, strftime, localtime from Tools.StbHardware import setFPWakeuptime, setRTCtime from Screens.SleepTimerEdit import isNextWakeupTime #get currentTime nowTime = time() wakeupList = [ x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0), (session.nav.RecordTimer.getNextZapTime(isWakeup=True), 1), (plugins.getNextWakeupTime(), 2), (isNextWakeupTime(), 3)) if x[0] != -1 ] wakeupList.sort() if wakeupList: from time import strftime startTime = wakeupList[0] if (startTime[0] - nowTime) < 270: # no time to switch box back on wptime = nowTime + 30 # so switch back on in 30 seconds else: wptime = startTime[0] - 240 if not config.misc.useTransponderTime.value: print "dvb time sync disabled... so set RTC now to current linux time!", strftime( "%Y/%m/%d %H:%M", localtime(nowTime)) setRTCtime(nowTime) print "set wakeup time to", strftime("%Y/%m/%d %H:%M", localtime(wptime)) setFPWakeuptime(wptime) config.misc.prev_wakeup_time.value = int(startTime[0]) config.misc.prev_wakeup_time_type.value = startTime[1] config.misc.prev_wakeup_time_type.save() else: config.misc.prev_wakeup_time.value = 0 config.misc.prev_wakeup_time.save() profile("stopService") session.nav.stopService() profile("nav shutdown") session.nav.shutdown() profile("configfile.save") configfile.save() from Screens import InfoBarGenerics InfoBarGenerics.saveResumePoints() return 0
def runScreenTest(): config.misc.startCounter.value += 1 config.misc.startCounter.save() profile("readPluginList") enigma.pauseInit() plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) enigma.resumeInit() profile("Init:Session") nav = Navigation() session = Session(desktop=enigma.getDesktop(0), summary_desktop=enigma.getDesktop(1), navigation=nav) CiHandler.setSession(session) screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ] profile("wizards") screensToRun += wizardManager.getWizards() screensToRun.append((100, InfoBar.InfoBar)) screensToRun.sort() enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey) def runNextScreen(session, screensToRun, *result): if result: enigma.quitMainloop(*result) return screen = screensToRun[0][1] args = screensToRun[0][2:] if screensToRun: session.openWithCallback( boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args) else: session.open(screen, *args) config.misc.epgcache_filename.addNotifier(setEPGCachePath) runNextScreen(session, screensToRun) profile("Init:VolumeControl") vol = VolumeControl(session) profile("Init:PowerKey") power = PowerKey(session) from enigma import getBoxType if SystemInfo in [ "FirstCheckModel", "SecondCheckModel", "ThirdCheckModel", "DifferentLCDSettings" ] or getBoxType() in ("alphatriplehd", "tmtwin4k", "osminiplus", "sf3038", "spycat", "et7x00", "ebox5000", "ebox7358", "eboxlumi", "maram9", "sezam5000hd", "mbtwin", "sezam1000hd", "mbmini", "atemio5x00", "beyonwizt3", "dinoboth265", "axashistwin"): profile("VFDSYMBOLS") import Components.VfdSymbols Components.VfdSymbols.SymbolsCheck(session) # we need session.scart to access it from within menu.xml session.scart = AutoScartControl(session) profile("Init:Trashcan") import Tools.Trashcan Tools.Trashcan.init(session) profile("RunReactor") profile_final() runReactor() profile("wakeup") from time import strftime, localtime from Tools.StbHardware import setFPWakeuptime, setRTCtime from Screens.SleepTimerEdit import isNextWakeupTime #get currentTime nowTime = time() wakeupList = [ x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0), (session.nav.RecordTimer.getNextZapTime(isWakeup=True), 1), (plugins.getNextWakeupTime(), 2), (isNextWakeupTime(), 3)) if x[0] != -1 ] wakeupList.sort() if wakeupList: from time import strftime from enigma import getBoxBrand startTime = wakeupList[0] if (startTime[0] - nowTime) < 270: # no time to switch box back on wptime = nowTime + 30 # so switch back on in 30 seconds else: if getBoxBrand() == 'gigablue': wptime = startTime[ 0] - 120 # GigaBlue already starts 2 min. before wakeup time else: wptime = startTime[0] - 240 if not config.misc.SyncTimeUsing.value == "0" or getBoxBrand( ) == 'gigablue': print( "[mytest] dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime))) setRTCtime(nowTime) print("[mytest] set wakeup time to", strftime("%Y/%m/%d %H:%M", localtime(wptime))) setFPWakeuptime(wptime) config.misc.prev_wakeup_time.value = int(startTime[0]) config.misc.prev_wakeup_time_type.value = startTime[1] config.misc.prev_wakeup_time_type.save() else: config.misc.prev_wakeup_time.value = 0 config.misc.prev_wakeup_time.save() profile("stopService") session.nav.stopService() profile("nav shutdown") session.nav.shutdown() profile("configfile.save") configfile.save() from Screens import InfoBarGenerics InfoBarGenerics.saveResumePoints() return 0
def __init__(self, session, StandbyCounterIncrease=True): Screen.__init__(self, session) self.avswitch = AVSwitch() print "[Standby] enter standby" self["actions"] = ActionMap( ["StandbyActions"], { "power": self.Power, "power_make": self.Power_make, "power_break": self.Power_break, "power_long": self.Power_long, "power_repeat": self.Power_repeat, "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.ignoreKeyBreakTimer = eTimer() 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) self.timeHandler = None 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 runScreenTest(): config.misc.startCounter.value += 1 config.misc.startCounter.save() profile("readPluginList") enigma.pauseInit() plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) enigma.resumeInit() profile("Init:Session") nav = Navigation() session = Session(desktop = enigma.getDesktop(0), summary_desktop = enigma.getDesktop(1), navigation = nav) CiHandler.setSession(session) screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ] profile("wizards") screensToRun += wizardManager.getWizards() screensToRun.append((100, InfoBar.InfoBar)) screensToRun.sort() enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey) def runNextScreen(session, screensToRun, *result): if result: enigma.quitMainloop(*result) return screen = screensToRun[0][1] args = screensToRun[0][2:] if screensToRun: session.openWithCallback(boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args) else: session.open(screen, *args) config.misc.epgcache_filename.addNotifier(setEPGCachePath) runNextScreen(session, screensToRun) profile("Init:VolumeControl") vol = VolumeControl(session) profile("Init:PowerKey") power = PowerKey(session) # we need session.scart to access it from within menu.xml session.scart = AutoScartControl(session) profile("Init:Trashcan") import Tools.Trashcan Tools.Trashcan.init(session) profile("RunReactor") profile_final() runReactor() profile("wakeup") from time import time, strftime, localtime from Tools.StbHardware import setFPWakeuptime, setRTCtime from Screens.SleepTimerEdit import isNextWakeupTime #get currentTime nowTime = time() wakeupList = [ x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0), (session.nav.RecordTimer.getNextZapTime(isWakeup=True), 1), (plugins.getNextWakeupTime(), 2), (isNextWakeupTime(), 3)) if x[0] != -1 ] wakeupList.sort() if wakeupList: from time import strftime startTime = wakeupList[0] if (startTime[0] - nowTime) < 270: # no time to switch box back on wptime = nowTime + 30 # so switch back on in 30 seconds else: wptime = startTime[0] - 240 if not config.misc.useTransponderTime.value: print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime)) setRTCtime(nowTime) print "set wakeup time to", strftime("%Y/%m/%d %H:%M", localtime(wptime)) setFPWakeuptime(wptime) config.misc.prev_wakeup_time.value = int(startTime[0]) config.misc.prev_wakeup_time_type.value = startTime[1] config.misc.prev_wakeup_time_type.save() else: config.misc.prev_wakeup_time.value = 0 config.misc.prev_wakeup_time.save() profile("stopService") session.nav.stopService() profile("nav shutdown") session.nav.shutdown() profile("configfile.save") configfile.save() from Screens import InfoBarGenerics InfoBarGenerics.saveResumePoints() return 0
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 runScreenTest(): config.misc.startCounter.value += 1 profile("readPluginList") enigma.pauseInit() plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) enigma.resumeInit() profile("Init:Session") nav = Navigation( config.misc.isNextRecordTimerAfterEventActionAuto.getValue()) session = Session(desktop=enigma.getDesktop(0), summary_desktop=enigma.getDesktop(1), navigation=nav) CiHandler.setSession(session) powerOffTimer.setSession(session) profile("wizards") screensToRun = [] RestoreSettings = None if os.path.exists("/media/hdd/images/config/settings" ) and config.misc.firstrun.value: if autorestoreLoop(): RestoreSettings = True from Plugins.SystemPlugins.SoftwareManager.BackupRestore import RestoreScreen session.open(RestoreScreen, runRestore=True) else: screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ] screensToRun += wizardManager.getWizards() else: if os.path.exists("/media/hdd/images/config/autorestore"): os.system('rm -f /media/hdd/images/config/autorestore') screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ] screensToRun += wizardManager.getWizards() screensToRun.append((100, InfoBar.InfoBar)) screensToRun.sort() enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey) def runNextScreen(session, screensToRun, *result): if result: enigma.quitMainloop(*result) return screen = screensToRun[0][1] args = screensToRun[0][2:] if screensToRun: session.openWithCallback( boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args) else: session.open(screen, *args) config.misc.epgcache_filename.addNotifier(setEPGCachePath) if not RestoreSettings: runNextScreen(session, screensToRun) profile("Init:VolumeControl") vol = VolumeControl(session) profile("Init:PowerKey") power = PowerKey(session) # we need session.scart to access it from within menu.xml session.scart = AutoScartControl(session) profile("Init:Trashcan") import Tools.Trashcan Tools.Trashcan.init(session) profile("RunReactor") profile_final() if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal': print("last shutdown = %s" % config.usage.shutdownOK.value) if not RestoreSettings: config.usage.shutdownOK.setValue(False) config.usage.shutdownOK.save() configfile.save() runReactor() config.misc.startCounter.save() config.usage.shutdownOK.setValue(True) config.usage.shutdownOK.save() profile("wakeup") try: from Plugins.SystemPlugins.VFDControl.plugin import SetTime SetTime() except: print "[mytest] Failed SetTime from VFDControl !!" from time import time, strftime, localtime from Tools.StbHardware import setFPWakeuptime, setRTCtime from Screens.SleepTimerEdit import isNextWakeupTime #get currentTime nowTime = time() wakeupList = [ x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0, session.nav.RecordTimer.isNextRecordAfterEventActionAuto()), (session.nav.RecordTimer.getNextZapTime(), 1), (plugins.getNextWakeupTime(), 2), (isNextWakeupTime(), 3)) if x[0] != -1 ] wakeupList.sort() recordTimerWakeupAuto = False if wakeupList: from time import strftime, altzone, timezone startTime = wakeupList[0] if (startTime[0] - nowTime) < 270: # no time to switch box back on wptime = nowTime + 30 # so switch back on in 30 seconds else: wptime = startTime[0] - 120 if not config.misc.useTransponderTime.value: print "[mytest] dvb time sync disabled... so set RTC now to current linux time!", strftime( "%Y/%m/%d %H:%M", localtime(nowTime)) setRTCtime(nowTime) print "[StartEnigma] Set wakeup time to", strftime( "%Y/%m/%d %H:%M", localtime(wptime)) setFPWakeuptime(wptime) recordTimerWakeupAuto = startTime[1] == 0 and startTime[2] print '[mytest] recordTimerWakeupAuto', recordTimerWakeupAuto config.misc.prev_wakeup_time.value = startTime[0] config.misc.prev_wakeup_time_type.value = startTime[1] config.misc.prev_wakeup_time_type.save() else: config.misc.prev_wakeup_time.value = 0 config.misc.prev_wakeup_time.save() config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto config.misc.isNextRecordTimerAfterEventActionAuto.save() profile("stopService") session.nav.stopService() profile("nav shutdown") session.nav.shutdown() profile("configfile.save") configfile.save() from Screens import InfoBarGenerics InfoBarGenerics.saveResumePoints() return 0
def runScreen(): def runNextScreen(session, screensToRun, *result): if result: enigma.quitMainloop(*result) return screen = screensToRun[0][1] args = screensToRun[0][2:] if screensToRun: session.openWithCallback(boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args) else: session.open(screen, *args) config.misc.startCounter.value += 1 config.misc.startCounter.save() profile("ReadPluginList") enigma.pauseInit() plugins.readPluginList(resolveFilename(SCOPE_PLUGINS)) enigma.resumeInit() profile("InitSession") nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value, config.misc.isNextPowerTimerAfterEventActionAuto.value) # Wake up to standby for RecordTimer and PowerTimer. session = Session(desktop=enigma.getDesktop(0), summaryDesktop=enigma.getDesktop(1), navigation=nav) CiHandler.setSession(session) screensToRun = [x.__call__ for x in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD)] profile("InitWizards") screensToRun += wizardManager.getWizards() screensToRun.append((100, InfoBar.InfoBar)) screensToRun.sort() enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey) config.misc.epgcache_filename.addNotifier(setEPGCachePath) runNextScreen(session, screensToRun) profile("InitVolumeControl") vol = VolumeControl(session) profile("InitPowerKey") power = PowerKey(session) if BoxInfo.getItem("VFDSymbol"): profile("VFDSymbols") import Components.VfdSymbols Components.VfdSymbols.SymbolsCheck(session) session.scart = AutoScartControl(session) # We need session.scart to access it from within menu.xml. profile("InitTrashcan") import Tools.Trashcan Tools.Trashcan.init(session) profile("RunReactor") profileFinal() runReactor() profile("Wakeup") from Tools.StbHardware import setFPWakeuptime, setRTCtime from Screens.SleepTimerEdit import isNextWakeupTime powerTimerWakeupAuto = False recordTimerWakeupAuto = False nowTime = time() # Get current time. powerTimerList = sorted( [x for x in ((session.nav.RecordTimer.getNextRecordingTime(), 0, session.nav.RecordTimer.isNextRecordAfterEventActionAuto()), (session.nav.RecordTimer.getNextZapTime(isWakeup=True), 1), (plugins.getNextWakeupTime(), 2), (session.nav.PowerTimer.getNextPowerManagerTime(), 3, session.nav.PowerTimer.isNextPowerManagerAfterEventActionAuto())) if x[0] != -1] ) sleepTimerList = sorted( [x for x in ( (session.nav.RecordTimer.getNextRecordingTime(), 0), (session.nav.RecordTimer.getNextZapTime(isWakeup=True), 1), (plugins.getNextWakeupTime(), 2), (isNextWakeupTime(), 3) ) if x[0] != -1] ) if sleepTimerList: startSleepTime = sleepTimerList[0] if (startSleepTime[0] - nowTime) < 270: # No time to switch box back on. wakeupTime = nowTime + 30 # So switch back on in 30 seconds. else: if brand == "gigablue": wakeupTime = startSleepTime[0] - 120 # GigaBlue already starts 2 min. before wakeup time. else: wakeupTime = startSleepTime[0] - 240 if not config.ntp.timesync.value == "dvb": setRTCtime(nowTime) setFPWakeuptime(wakeupTime) if powerTimerList and powerTimerList[0][1] == 3: startTimePowerList = powerTimerList[0] if (startTimePowerList[0], nowTime) < 60: # No time to switch box back on. wakeupTime = nowTime + 30 # So switch back on in 30 seconds. else: wakeupTime = startTimePowerList[0] if not config.ntp.timesync.value == "dvb": setRTCtime(nowTime) setFPWakeuptime(wakeupTime) powerTimerWakeupAuto = startTimePowerList[1] == 3 and startTimePowerList[2] config.misc.isNextPowerTimerAfterEventActionAuto.value = powerTimerWakeupAuto config.misc.isNextPowerTimerAfterEventActionAuto.save() if powerTimerList and powerTimerList[0][1] != 3: startTimePowerList = powerTimerList[0] if (startTimePowerList[0], nowTime) < 270: # No time to switch box back on. wakeupTime = nowTime + 30 # So switch back on in 30 seconds. else: wakeupTime = (startTimePowerList[0], 240) if not config.ntp.timesync.value == "dvb": setRTCtime(nowTime) setFPWakeuptime(wakeupTime) recordTimerWakeupAuto = startTimePowerList[1] == 0 and startTimePowerList[2] config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto config.misc.isNextRecordTimerAfterEventActionAuto.save() profile("StopNavService") session.nav.stopService() profile("NavShutdown") session.nav.shutdown() profile("SaveConfigfile") configfile.save() from Screens import InfoBarGenerics InfoBarGenerics.saveResumePoints() return 0