add stream client gui info
authorDima73 <Dima-73@inbox.lv>
Sun, 6 Dec 2015 18:04:10 +0000 (20:04 +0200)
committerDima73 <Dima-73@inbox.lv>
Sun, 6 Dec 2015 18:04:10 +0000 (20:04 +0200)
-add stream info for skin_display_et8500.xml

Navigation.py
data/skin_default/icons/Makefile.am
data/skin_default/icons/stream.png [new file with mode: 0644]
data/skin_display_et8500.xml
lib/python/Components/Converter/ClientsStreaming.py [new file with mode: 0644]
lib/python/Components/Converter/Makefile.am

index 8cf798c..02c641e 100644 (file)
@@ -1,4 +1,4 @@
-from enigma import eServiceCenter, eServiceReference, eTimer, pNavigation, getBestPlayableServiceReference, iPlayableService, eActionMap, setPreferredTuner
+from enigma import eServiceCenter, eServiceReference, eTimer, pNavigation, getBestPlayableServiceReference, iPlayableService, eActionMap, setPreferredTuner, eStreamServer
 from Components.ParentalControl import parentalControl
 from Components.SystemInfo import SystemInfo
 from Components.config import config, configfile
@@ -182,3 +182,6 @@ class Navigation:
 
        def stopUserServices(self):
                self.stopService()
+
+       def getClientsStreaming(self):
+               return eStreamServer.getInstance() and eStreamServer.getInstance().getConnectedClients()
index 742b1fe..12c6112 100644 (file)
@@ -105,6 +105,7 @@ dist_install_DATA = \
        repzaprecclock_post.png \
        repzaprecclock_pre.png \
        repzaprecclock_prepost.png \
+       stream.png \
        scan-c.png \
        scan-s.png \
        scan-t.png \
diff --git a/data/skin_default/icons/stream.png b/data/skin_default/icons/stream.png
new file mode 100644 (file)
index 0000000..69faabb
Binary files /dev/null and b/data/skin_default/icons/stream.png differ
index 7caa211..1630df6 100644 (file)
                <widget source="session.CurrentService" render="Picon" zPosition="13" position="224,394" size="242,142" transparent="1" alphatest="blend">
                        <convert type="ServiceName">Reference</convert>
                </widget>
+               <widget source="session.CurrentService" render="Pixmap" pixmap="skin_default/icons/stream.png" foregroundColor="#ff0000" size="60,50"  position="60,400" zPosition="1" alphatest="blend" >
+                       <convert type="ClientsStreaming"/>
+                       <convert type="ConditionalShowHide"/>
+               </widget>
                <widget source="session.HddSleepingState" render="Pixmap" pixmap="skin_default/icons/hdd.png" foregroundColor="#ff0000" size="50,60"  position="600,400" zPosition="1" alphatest="blend" >
                        <convert type="ConditionalShowHide"/>
                </widget>
                <widget source="session.RecordState" render="FixedLabel" text="&#174;" position="600,470" foregroundColor="#ff0000" size="80,80" font="FdLcD;80" halign="center" valign="center" zPosition="1">
                        <convert type="ConditionalShowHide">Blink</convert>
                </widget>
+               <widget source="session.CurrentService" render="Pixmap" pixmap="skin_default/icons/stream.png" foregroundColor="#ff0000" size="60,50"  position="60,400" zPosition="1" alphatest="blend" >
+                       <convert type="ClientsStreaming"/>
+                       <convert type="ConditionalShowHide"/>
+               </widget>
                <widget source="session.HddSleepingState" render="Pixmap" pixmap="skin_default/icons/hdd.png" foregroundColor="#ff0000" size="50,60"  position="600,400" zPosition="1" alphatest="blend" >
                        <convert type="ConditionalShowHide"/>
                </widget>
