aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Converter/Makefile.am2
-rw-r--r--lib/python/Components/Converter/RadioText.py0
-rw-r--r--lib/python/Components/Converter/RdsInfo.py53
-rw-r--r--lib/python/Components/Sources/Makefile.am2
-rw-r--r--lib/python/Components/Sources/RadioText.py0
-rw-r--r--lib/python/Components/Sources/RdsDecoder.py29
6 files changed, 84 insertions, 2 deletions
diff --git a/lib/python/Components/Converter/Makefile.am b/lib/python/Components/Converter/Makefile.am
index b25a32d8..a5d95f53 100644
--- a/lib/python/Components/Converter/Makefile.am
+++ b/lib/python/Components/Converter/Makefile.am
@@ -3,5 +3,5 @@ installdir = $(LIBDIR)/enigma2/python/Components/Converter
install_PYTHON = \
__init__.py ClockToText.py Converter.py EventName.py StaticText.py EventTime.py \
Poll.py RemainingToText.py StringList.py ServiceName.py FrontendInfo.py ServiceInfo.py \
- ConditionalShowHide.py ServicePosition.py ValueRange.py RadioText.py Streaming.py
+ ConditionalShowHide.py ServicePosition.py ValueRange.py RdsInfo.py Streaming.py
diff --git a/lib/python/Components/Converter/RadioText.py b/lib/python/Components/Converter/RadioText.py
deleted file mode 100644
index e69de29b..00000000
--- a/lib/python/Components/Converter/RadioText.py
+++ /dev/null
diff --git a/lib/python/Components/Converter/RdsInfo.py b/lib/python/Components/Converter/RdsInfo.py
new file mode 100644
index 00000000..3a7b2be3
--- /dev/null
+++ b/lib/python/Components/Converter/RdsInfo.py
@@ -0,0 +1,53 @@
+from enigma import iRdsDecoder, iPlayableService
+from Components.Converter.Converter import Converter
+from Components.Element import cached
+
+class RdsInfo(Converter, object):
+ RASS_INTERACTIVE_AVAILABLE = 0
+ RTP_TEXT_CHANGED = 1
+ RADIO_TEXT_CHANGED = 2
+
+ def __init__(self, type):
+ Converter.__init__(self, type)
+ self.type = {
+ "RadioText": self.RADIO_TEXT_CHANGED,
+ "RtpText": self.RTP_TEXT_CHANGED,
+ "RasInteractiveAvailable": self.RASS_INTERACTIVE_AVAILABLE
+ }[type]
+
+ self.interesting_events = {
+ self.RADIO_TEXT_CHANGED: [iPlayableService.evUpdatedRadioText],
+ self.RTP_TEXT_CHANGED: [iPlayableService.evUpdatedRtpText],
+ self.RASS_INTERACTIVE_AVAILABLE: [iPlayableService.evUpdatedRassInteractivePicMask]
+ }[self.type]
+
+ @cached
+ def getText(self):
+ decoder = self.source.decoder
+ text = ""
+ if decoder:
+ if self.type == self.RADIO_TEXT_CHANGED:
+ text = decoder.getText(iRdsDecoder.RadioText)
+ elif self.type == self.RTP_TEXT_CHANGED:
+ text = decoder.getText(iRdsDecoder.RtpText)
+ else:
+ print "unknown RdsInfo Converter type", self.type
+ return text
+
+ text = property(getText)
+
+ @cached
+ def getBoolean(self):
+ decoder = self.source.decoder
+ if self.type == self.RASS_INTERACTIVE_AVAILABLE:
+ mask = decoder and decoder.getRassInteractiveMask()
+ return (mask and mask[0] & 1 and True) or False
+ elif self.type == self.RADIO_TEXT_CHANGED:
+ return (len(decoder.getText(iRdsDecoder.RadioText)) and True) or False
+ elif self.type == self.RTP_TEXT_CHANGED:
+ return (len(decoder.getText(iRdsDecoder.RtpText)) and True) or False
+ boolean = property(getBoolean)
+
+ def changed(self, what):
+ if what[0] != self.CHANGED_SPECIFIC or what[1] in self.interesting_events:
+ Converter.changed(self, what)
diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am
index 5e6a30a5..b5e16d98 100644
--- a/lib/python/Components/Sources/Makefile.am
+++ b/lib/python/Components/Sources/Makefile.am
@@ -2,5 +2,5 @@ installdir = $(LIBDIR)/enigma2/python/Components/Sources
install_PYTHON = \
__init__.py Clock.py EventInfo.py Source.py MenuList.py CurrentService.py \
- FrontendStatus.py Boolean.py Config.py ServiceList.py RadioText.py StreamService.py \
+ FrontendStatus.py Boolean.py Config.py ServiceList.py RdsDecoder.py StreamService.py \
StaticText.py
diff --git a/lib/python/Components/Sources/RadioText.py b/lib/python/Components/Sources/RadioText.py
deleted file mode 100644
index e69de29b..00000000
--- a/lib/python/Components/Sources/RadioText.py
+++ /dev/null
diff --git a/lib/python/Components/Sources/RdsDecoder.py b/lib/python/Components/Sources/RdsDecoder.py
new file mode 100644
index 00000000..886f81f6
--- /dev/null
+++ b/lib/python/Components/Sources/RdsDecoder.py
@@ -0,0 +1,29 @@
+from Components.PerServiceDisplay import PerServiceBase
+from Components.Element import cached
+from enigma import iPlayableService
+from Source import Source
+
+class RdsDecoder(PerServiceBase, Source, object):
+ def __init__(self, navcore):
+ Source.__init__(self)
+ PerServiceBase.__init__(self, navcore,
+ {
+ iPlayableService.evStart: self.gotEvent,
+ iPlayableService.evUpdatedRadioText: self.gotEvent,
+ iPlayableService.evUpdatedRtpText: self.gotEvent,
+ iPlayableService.evUpdatedRassInteractivePicMask: self.gotEvent,
+ iPlayableService.evEnd: self.gotEvent
+ }, with_event=True)
+
+ @cached
+ def getDecoder(self):
+ service = self.navcore.getCurrentService()
+ return service and service.rdsDecoder()
+
+ decoder = property(getDecoder)
+
+ def gotEvent(self, what):
+ if what in [iPlayableService.evStart, iPlayableService.evEnd]:
+ self.changed((self.CHANGED_CLEAR,))
+ else:
+ self.changed((self.CHANGED_SPECIFIC, what))