Beispiel #1
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(config.misc.nextWakeup.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summary_desktop=enigma.getDesktop(1),
                      navigation=nav)

    CiHandler.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()
    print screensToRun

    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)

    def runNextScreen(session, screensToRun, *result):
        if result:
            #print "[mytest.py] quitMainloop #3"
            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)

    if boxtype in ('alien5', 'osninopro', 'osnino', 'osninoplus',
                   'alphatriple', 'spycat4kmini', 'tmtwin4k', 'mbmicrov2',
                   'revo4k', 'force3uhd', 'wetekplay', 'wetekplay2',
                   'wetekhub', 'dm7020hd', 'dm7020hdv2', 'osminiplus',
                   'osmega', 'sf3038', 'spycat', 'e4hd', 'e4hdhybrid',
                   'mbmicro', 'et7500', 'mixosf5', 'mixosf7', 'mixoslumi',
                   'gi9196m', 'maram9', 'ixussone', 'ixusszero', 'uniboxhd1',
                   'uniboxhd2', 'uniboxhd3', 'sezam5000hd', 'mbtwin',
                   'sezam1000hd', 'mbmini', 'atemio5x00', 'beyonwizt3',
                   '9910lx', '9911lx') or getBrandOEM() in (
                       'fulan') or getMachineBuild() in ('dags7362',
                                                         'dags73625', 'dags5'):
        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("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()

    if boxtype in ('sf8', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius',
                   'evo'):
        f = open("/dev/dbox/oled0", "w")
        f.write('-E2-')
        f.close()

    print "lastshutdown=%s		(True = last shutdown was OK)" % config.usage.shutdownOK.value
    print "NOK shutdown action=%s" % config.usage.shutdownNOK_action.value
    print "bootup action=%s" % config.usage.boot_action.value
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal' or not config.usage.boot_action.value == 'normal':
        print "last shutdown = %s" % config.usage.shutdownOK.value
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)

    if not RestoreSettings:
        config.usage.shutdownOK.setValue(False)
        config.usage.shutdownOK.save()
        configfile.save()

    # kill showiframe if it is running (sh4 hack...)
    if getMachineBuild() in ('spark', 'spark7162'):
        os.system("killall -9 showiframe")

    runReactor()

    print "[mytest.py] normal shutdown"
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()

    profile("wakeup")

    #get currentTime
    nowTime = time()
    #	if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
    if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith(
            'gb') or getBrandOEM().startswith('ini'):
        print "dvb time sync disabled... so set RTC now to current linux time!", strftime(
            "%Y/%m/%d %H:%M", localtime(nowTime))
        setRTCtime(nowTime)

    #recordtimer
    if session.nav.isRecordTimerImageStandard:  #check RecordTimer instance
        tmp = session.nav.RecordTimer.getNextRecordingTime(
            getNextStbPowerOn=True)
        nextRecordTime = tmp[0]
        nextRecordTimeInStandby = tmp[1]
    else:
        nextRecordTime = session.nav.RecordTimer.getNextRecordingTime()
        nextRecordTimeInStandby = session.nav.RecordTimer.isNextRecordAfterEventActionAuto(
        )
    #zaptimer
    nextZapTime = session.nav.RecordTimer.getNextZapTime()
    nextZapTimeInStandby = 0
    #powertimer
    tmp = session.nav.PowerTimer.getNextPowerManagerTime(
        getNextStbPowerOn=True)
    nextPowerTime = tmp[0]
    nextPowerTimeInStandby = tmp[1]
    #plugintimer
    tmp = plugins.getNextWakeupTime(getPluginIdent=True)
    nextPluginTime = tmp[0]
    nextPluginIdent = tmp[1]  #"pluginname | pluginfolder"
    tmp = tmp[1].lower()
    #start in standby, depending on plugin type
    if "epgrefresh" in tmp:
        nextPluginName = "EPGRefresh"
        nextPluginTimeInStandby = 1
    elif "vps" in tmp:
        nextPluginName = "VPS"
        nextPluginTimeInStandby = 1
    elif "serienrecorder" in tmp:
        nextPluginName = "SerienRecorder"
        nextPluginTimeInStandby = 0  # plugin function for deep standby from standby not compatible (not available)
    elif "elektro" in tmp:
        nextPluginName = "Elektro"
        nextPluginTimeInStandby = 1
    elif "minipowersave" in tmp:
        nextPluginName = "MiniPowersave"
        nextPluginTimeInStandby = 1
    elif "enhancedpowersave" in tmp:
        nextPluginName = "EnhancedPowersave"
        nextPluginTimeInStandby = 1
    else:
        #default for plugins
        nextPluginName = nextPluginIdent
        nextPluginTimeInStandby = 0

    wakeupList = [
        x for x in ((nextRecordTime, 0, nextRecordTimeInStandby),
                    (nextZapTime, 1, nextZapTimeInStandby),
                    (nextPowerTime, 2, nextPowerTimeInStandby),
                    (nextPluginTime, 3, nextPluginTimeInStandby)) if x[0] != -1
    ]
    wakeupList.sort()

    print "=" * 100
    if wakeupList and wakeupList[0][0] > 0:
        startTime = wakeupList[0]
        # wakeup time before timer begins
        wptime = startTime[0] - (config.workaround.wakeuptime.value * 60)
        if (wptime - nowTime) < 120:  # no time to switch box back on
            wptime = int(nowTime) + 120  # so switch back on in 120 seconds

        #check for plugin-, zap- or power-timer to enable the 'forced' record-timer wakeup
        forceNextRecord = 0
        setStandby = startTime[2]
        if startTime[1] != 0 and nextRecordTime > 0:
            #when next record starts in 15 mins
            if abs(nextRecordTime - startTime[0]) <= 900:
                setStandby = forceNextRecord = 1
            #by vps-plugin
            elif startTime[1] == 3 and nextPluginName == "VPS":
                setStandby = forceNextRecord = 1

        if startTime[1] == 3:
            nextPluginName = " (%s)" % nextPluginName
        else:
            nextPluginName = ""
        print "[mytest.py] set next wakeup type to '%s'%s %s" % (
            {
                0: "record-timer",
                1: "zap-timer",
                2: "power-timer",
                3: "plugin-timer"
            }[startTime[1]], nextPluginName, {
                0: "and starts normal",
                1: "and starts in standby"
            }[setStandby])
        if forceNextRecord:
            print "[mytest.py] set from 'vps-plugin' or just before a 'record-timer' starts, set 'record-timer' wakeup flag"
        print "[mytest.py] set next wakeup time to", strftime(
            "%a, %Y/%m/%d %H:%M:%S", localtime(wptime))
        #set next wakeup
        setFPWakeuptime(wptime)
        #set next standby only after shutdown in deep standby
        if Screens.Standby.quitMainloopCode != 1 and Screens.Standby.quitMainloopCode != 45:
            setStandby = 2  # 0=no standby, but get in standby if wakeup to timer start > 60 sec (not for plugin-timer, here is no standby), 1=standby, 2=no standby, when before was not in deep-standby
        config.misc.nextWakeup.value = "%d,%d,%d,%d,%d,%d,%d" % (
            int(nowTime), wptime, startTime[0], startTime[1], setStandby,
            nextRecordTime, forceNextRecord)
    else:
        config.misc.nextWakeup.value = "%d,-1,-1,0,0,-1,0" % (int(nowTime))
        if not boxtype.startswith(
                'azboxm'
        ):  #skip for Azbox (mini)ME - setting wakeup time to past reboots box
            setFPWakeuptime(int(nowTime) -
                            3600)  #minus one hour -> overwrite old wakeup time
        print "[mytest.py] no set next wakeup time"
    config.misc.nextWakeup.save()
    print "=" * 100

    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()

    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()

    return 0