diff --git a/lib/python/Components/Converter/ClientsStreaming.py b/lib/python/Components/Converter/ClientsStreaming.py
new file mode 100644 (file)
index 0000000..52f6435
--- /dev/null
@@ -0,0 +1,96 @@
+from Converter import Converter
+from Poll import Poll
+from Components.Element import cached
+from enigma import eStreamServer
+from ServiceReference import ServiceReference
+
+class ClientsStreaming(Converter, Poll, object):
+       REF = 0
+       IP = 1
+       NAME = 2
+       ENCODER = 3
+       NUMBEP = 4
+       SHORT_ALL = 5
+       ALL = 6
+
+       def __init__(self, type):
+               Converter.__init__(self, type)
+               Poll.__init__(self)
+               self.poll_interval = 30000
+               self.poll_enabled = True
+               if type == "REF":
+                       self.type = self.REF
+               elif type == "IP":
+                       self.type = self.IP
+               elif type == "NAME":
+                       self.type = self.NAME
+               elif type == "ENCODER":
+                       self.type = self.ENCODER
+               elif type == "NUMBEP":
+                       self.type = self.NUMBEP
+               elif type == "SHORT_ALL":
+                       self.type = self.SHORT_ALL
+               else:
+                       self.type = self.ALL
+               self.streamServer = eStreamServer.getInstance()
+
+       @cached
+       def getText(self):
+               if self.streamServer is None:
+                       return ""
+               clients = []
+               refs = []
+               ips = []
+               names = []
+               encoders = []
+               for x in self.streamServer.getConnectedClients():
+                       refs.append((x[1]))
+                       servicename = ServiceReference(x[1]).getServiceName() or ""
+                       service_name = servicename.replace('\xc2\x86', '').replace('\xc2\x87', '')
+                       names.append((service_name))
+                       if '::ffff:' in x[0]:
+                               ip = 'ipv6'
+                               ips.append((ip))
+                       else:
+                               ip = x[0]#[7:]
+                               ips.append((ip))
+                       if int(x[2]) == 0:
+                               encoder = _('NO')
+                       else:
+                               encoder = _('YES')
+                       encoders.append((encoder))
+                       clients.append((ip, service_name, encoder))
+               if not clients:
+                       return ""
+               if self.type == self.REF:
+                       return ' '.join(refs)
+               elif self.type == self.IP:
+                       return ' '.join(ips)
+               elif self.type  == self.NAME:
+                       return ' '.join(names)
+               elif self.type == self.ENCODER:
+                       return _("Transcoding: ") + ' '.join(encoders)
+               elif self.type == self.NUMBEP:
+                       return str(len(clients))
+               elif self.type == self.SHORT_ALL:
+                       return _("Total clients streaming: %d (%s)") % (len(clients), ' '.join(names))
+               else:
+                       return '\n'.join(' '.join(elems) for elems in clients)
+               return ""
+
+       text = property(getText)
+
+       @cached
+       def getBoolean(self):
+               if self.streamServer is None:
+                       return False
+               return self.streamServer.getConnectedClients() and True or False
+
+       boolean = property(getBoolean)
+
+       def changed(self, what):
+               Converter.changed(self, (self.CHANGED_POLL,))
+
+       def doSuspend(self, suspended):
+               pass
+
index b9329d9..d63a609 100644 (file)
@@ -6,6 +6,6 @@ install_PYTHON = \
        ConditionalShowHide.py ServicePosition.py ValueRange.py RdsInfo.py Streaming.py \
        StaticMultiList.py ServiceTime.py MovieInfo.py MenuEntryCompare.py StringListSelection.py \
        ServiceOrbitalPosition.py CryptoInfo.py TextCase.py \
-       ValueBitTest.py TunerInfo.py ConfigEntryTest.py TemplatedMultiContent.py ProgressToText.py \
+       ValueBitTest.py TunerInfo.py ConfigEntryTest.py ClientsStreaming.py TemplatedMultiContent.py ProgressToText.py \
        Combine.py SensorToText.py ValueToPixmap.py PliExtraInfo.py genre.py TransponderInfo.py \
        RotorPosition.py