/
plugin.py
76 lines (68 loc) · 2.02 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from enigma import eServiceCenter
# Plugin
from EPGSearch import EPGSearch, EPGSearchEPGSelection, EPGSelectionInit, ChannelSelectionBaseInit, EventViewBaseInit, pzyP4TInit
# Plugin definition
from Plugins.Plugin import PluginDescriptor
# Autostart
def autostart(reason, **kwargs):
if reason == 0:
try:
# for blue and audio key activating in EPG-Screens
EPGSelectionInit()
ChannelSelectionBaseInit()
EventViewBaseInit()
pzyP4TInit()
except Exception:
import traceback
traceback.print_exc()
# Mainfunction
def main(session, *args, **kwargs):
s = session.nav.getCurrentService()
if s:
info = s.info()
event = info.getEvent(0) # 0 = now, 1 = next
name = event and event.getEventName() or ''
session.open(EPGSearch, name)
else:
session.open(EPGSearch)
# Event Info
def eventinfo(session, *args, **kwargs):
ref = session.nav.getCurrentlyPlayingServiceReference()
session.open(EPGSearchEPGSelection, ref, True)
# Movielist
def movielist(session, service, **kwargs):
serviceHandler = eServiceCenter.getInstance()
info = serviceHandler.info(service)
name = info and info.getName(service) or ''
session.open(EPGSearch, name)
def Plugins(**kwargs):
return [
PluginDescriptor(
where = PluginDescriptor.WHERE_AUTOSTART,
fnc = autostart,
needsRestart = False,
),
PluginDescriptor(
name = "EPGSearch",
# TRANSLATORS: description of EPGSearch in PluginBrowser
description = _("Search EPG"),
where = PluginDescriptor.WHERE_PLUGINMENU,
fnc = main,
icon = "EPGSearch.png",
needsRestart = False,
),
PluginDescriptor(
# TRANSLATORS: EPGSearch title in EventInfo dialog (requires the user to select an event to search for)
name = _("search EPG..."),
where = PluginDescriptor.WHERE_EVENTINFO,
fnc = eventinfo,
needsRestart = False,
),
PluginDescriptor(
# TRANSLATORS: EPGSearch title in MovieList (does not require further user interaction)
description = _("search EPG"),
where = PluginDescriptor.WHERE_MOVIELIST,
fnc = movielist,
needsRestart = False,
),
]