Beispiel #2
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)

    # 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
Beispiel #3
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
Beispiel #4
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(config.misc.isNextRecordTimerAfterEventActionAuto.value,
                     config.misc.isNextPowerTimerAfterEventActionAuto.value)
    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)

    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("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)

    profile("RunReactor")
    profile_final()
    runReactor()

    profile("wakeup")

    #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),
            (session.nav.PowerTimer.getNextPowerManagerTime(), 3,
             session.nav.PowerTimer.isNextPowerManagerAfterEventActionAuto()))
        if x[0] != -1
    ]
    wakeupList.sort()
    recordTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] != 3:
        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.SyncTimeUsing.value == "0":
            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)
        recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
        print 'recordTimerWakeupAuto', recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
    config.misc.isNextRecordTimerAfterEventActionAuto.save()

    PowerTimerWakeupAuto = False
    if wakeupList and wakeupList[0][1] == 3:
        startTime = wakeupList[0]
        if (startTime[0] - nowTime) < 60:  # no time to switch box back on
            wptime = nowTime + 30  # so switch back on in 30 seconds
        else:
            wptime = startTime[0]
        if not config.misc.SyncTimeUsing.value == "0":
            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 + 60))
        setFPWakeuptime(wptime)
        PowerTimerWakeupAuto = startTime[1] == 3 and startTime[2]
        print 'PowerTimerWakeupAuto', PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.value = PowerTimerWakeupAuto
    config.misc.isNextPowerTimerAfterEventActionAuto.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
