1 from Components.HTMLComponent import *
2 from Components.GUIComponent import *
3 from Screen import Screen
4 from Components.ActionMap import ActionMap
5 from Components.Label import Label
6 from Components.MenuList import MenuList
7 from ServiceReference import ServiceReference
8 from enigma import eListboxPythonMultiContent, eListbox, gFont, iServiceInformation
12 def ServiceInfoListEntry(a, b):
15 #PyObject *type, *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags;
16 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 200, 30, 0, RT_HALIGN_LEFT, ""))
17 res.append((eListboxPythonMultiContent.TYPE_TEXT, 0, 0, 150, 25, 0, RT_HALIGN_LEFT, a))
18 res.append((eListboxPythonMultiContent.TYPE_TEXT, 170, 0, 150, 25, 0, RT_HALIGN_LEFT, b))
22 class ServiceInfoList(HTMLComponent, GUIComponent):
23 def __init__(self, source):
24 GUIComponent.__init__(self)
25 self.l = eListboxPythonMultiContent()
27 self.l.setList(self.list)
28 self.l.setFont(0, gFont("Regular", 23))
30 def GUIcreate(self, parent):
31 self.instance = eListbox(parent)
32 self.instance.setContent(self.l)
33 self.instance.setItemHeight(25)
36 self.instance.setContent(None)
39 class ServiceInfo(Screen):
40 def __init__(self, session):
41 Screen.__init__(self, session)
43 self["actions"] = ActionMap(["OkCancelActions"],
49 service = session.nav.getCurrentService()
50 if service is not None:
51 self.info = service.info()
55 if self.session.nav.getCurrentlyPlayingServiceReference() is not None:
56 name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
59 Labels = ( ("Name", name),
60 ("Provider", self.getValue(iServiceInformation.sProvider)),
61 ("VideoPID", self.getValue(iServiceInformation.sVideoPID)),
62 ("AudioPID", self.getValue(iServiceInformation.sAudioPID)),
63 ("PCRPID", self.getValue(iServiceInformation.sPCRPID)),
64 ("PMTPID", self.getValue(iServiceInformation.sPMTPID)),
65 ("TXTPID", self.getValue(iServiceInformation.sTXTPID)),
66 ("Videoformat", self.getValue(iServiceInformation.sAspect)),
67 ("TSID", self.getValue(iServiceInformation.sTSID)),
68 ("ONID", self.getValue(iServiceInformation.sONID)),
69 ("SID", self.getValue(iServiceInformation.sSID)),
70 ("Namespace", self.getValue(iServiceInformation.sNamespace)))
76 tlist.append(ServiceInfoListEntry(item[0]+":", value))
78 self["infolist"] = ServiceInfoList(tlist)
80 def getValue(self, what):
84 v = self.info.getInfo(what)
86 v = self.info.getInfoString(what)
88 if what in [iServiceInformation.sVideoPID,
89 iServiceInformation.sAudioPID, iServiceInformation.sPCRPID, iServiceInformation.sPMTPID,
90 iServiceInformation.sTXTPID, iServiceInformation.sTSID, iServiceInformation.sONID,
91 iServiceInformation.sSID]:
92 v = "0x%04x (%dd)" % (v, v)
93 elif what in [iServiceInformation.sNamespace]: