aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Screens/ServiceInfo.py
blob: 10f7b28c58f75c1d5e5318fc53fe4c1c391f725d (plain)
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
from Components.HTMLComponent import *
from Components.GUIComponent import *
from Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.MenuList import MenuList
from ServiceReference import ServiceReference
from enigma import eListboxPythonMultiContent, eListbox, gFont

RT_HALIGN_LEFT = 0

def ServiceInfoListEntry(a, b):
	res = [ ]

	#PyObject *px, *py, *pwidth, *pheight, *pfnt, *pstring, *pflags;
	res.append((0, 0, 200, 30, 0, RT_HALIGN_LEFT, ""))
	res.append((0, 0, 150, 25, 0, RT_HALIGN_LEFT, a))
	res.append((170, 0, 150, 25, 0, RT_HALIGN_LEFT, b))

	return res

class ServiceInfoList(HTMLComponent, GUIComponent):
	def __init__(self, source):
		GUIComponent.__init__(self)
		self.l = eListboxPythonMultiContent()
		self.list = source
		self.l.setList(self.list)
		self.l.setFont(0, gFont("Arial", 23))

	def GUIcreate(self, parent):
		self.instance = eListbox(parent)
		self.instance.setContent(self.l)
		self.instance.setItemHeight(25)

	def GUIdelete(self):
		self.instance.setContent(None)
		self.instance = None

class ServiceInfo(Screen):
	def __init__(self, session):
		Screen.__init__(self, session)

		self["actions"] = ActionMap(["OkCancelActions"],
		{
			"ok": self.close,
			"cancel": self.close
		}, -1)
	
		Labels = ( ("Name",  "ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()"),
				   ("Provider", ),
				   ("VideoPID",""),
				   ("AudioPID",""),
				   ("PCRPID",""),
				   ("PMTPID",""),
				   ("TXTPID",""),
				   ("Videoformat",""),
				   ("TSID",""),
				   ("ONID",""),
				   ("SID",""),
				   ("Namespace",""))
	
		tlist = [ ]

		for item in Labels:
			try:
				value = str(eval(item[1]))
			except:
				value = "N/A"
			tlist.append(ServiceInfoListEntry(item[0]+":", value))		

		self["infolist"] = ServiceInfoList(tlist)