fsck_mainmenu by Moritz Venn
[enigma2.git] / lib / python / Components / Converter / Streaming.py
1 from Converter import Converter
2 from Components.Element import cached
3
4 class Streaming(Converter):
5         def __init__(self, type):
6                 Converter.__init__(self, type)
7
8         @cached
9         def getText(self):
10                 service = self.source.service
11                 if service is None:
12                         return "-NO SERVICE"
13
14                 streaming = service.stream()
15                 s = streaming and streaming.getStreamingData()
16
17                 if streaming is None:
18                         err = service.getError()
19                         return "-1SERVICE ERROR:%d" % err
20
21                 r = streaming.getStreamingData()
22                 if r is None:
23                         return "-NO STREAM"
24
25                 demux = r["demux"]
26                 pids = ','.join(["%x:%s" % (x[0], x[1]) for x in r["pids"]])
27
28                 return "+%d:%s\n" % (demux, pids)
29
30         text = property(getText)