Beispiel #5
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)

	# 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
Beispiel #6
0
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
Beispiel #7
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(config.misc.isNextRecordTimerAfterEventActionAuto.value, config.misc.isNextPowerTimerAfterEventActionAuto.value)
	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)

	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("Init:AutoVideoMode")
	import Screens.VideoMode
	Screens.VideoMode.autostart(session)

	profile("RunReactor")
	profile_final()
	runReactor()

	profile("wakeup")

	#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),
					(session.nav.PowerTimer.getNextPowerManagerTime(), 3, session.nav.PowerTimer.isNextPowerManagerAfterEventActionAuto()))
		if x[0] != -1
	]
	wakeupList.sort()
	recordTimerWakeupAuto = False
	if wakeupList and wakeupList[0][1] != 3:
		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 getBrandOEM() == 'gigablue':
				wptime = startTime[0] - 120 # Gigaboxes already starts 2 min. before wakeup time
			else:
				wptime = startTime[0] - 240
		if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
			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)
		recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
		print 'recordTimerWakeupAuto',recordTimerWakeupAuto
	config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
	config.misc.isNextRecordTimerAfterEventActionAuto.save()


	PowerTimerWakeupAuto = False
	if wakeupList and wakeupList[0][1] == 3:
		startTime = wakeupList[0]
		if (startTime[0] - nowTime) < 60: # no time to switch box back on
			wptime = nowTime + 30  # so switch back on in 30 seconds
		else:
			if getBrandOEM() == 'gigablue':
				wptime = startTime[0] + 120 # Gigaboxes already starts 2 min. before wakeup time
			else:
				wptime = startTime[0]
		if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == 'gigablue':
			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+60))
		setFPWakeuptime(wptime)
		PowerTimerWakeupAuto = startTime[1] == 3 and startTime[2]
		print 'PowerTimerWakeupAuto',PowerTimerWakeupAuto
	config.misc.isNextPowerTimerAfterEventActionAuto.value = PowerTimerWakeupAuto
	config.misc.isNextPowerTimerAfterEventActionAuto.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
