update all non-master listboxes when any listbox changes
[enigma2.git] / lib / python / Components / Converter / Streaming.py
1 from Converter import Converter
2 from Components.Element import cached
3
4 # the protocol works as the following:
5
6 # lines starting with '-' are fatal errors (no recovery possible),
7 # lines starting with '=' are progress notices,
8 # lines starting with '+' are PIDs to record:
9 #       "+d:[p:t[,p:t...]]" with d=demux nr, p: pid, t: type
10
11 class Streaming(Converter):
12         def __init__(self, type):
13                 Converter.__init__(self, type)
14
15         @cached
16         def getText(self):
17                 service = self.source.service
18                 if service is None:
19                         return "-NO SERVICE\n"
20
21                 streaming = service.stream()
22                 s = streaming and streaming.getStreamingData()
23
24                 if s is None:
25                         err = service.getError()
26                         if err:
27                                 return "-SERVICE ERROR:%d\n" % err
28                         else:
29                                 return "=NO STREAM\n"
30
31                 demux = s["demux"]
32                 pids = ','.join(["%x:%s" % (x[0], x[1]) for x in s["pids"]])
33
34                 return "+%d:%s\n" % (demux, pids)
35
36         text = property(getText)