aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Converter/ServiceInfo.py
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-06-26 21:10:10 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-06-26 21:10:10 +0000
commit77bb53beb46f6984e1529c4f703523c146956d0f (patch)
tree5f6d1c9e9be93e3fe9e9f9d3ac8f896434d7d2c7 /lib/python/Components/Converter/ServiceInfo.py
parentd279cc40f4a1d927ad00bfe7b0ee3a303e9aed44 (diff)
downloadenigma2-77bb53beb46f6984e1529c4f703523c146956d0f.tar.gz
enigma2-77bb53beb46f6984e1529c4f703523c146956d0f.zip
add Boolean source, add ServiceInfo boolean sources, add ConditionalShowHide converter, add FixedLabel and Pixmap renderer
Diffstat (limited to 'lib/python/Components/Converter/ServiceInfo.py')
-rw-r--r--lib/python/Components/Converter/ServiceInfo.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/python/Components/Converter/ServiceInfo.py b/lib/python/Components/Converter/ServiceInfo.py
new file mode 100644
index 00000000..413aa191
--- /dev/null
+++ b/lib/python/Components/Converter/ServiceInfo.py
@@ -0,0 +1,63 @@
+from Components.Converter.Converter import Converter
+from enigma import iServiceInformation, iPlayableService
+
+class ServiceInfo(Converter, object):
+ HAS_TELETEXT = 0
+ IS_MULTICHANNEL = 1
+ IS_CRYPTED = 2
+ IS_WIDESCREEN = 3
+ SUBSERVICES_AVAILABLE = 4
+
+ def __init__(self, type, *args, **kwargs):
+ Converter.__init__(self)
+ self.type = {
+ "HasTelext": self.HAS_TELETEXT,
+ "IsMultichannel": self.IS_MULTICHANNEL,
+ "IsCrypted": self.IS_CRYPTED,
+ "IsWidescreen": self.IS_WIDESCREEN,
+ "SubservicesAvailable": self.SUBSERVICES_AVAILABLE,
+ }[type]
+
+ self.interesting_events = {
+ self.HAS_TELETEXT: [iPlayableService.evEnd, iPlayableService.evUpdatedInfo],
+ self.IS_MULTICHANNEL: [iPlayableService.evUpdatedInfo, iPlayableService.evEnd],
+ self.IS_CRYPTED: [iPlayableService.evUpdatedInfo, iPlayableService.evEnd],
+ self.IS_WIDESCREEN: [iPlayableService.evUpdatedEventInfo, iPlayableService.evEnd],
+ self.SUBSERVICES_AVAILABLE: [iPlayableService.evUpdatedEventInfo, iPlayableService.evEnd]
+ }[self.type]
+
+ def getServiceInfoValue(self, info, what):
+ v = info.getInfo(what)
+ if v != -2:
+ return "N/A"
+ return info.getInfoString(what)
+
+ def getBoolean(self):
+ service = self.source.service
+ info = service and service.info()
+ if not info:
+ return False
+
+ if self.type == self.HAS_TELETEXT:
+ tpid = info.getInfo(iServiceInformation.sTXTPID)
+ return tpid != -1
+ elif self.type == self.IS_MULTICHANNEL:
+ # FIXME. but currently iAudioTrackInfo doesn't provide more information.
+ audio = service.audioTracks()
+ if audio:
+ n = audio.getNumberOfTracks()
+ for x in range(n):
+ i = audio.getTrackInfo(x)
+ description = i.getDescription();
+ if description.find("AC3") != -1 or description.find("DTS") != -1:
+ return True
+ return False
+ elif self.type == self.IS_CRYPTED:
+ return info.getInfo(iServiceInformation.sIsCrypted) == 1
+ elif self.type == self.IS_WIDESCREEN:
+ return info.getInfo(iServiceInformation.sAspect) in [3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10]
+ elif self.type == self.SUBSERVICES_AVAILABLE:
+ subservices = service.subServices()
+ return subservices and subservices.getNumberOfSubservices() > 0
+
+ boolean = property(getBoolean)