aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Converter/Streaming.py
blob: ece174908084c0ad49fa98786cc1a6f0a65e687e (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
from Converter import Converter
from Components.Element import cached

class Streaming(Converter):
	def __init__(self, type):
		Converter.__init__(self, type)

	@cached
	def getText(self):
		service = self.source.service
		if service is None:
			return "-NO SERVICE"

		streaming = service.stream()
		s = streaming and streaming.getStreamingData()

		if streaming is None:
			err = service.getError()
			return "-1SERVICE ERROR:%d" % err

		r = streaming.getStreamingData()
		if r is None:
			return "-NO STREAM"

		demux = r["demux"]
		pids = ','.join(["%x:%s" % (x[0], x[1]) for x in r["pids"]])

		return "+%d:%s\n" % (demux, pids)

	text = property(getText)