[VPS]Update German localization
[enigma2-plugins.git] / vps / src_py / plugin.py
1 from Plugins.Plugin import PluginDescriptor
2 from os import stat
3 from Vps import vps_timers
4 from Vps_setup import VPS_Setup
5 from Modifications import register_vps
6
7 # Config
8 from Components.config import config, ConfigYesNo, ConfigSubsection, ConfigInteger
9
10 config.plugins.vps = ConfigSubsection()
11 config.plugins.vps.enabled = ConfigYesNo(default = True)
12 config.plugins.vps.initial_time = ConfigInteger(default=10, limits=(0, 120))
13 config.plugins.vps.allow_overwrite = ConfigYesNo(default = True)
14 config.plugins.vps.allow_wakeup = ConfigYesNo(default = False)
15 config.plugins.vps.allow_seeking_multiple_pdc = ConfigYesNo(default = True)
16 config.plugins.vps.default_vps = ConfigYesNo(default = False)
17 config.plugins.vps.default_overwrite = ConfigYesNo(default = False)
18 config.plugins.vps.infotext = ConfigInteger(default=0)
19
20
21 def autostart(reason, **kwargs):
22         if reason == 0:
23                 if kwargs.has_key("session"):
24                         session = kwargs["session"]
25                         vps_timers.session = session
26                         vps_timers.checkTimer()
27                 
28                 register_vps()
29         
30         elif reason == 1:
31                 vps_timers.shutdown()
32                 
33
34 def setup(session, **kwargs):
35         session.openWithCallback(doneConfig, VPS_Setup)
36
37 def doneConfig(session, **kwargs):
38         vps_timers.checkTimer()
39
40 def startSetup(menuid):
41         if menuid != "system":
42                 return []
43         return [("VPS-Plugin", setup, "vps", 50)]
44
45 def getNextWakeup():
46         return vps_timers.NextWakeup()
47         
48         
49
50 def Plugins(**kwargs):
51         return [
52                 PluginDescriptor(
53                         name = "VPS",
54                         where = [
55                                 PluginDescriptor.WHERE_AUTOSTART,
56                                 PluginDescriptor.WHERE_SESSIONSTART
57                         ],
58                         fnc = autostart,
59                         wakeupfnc = getNextWakeup
60                 ),
61                 PluginDescriptor(
62                         name = "VPS-Plugin",
63                         where = PluginDescriptor.WHERE_MENU,
64                         fnc = startSetup
65                 ),
66         ]