fix IndentationError
[vuplus_dvbapp-plugin] / epgsearch / src / plugin.py
1 # for localized messages         
2 from . import _
3
4 from enigma import eServiceCenter
5
6 # Config
7 from Components.config import config, ConfigSet, ConfigSubsection, ConfigText
8
9 config.plugins.epgsearch = ConfigSubsection()
10 config.plugins.epgsearch.history = ConfigSet(choices = [])
11 # XXX: configtext is more flexible but we cannot use this for a (not yet created) gui config
12 config.plugins.epgsearch.encoding = ConfigText(default = 'ISO8859-15', fixed_size = False)
13
14 # Plugin
15 from EPGSearch import EPGSearch, EPGSearchEPGSelection, EPGSelectionInit
16
17 # Plugin definition
18 from Plugins.Plugin import PluginDescriptor
19
20 # Mainfunction
21 def main(session, *args, **kwargs):
22         s = session.nav.getCurrentService()
23         info = s.info()
24         event = info.getEvent(0) # 0 = now, 1 = next
25         name = event and event.getEventName() or ''
26         session.open(EPGSearch, name, False)
27
28 # Movielist
29 def movielist(session, service, **kwargs):
30         serviceHandler = eServiceCenter.getInstance()
31         info = serviceHandler.info(service)
32         name = info and info.getName(service) or ''
33
34         session.open(EPGSearch, name)
35
36 # Autostart
37 def autostart(reason, **kwargs):
38         if "session" in kwargs:
39                 session = kwargs["session"]
40                 try: 
41                         EPGSelectionInit() # for blue key activating in EPGSelection
42                 except: pass
43
44
45 def Plugins(**kwargs):
46         return [
47                 PluginDescriptor(
48                         where = PluginDescriptor.WHERE_SESSIONSTART,
49                         fnc = autostart,
50                 ),
51                 PluginDescriptor(
52                         name = "EPGSearch",
53                         description = _("Search EPG"),
54                         where = PluginDescriptor.WHERE_PLUGINMENU,
55                         fnc = main,
56                 ),
57                 PluginDescriptor(
58                         name = _("Search EPG..."),
59                         where = PluginDescriptor.WHERE_EVENTINFO,
60                         fnc = eventinfo,
61                 ),
62                 PluginDescriptor(
63                         name = "EPGSearch",
64                         description = _("Search EPG..."),
65                         where = PluginDescriptor.WHERE_MOVIELIST,
66                         fnc = movielist,
67                 ),
68         ]