add movielist hook (opens with title as searchstring),
[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
13
14 # Plugin definition
15 from Plugins.Plugin import PluginDescriptor
16
17 # Mainfunction
18 def main(session, *args, **kwargs):
19         session.open(EPGSearch)
20
21 # Movielist
22 def movielist(session, service, **kwargs):
23         serviceHandler = eServiceCenter.getInstance()
24         info = serviceHandler.info(service)
25         name = info and info.getName(service) or ''
26
27         session.open(EPGSearch, name)
28
29 # Event Info
30 def eventinfo(session, servicelist, **kwargs):
31         s = session.nav.getCurrentService()
32         info = s.info()
33         event = info.getEvent(0) # 0 = now, 1 = next
34         name = event and event.getEventName() or ''
35
36         session.open(EPGSearch, name)
37
38 def Plugins(**kwargs):
39         return [
40                 PluginDescriptor(
41                         name = "EPGSearch",
42                         description = _("Search EPG"),
43                         where = PluginDescriptor.WHERE_PLUGINMENU,
44                         fnc = main,
45                 ),
46                 PluginDescriptor(
47                         name = _("Search EPG"),
48                         where = PluginDescriptor.WHERE_EVENTINFO,
49                         fnc = eventinfo,
50                 ),
51                 PluginDescriptor(
52                         name = "EPGSearch",
53                         description = _("Search EPG"),
54                         where = PluginDescriptor.WHERE_MOVIELIST,
55                         fnc = movielist,
56                 ),
57         ]