Converter/ServicePosition.py: fix order of inheritance to fix suspend handling
[enigma2.git] / lib / python / Components / Converter / Streaming.py
index ece174908084c0ad49fa98786cc1a6f0a65e687e..0c0d274cfba677607a6a3b327065deb364eb9067 100644 (file)
@@ -1,29 +1,32 @@
 from Converter import Converter
 from Components.Element import cached
 
-class Streaming(Converter):
-       def __init__(self, type):
-               Converter.__init__(self, type)
+# the protocol works as the following:
+
+# lines starting with '-' are fatal errors (no recovery possible),
+# lines starting with '=' are progress notices,
+# lines starting with '+' are PIDs to record:
+#      "+d:[p:t[,p:t...]]" with d=demux nr, p: pid, t: type
 
+class Streaming(Converter):
        @cached
        def getText(self):
                service = self.source.service
                if service is None:
-                       return "-NO SERVICE"
+                       return "-NO SERVICE\n"
 
                streaming = service.stream()
                s = streaming and streaming.getStreamingData()
 
-               if streaming is None:
+               if s is None:
                        err = service.getError()
-                       return "-1SERVICE ERROR:%d" % err
-
-               r = streaming.getStreamingData()
-               if r is None:
-                       return "-NO STREAM"
+                       if err:
+                               return "-SERVICE ERROR:%d\n" % err
+                       else:
+                               return "=NO STREAM\n"
 
-               demux = r["demux"]
-               pids = ','.join(["%x:%s" % (x[0], x[1]) for x in r["pids"]])
+               demux = s["demux"]
+               pids = ','.join(["%x:%s" % (x[0], x[1]) for x in s["pids"]])
 
                return "+%d:%s\n" % (demux, pids)