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