- get rid of custom title source and use builtin Title,
[enigma2-plugins.git] / startuptostandby / src / plugin.py
1 # -*- coding: iso-8859-1 -*-
2 from Plugins.Plugin import PluginDescriptor
3 from Components.config import config, ConfigSubsection, ConfigEnableDisable
4 from Screens.Standby import Standby
5 from StartupToStandbyConfiguration import StartupToStandbyConfiguration
6 from enigma import eTimer
7
8 config.plugins.startuptostandby = ConfigSubsection()
9 config.plugins.startuptostandby.enabled = ConfigEnableDisable(default = False)
10
11 timer = eTimer()
12
13 def main(session, **kwargs):
14         print "[StartupToStandby] Open Config Screen"
15         session.open(StartupToStandbyConfiguration)
16
17 # sessionstart
18 def sessionstart(reason, session = None):
19         print "[StartupToStandby] autostart"
20         if config.plugins.startuptostandby.enabled.value and reason == 0:
21                 open_standby = lambda: setattr(session.open(Standby),'wasMuted', 0)
22                 timer.callback.append(open_standby)
23
24                 session.open(Standby)
25                 # wait 10 seconds before setting standby again -
26                 # bad hack so we do not only have a blank screen but are actually in standby...
27                 print "[StartupToStandby] start timer..."
28                 timer.startLongTimer(10)
29
30 def Plugins(path, **kwargs):
31         return [PluginDescriptor(name="StartupToStandby", description="Startup To Standby", where = PluginDescriptor.WHERE_PLUGINMENU,fnc = main),
32                         PluginDescriptor(name="StartupToStandby", description = "Startup To Standby", where = PluginDescriptor.WHERE_SESSIONSTART,fnc = sessionstart)]
33