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