aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-10-10 19:54:15 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-10-10 19:54:15 +0000
commitb5ca0a1b4676eea8cf2fd9966634cac73bd46e5b (patch)
tree2d00aed56854f146d065b812f209732fbf97a4bf /lib/python/Components
parent870022b905170f39bc9d26b38c5288ce45e69103 (diff)
downloadenigma2-b5ca0a1b4676eea8cf2fd9966634cac73bd46e5b.tar.gz
enigma2-b5ca0a1b4676eea8cf2fd9966634cac73bd46e5b.zip
show radio (rds) text when available... feel free to make it nicer
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Converter/Makefile.am2
-rw-r--r--lib/python/Components/Converter/RadioText.py15
-rw-r--r--lib/python/Components/Sources/Makefile.am2
-rw-r--r--lib/python/Components/Sources/RadioText.py28
4 files changed, 45 insertions, 2 deletions
diff --git a/lib/python/Components/Converter/Makefile.am b/lib/python/Components/Converter/Makefile.am
index 8b7d3a2b..e754a683 100644
--- a/lib/python/Components/Converter/Makefile.am
+++ b/lib/python/Components/Converter/Makefile.am
@@ -3,4 +3,4 @@ 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
+ ConditionalShowHide.py ServicePosition.py ValueRange.py RadioText.py
diff --git a/lib/python/Components/Converter/RadioText.py b/lib/python/Components/Converter/RadioText.py
new file mode 100644
index 00000000..77ec58ed
--- /dev/null
+++ b/lib/python/Components/Converter/RadioText.py
@@ -0,0 +1,15 @@
+from Components.Converter.Converter import Converter
+from Components.Element import cached
+
+class RadioText(Converter, object):
+ def __init__(self, type):
+ Converter.__init__(self, type)
+
+ @cached
+ def getText(self):
+ rt = self.source.radiotext
+ if rt is None:
+ return "N/A"
+ return rt
+
+ text = property(getText)
diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am
index a1609840..16513e82 100644
--- a/lib/python/Components/Sources/Makefile.am
+++ b/lib/python/Components/Sources/Makefile.am
@@ -2,4 +2,4 @@ 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
+ FrontendStatus.py Boolean.py Config.py ServiceList.py RadioText.py
diff --git a/lib/python/Components/Sources/RadioText.py b/lib/python/Components/Sources/RadioText.py
new file mode 100644
index 00000000..6faad317
--- /dev/null
+++ b/lib/python/Components/Sources/RadioText.py
@@ -0,0 +1,28 @@
+from Components.PerServiceDisplay import PerServiceBase
+from Components.Element import cached
+from enigma import iPlayableService
+from Source import Source
+
+class RadioText(PerServiceBase, Source, object):
+ def __init__(self, navcore):
+ Source.__init__(self)
+ PerServiceBase.__init__(self, navcore,
+ {
+ iPlayableService.evStart: self.gotEvent,
+ iPlayableService.evUpdatedRadioText: self.gotEvent,
+ iPlayableService.evEnd: self.gotEvent
+ }, with_event=True)
+
+ @cached
+ def getText(self):
+ service = self.navcore.getCurrentService()
+ info = service and service.radioText()
+ return info and info.getRadioText()
+
+ radiotext = property(getText)
+
+ def gotEvent(self, what):
+ if what in [iPlayableService.evStart, iPlayableService.evEnd]:
+ self.changed((self.CHANGED_CLEAR,))
+ else:
+ self.changed((self.CHANGED_ALL,))