+ config.misc.startCounter.value += 1
+
+ profile("readPluginList")
+ plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
+
+ profile("Init:Session")
+ nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value)
+ session = Session(desktop = getDesktop(0), summary_desktop = 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, Screens.InfoBar.InfoBar))
+
+ screensToRun.sort()
+
+ ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)
+
+# eDVBCIInterfaces.getInstance().setDescrambleRules(0 # Slot Number
+# ,( ["1:0:1:24:4:85:C00000:0:0:0:"], #service_list
+# ["PREMIERE"], #provider_list,
+# [] #caid_list
+# ));
+
+ def runNextScreen(session, screensToRun, *result):
+ if result:
+ 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("RunReactor")
+ profile_final()
+ runReactor()
+
+ config.misc.startCounter.save()
+
+ profile("wakeup")
+ from time import time, strftime, localtime
+ from Tools.DreamboxHardware import setFPWakeuptime, getFPWakeuptime, setRTCtime
+ #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))
+ if x[0] != -1
+ ]
+ wakeupList.sort()
+ recordTimerWakeupAuto = False
+ 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)
+ recordTimerWakeupAuto = startTime[1] == 0 and startTime[2]
+ config.misc.isNextRecordTimerAfterEventActionAuto.value = recordTimerWakeupAuto
+ config.misc.isNextRecordTimerAfterEventActionAuto.save()
+
+ profile("stopService")
+ session.nav.stopService()
+ profile("nav shutdown")