Beispiel #9
0
def runScreenTest():
    def runNextScreen(session, screensToRun, *result):
        if result:
            print("[StartEnigma] Exiting via quitMainloop #3.")
            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
    profile("ReadPluginList")
    enigma.pauseInit()
    plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
    enigma.resumeInit()
    profile("Init:Session")
    nav = Navigation(config.misc.nextWakeup.value)
    session = Session(desktop=enigma.getDesktop(0),
                      summaryDesktop=enigma.getDesktop(1),
                      navigation=nav)
    CiHandler.setSession(session)
    from Screens.SwapManager import SwapAutostart
    SwapAutostart()
    profile("InitWizards")
    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()
    print(screensToRun)
    enigma.ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)
    if not RestoreSettings:
        runNextScreen(session, screensToRun)
    profile("InitVolumeControl")
    vol = VolumeControl(session)
    profile("InitPowerKey")
    power = PowerKey(session)
    if boxtype in (
            "alien5", "osninopro", "osnino", "osninoplus", "alphatriple",
            "spycat4kmini", "tmtwin4k", "mbmicrov2", "revo4k", "force3uhd",
            "wetekplay", "wetekplay2", "wetekhub", "dm7020hd", "dm7020hdv2",
            "osminiplus", "osmega", "sf3038", "spycat", "e4hd", "e4hdhybrid",
            "mbmicro", "et7500", "mixosf5", "mixosf7", "mixoslumi", "gi9196m",
            "maram9", "ixussone", "ixusszero", "uniboxhd1", "uniboxhd2",
            "uniboxhd3", "sezam5000hd", "mbtwin", "sezam1000hd", "mbmini",
            "atemio5x00", "beyonwizt3", "9910lx", "9911lx", "9920lx",
            "dual") or getBrandOEM() in ("fulan", ) or getMachineBuild() in (
                "u41", "dags7362", "dags73625", "dags5", "ustym4kpro",
                "beyonwizv2", "viper4k", "sf8008", "sf8008m", "sf8008opt",
                "cc1", "gbmv200", "sfx6008"):
        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("InitTrashcan")
    import Tools.Trashcan
    Tools.Trashcan.init(session)
    profile("Init:AutoVideoMode")
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)
    profile("Init:VolumeAdjust")
    import Screens.VolumeAdjust
    Screens.VolumeAdjust.autostart(session)
    profile("RunReactor")
    profile_final()
    if boxtype in ("sf8", "classm", "axodin", "axodinc", "starsatlx", "genius",
                   "evo"):
        f = open("/dev/dbox/oled0", "w")
        f.write("-E2-")
        f.close()
    print("[StartEnigma] Last shutdown=%s.  (True = last shutdown was OK.)" %
          config.usage.shutdownOK.value)
    print("[StartEnigma] NOK shutdown action=%s." %
          config.usage.shutdownNOK_action.value)
    print("[StartEnigma] Boot action=%s." % config.usage.boot_action.value)
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == "normal" or not config.usage.boot_action.value == "normal":
        print("[StartEnigma] Last shutdown=%s." %
              config.usage.shutdownOK.value)
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)
    if not RestoreSettings:
        config.usage.shutdownOK.setValue(False)
        config.usage.shutdownOK.save()
        configfile.save()
    # Kill showiframe if it is running.  (sh4 hack...)
    if getMachineBuild() in ("spark", "spark7162"):
        os.system("killall -9 showiframe")
    runReactor()
    print("[StartEnigma] Normal shutdown.")
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()
    profile("Wakeup")
    nowTime = time()  # Get currentTime.
    # if not config.misc.SyncTimeUsing.value == "0" or getBrandOEM() == "gigablue":
    if not config.misc.SyncTimeUsing.value == "0" or boxtype.startswith(
            "gb") or getBrandOEM().startswith("ini"):
        print(
            "[StartEnigma] DVB time sync disabled, so set RTC now to current Linux time!  (%s)"
            % strftime("%Y/%m/%d %H:%M", localtime(nowTime)))
        setRTCtime(nowTime)
    # Record timer.
    if session.nav.isRecordTimerImageStandard:  # Check RecordTimer instance.
        tmp = session.nav.RecordTimer.getNextRecordingTime(
            getNextStbPowerOn=True)
        nextRecordTime = tmp[0]
        nextRecordTimeInStandby = tmp[1]
    else:
        nextRecordTime = session.nav.RecordTimer.getNextRecordingTime()
        nextRecordTimeInStandby = session.nav.RecordTimer.isNextRecordAfterEventActionAuto(
        )
    # Zap timer.
    nextZapTime = session.nav.RecordTimer.getNextZapTime()
    nextZapTimeInStandby = 0
    # Power timer.
    tmp = session.nav.PowerTimer.getNextPowerManagerTime(
        getNextStbPowerOn=True)
    nextPowerTime = tmp[0]
    nextPowerTimeInStandby = tmp[1]
    # Plugin timer.
    tmp = plugins.getNextWakeupTime(getPluginIdent=True)
    nextPluginTime = tmp[0]
    nextPluginIdent = tmp[1]  # "pluginname | pluginfolder"
    tmp = tmp[1].lower()
    # Start in standby, depending on plugin type.
    if "epgrefresh" in tmp:
        nextPluginName = "EPGRefresh"
        nextPluginTimeInStandby = 1
    elif "vps" in tmp:
        nextPluginName = "VPS"
        nextPluginTimeInStandby = 1
    elif "serienrecorder" in tmp:
        nextPluginName = "SerienRecorder"
        nextPluginTimeInStandby = 0  # Plugin function for deep standby from standby not compatible (not available).
    elif "elektro" in tmp:
        nextPluginName = "Elektro"
        nextPluginTimeInStandby = 1
    elif "minipowersave" in tmp:
        nextPluginName = "MiniPowersave"
        nextPluginTimeInStandby = 1
    elif "enhancedpowersave" in tmp:
        nextPluginName = "EnhancedPowersave"
        nextPluginTimeInStandby = 1
    else:
        # Default for plugins.
        nextPluginName = nextPluginIdent
        nextPluginTimeInStandby = 0
    wakeupList = [
        x for x in ((nextRecordTime, 0, nextRecordTimeInStandby),
                    (nextZapTime, 1, nextZapTimeInStandby),
                    (nextPowerTime, 2, nextPowerTimeInStandby),
                    (nextPluginTime, 3, nextPluginTimeInStandby)) if x[0] != -1
    ]
    wakeupList.sort()
    print("=" * 100)
    if wakeupList and wakeupList[0][0] > 0:
        startTime = wakeupList[0]
        # Wakeup time before timer begins.
        wptime = startTime[0] - (config.workaround.wakeuptime.value * 60)
        if (wptime - nowTime) < 120:  # No time to switch box back on.
            wptime = int(nowTime) + 120  # So switch back on in 120 seconds.
        # Check for plugin-, zap- or power-timer to enable the 'forced' record-timer wakeup.
        forceNextRecord = 0
        setStandby = startTime[2]
        if startTime[1] != 0 and nextRecordTime > 0:
            # When next record starts in 15 mins.
            if abs(nextRecordTime - startTime[0]) <= 900:
                setStandby = forceNextRecord = 1
            # By vps-plugin.
            elif startTime[1] == 3 and nextPluginName == "VPS":
                setStandby = forceNextRecord = 1
        if startTime[1] == 3:
            nextPluginName = " (%s)" % nextPluginName
        else:
            nextPluginName = ""
        print("[StartEnigma] Set next wakeup type to '%s'%s %s" %
              ({
                  0: "record-timer",
                  1: "zap-timer",
                  2: "power-timer",
                  3: "plugin-timer"
              }[startTime[1]], nextPluginName, {
                  0: "and starts normal",
                  1: "and starts in standby"
              }[setStandby]))
        if forceNextRecord:
            print(
                "[StartEnigma] Set from 'vps-plugin' or just before a 'record-timer' starts, set 'record-timer' wakeup flag."
            )
        print("[StartEnigma] Set next wakeup time to %s." %
              strftime("%a, %Y/%m/%d %H:%M:%S", localtime(wptime)))
        # Set next wakeup.
        setFPWakeuptime(wptime)
        # Set next standby only after shutdown in deep standby.
        if Screens.Standby.quitMainloopCode != 1 and Screens.Standby.quitMainloopCode != 45:
            setStandby = 2  # 0=no standby, but get in standby if wakeup to timer start > 60 sec (not for plugin-timer, here is no standby), 1=standby, 2=no standby, when before was not in deep-standby.
        config.misc.nextWakeup.value = "%d,%d,%d,%d,%d,%d,%d" % (
            int(nowTime), wptime, startTime[0], startTime[1], setStandby,
            nextRecordTime, forceNextRecord)
    else:
        config.misc.nextWakeup.value = "%d,-1,-1,0,0,-1,0" % (int(nowTime))
        if not boxtype.startswith(
                "azboxm"
        ):  # Skip for Azbox (mini)ME - setting wakeup time to past reboots box.
            setFPWakeuptime(
                int(nowTime) -
                3600)  # Minus one hour -> overwrite old wakeup time.
        print("[StartEnigma] No next wakeup time set.")
    config.misc.nextWakeup.save()
    print("=" * 100)
    profile("stopService")
    session.nav.stopService()
    profile("nav shutdown")
    session.nav.shutdown()
    profile("configfile.save")
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()
    return 0
