add basic webif hook to force scan -> http(s)://<ip or hostname>/autotimer?parse
[enigma2-plugins.git] / 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 # Autostart
21 def autostart(reason, **kwargs):
22         if "session" in kwargs:
23                 try:
24                         # for blue key activating in EPGSelection
25                         EPGSelectionInit()
26                 except:
27                         pass
28
29 # Mainfunction
30 def main(session, *args, **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         session.open(EPGSearch, name, False)
36
37 # Event Info
38 def eventinfo(session, *args, **kwargs):
39         ref = session.nav.getCurrentlyPlayingServiceReference()
40         session.open(EPGSearchEPGSelection, ref, True)
41
42 # Movielist
43 def movielist(session, service, **kwargs):
44         serviceHandler = eServiceCenter.getInstance()
45         info = serviceHandler.info(service)
46         name = info and info.getName(service) or ''
47
48         session.open(EPGSearch, name)
49
50 def Plugins(**kwargs):
51         return [
52                 PluginDescriptor(
53                         where = PluginDescriptor.WHERE_SESSIONSTART,
54                         fnc = autostart,
55                 ),
56                 PluginDescriptor(
57                         name = "EPGSearch",
58                         description = _("Search EPG"),
59                         where = PluginDescriptor.WHERE_PLUGINMENU,
60                         fnc = main,
61                 ),
62                 PluginDescriptor(
63                         name = _("Search EPG..."),
64                         where = PluginDescriptor.WHERE_EVENTINFO,
65                         fnc = eventinfo,
66                 ),
67                 PluginDescriptor(
68                         name = "EPGSearch",
69                         description = _("Search EPG..."),
70                         where = PluginDescriptor.WHERE_MOVIELIST,
71                         fnc = movielist,
72                 ),
73         ]