Beispiel #10
0
def runScreenTest():
    config.misc.startCounter.value += 1
    config.misc.startCounter.save()
    if config.usage.async_plug_load.value and os.path.isfile(
            '/usr/lib/enigma2/python/Plugins/SystemPlugins/EGAMIPluginSpeedUp/plugin.pyo'
    ):
        profile('readBaseList')
        plugins.loadBasePlugins(resolveFilename(SCOPE_PLUGINS))
    else:
        profile('readPluginList')
        enigma.pauseInit()
        plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
        enigma.resumeInit()
    profile('Init:Session')
    nav = Navigation(config.misc.nextWakeup.value)
    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:
            print '[mytest.py] quitMainloop #3'
            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)

    runNextScreen(session, screensToRun)
    profile('Init:VolumeControl')
    vol = VolumeControl(session)
    profile('Init:PowerKey')
    power = PowerKey(session)
    if boxtype in (
            'ustym4kpro', 'sf8008', 'clap4k', 'alien5', 'osninopro', 'osnino',
            'osninoplus', 'alphatriple', 'spycat4kmini', 'tmtwin4k',
            'mbmicrov2', 'revo4k', 'force3uhd', 'wetekplay', 'wetekplay2',
            'wetekhub', 'dm7020hd', 'dm7020hdv2', 'osminiplus', 'osmega',
            'sf3038', 'spycat', 'e4hd', 'e4hdhybrid', 'mbmicro', 'et7500',
            'mixosf5', 'mixosf7', 'mixoslumi', 'gi9196m', 'maram9', 'ixussone',
            'ixusszero', 'uniboxhd1', 'uniboxhd2', 'uniboxhd3', 'sezam5000hd',
            'mbtwin', 'sezam1000hd', 'mbmini', 'atemio5x00', 'beyonwizt3',
            '9910lx', '9911lx',
            '9920lx') or getBrandOEM() in 'fulan' or getMachineBuild() in (
                'dags7362', 'dags73625', 'dags5'):
        profile('VFDSYMBOLS')
        import Components.VfdSymbols
        Components.VfdSymbols.SymbolsCheck(session)
    session.scart = AutoScartControl(session)
    profile('Init:Trashcan')
    import Tools.Trashcan
    Tools.Trashcan.init(session)
    profile('Init:AutoVideoMode')
    import Screens.VideoMode
    Screens.VideoMode.autostart(session)
    profile('RunReactor')
    profile_final()
    if boxtype in ('sf8', 'classm', 'axodin', 'axodinc', 'starsatlx', 'genius',
                   'evo'):
        f = open('/dev/dbox/oled0', 'w')
        f.write('-E2-')
        f.close()
    print 'lastshutdown=%s\t\t(True = last shutdown was OK)' % config.usage.shutdownOK.value
    print 'NOK shutdown action=%s' % config.usage.shutdownNOK_action.value
    print 'bootup action=%s' % config.usage.boot_action.value
    if not config.usage.shutdownOK.value and not config.usage.shutdownNOK_action.value == 'normal' or not config.usage.boot_action.value == 'normal':
        print 'last shutdown = %s' % config.usage.shutdownOK.value
        import Screens.PowerLost
        Screens.PowerLost.PowerLost(session)
    config.usage.shutdownOK.setValue(False)
    config.usage.shutdownOK.save()
    configfile.save()
    runReactor()
    print '[mytest.py] normal shutdown'
    config.misc.startCounter.save()
    config.usage.shutdownOK.setValue(True)
    config.usage.shutdownOK.save()
    profile('wakeup')
    nowTime = time()
    if not config.misc.SyncTimeUsing.value == '0' or boxtype.startswith(
            'gb') or getBrandOEM().startswith('ini'):
        print 'dvb time sync disabled... so set RTC now to current linux time!', strftime(
            '%Y/%m/%d %H:%M', localtime(nowTime))
        setRTCtime(nowTime)
    if session.nav.isRecordTimerImageStandard:
        tmp = session.nav.RecordTimer.getNextRecordingTime(
            getNextStbPowerOn=True)
        nextRecordTime = tmp[0]
        nextRecordTimeInStandby = tmp[1]
    else:
        nextRecordTime = session.nav.RecordTimer.getNextRecordingTime()
        nextRecordTimeInStandby = session.nav.RecordTimer.isNextRecordAfterEventActionAuto(
        )
    nextZapTime = session.nav.RecordTimer.getNextZapTime()
    nextZapTimeInStandby = 0
    tmp = session.nav.PowerTimer.getNextPowerManagerTime(
        getNextStbPowerOn=True)
    nextPowerTime = tmp[0]
    nextPowerTimeInStandby = tmp[1]
    tmp = plugins.getNextWakeupTime(getPluginIdent=True)
    nextPluginTime = tmp[0]
    nextPluginIdent = tmp[1]
    tmp = tmp[1].lower()
    if 'epgrefresh' in tmp:
        nextPluginName = 'EPGRefresh'
        nextPluginTimeInStandby = 1
    elif 'vps' in tmp:
        nextPluginName = 'VPS'
        nextPluginTimeInStandby = 1
    elif 'serienrecorder' in tmp:
        nextPluginName = 'SerienRecorder'
        nextPluginTimeInStandby = 0
    elif 'elektro' in tmp:
        nextPluginName = 'Elektro'
        nextPluginTimeInStandby = 1
    elif 'minipowersave' in tmp:
        nextPluginName = 'MiniPowersave'
        nextPluginTimeInStandby = 1
    elif 'enhancedpowersave' in tmp:
        nextPluginName = 'EnhancedPowersave'
        nextPluginTimeInStandby = 1
    else:
        nextPluginName = nextPluginIdent
        nextPluginTimeInStandby = 0
    wakeupList = [
        x for x in ((nextRecordTime, 0, nextRecordTimeInStandby),
                    (nextZapTime, 1, nextZapTimeInStandby),
                    (nextPowerTime, 2, nextPowerTimeInStandby),
                    (nextPluginTime, 3, nextPluginTimeInStandby)) if x[0] != -1
    ]
    wakeupList.sort()
    print '=' * 100
    if wakeupList and wakeupList[0][0] > 0:
        startTime = wakeupList[0]
        wptime = startTime[0] - config.workaround.wakeuptime.value * 60
        if wptime - nowTime < 120:
            wptime = int(nowTime) + 120
        forceNextRecord = 0
        setStandby = startTime[2]
        if startTime[1] != 0 and nextRecordTime > 0:
            if abs(nextRecordTime - startTime[0]) <= 900:
                setStandby = forceNextRecord = 1
            elif startTime[1] == 3 and nextPluginName == 'VPS':
                setStandby = forceNextRecord = 1
        if startTime[1] == 3:
            nextPluginName = ' (%s)' % nextPluginName
        else:
            nextPluginName = ''
        print "[mytest.py] set next wakeup type to '%s'%s %s" % (
            {
                0: 'record-timer',
                1: 'zap-timer',
                2: 'power-timer',
                3: 'plugin-timer'
            }[startTime[1]], nextPluginName, {
                0: 'and starts normal',
                1: 'and starts in standby'
            }[setStandby])
        if forceNextRecord:
            print "[mytest.py] set from 'vps-plugin' or just before a 'record-timer' starts, set 'record-timer' wakeup flag"
        print '[mytest.py] set next wakeup time to', strftime(
            '%a, %Y/%m/%d %H:%M:%S', localtime(wptime))
        setFPWakeuptime(wptime)
        if Screens.Standby.quitMainloopCode != 1 and Screens.Standby.quitMainloopCode != 45:
            setStandby = 2
        config.misc.nextWakeup.value = '%d,%d,%d,%d,%d,%d,%d' % (
            int(nowTime), wptime, startTime[0], startTime[1], setStandby,
            nextRecordTime, forceNextRecord)
    else:
        config.misc.nextWakeup.value = '%d,-1,-1,0,0,-1,0' % int(nowTime)
        if not boxtype.startswith('azboxm'):
            setFPWakeuptime(int(nowTime) - 3600)
        print '[mytest.py] no set next wakeup time'
    config.misc.nextWakeup.save()
    print '=' * 100
    profile('stopService')
    session.nav.stopService()
    profile('nav shutdown')
    session.nav.shutdown()
    profile('configfile.save')
    configfile.save()
    from Screens import InfoBarGenerics
    InfoBarGenerics.saveResumePoints()
    return 0