aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-09-14 22:01:49 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-09-14 22:01:49 +0000
commitf5f70f0586875cf34ab93c7abd1cf7165badf399 (patch)
treee09ac49597938625d8034cd1a3e95105e0ce1076 /lib/python
parentc3f3135726277c4030e0049fc6ab774ba81c706a (diff)
downloadenigma2-f5f70f0586875cf34ab93c7abd1cf7165badf399.tar.gz
enigma2-f5f70f0586875cf34ab93c7abd1cf7165badf399.zip
add possibility to get frontend type and frontend number
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/Converter/FrontendInfo.py22
-rw-r--r--lib/python/Components/Sources/FrontendInfo.py32
-rw-r--r--lib/python/Components/Sources/Makefile.am2
3 files changed, 53 insertions, 3 deletions
diff --git a/lib/python/Components/Converter/FrontendInfo.py b/lib/python/Components/Converter/FrontendInfo.py
index d4788b0b..160214a7 100644
--- a/lib/python/Components/Converter/FrontendInfo.py
+++ b/lib/python/Components/Converter/FrontendInfo.py
@@ -7,6 +7,8 @@ class FrontendInfo(Converter, object):
AGC = 2
LOCK = 3
SNRdB = 4
+ SLOT_NUMBER = 5
+ TUNER_TYPE = 6
def __init__(self, type):
Converter.__init__(self, type)
@@ -18,12 +20,16 @@ class FrontendInfo(Converter, object):
self.type = self.SNRdB
elif type == "AGC":
self.type = self.AGC
+ elif type == "NUMBER":
+ self.type = self.SLOT_NUMBER
+ elif type == "TYPE":
+ self.type = self.TUNER_TYPE
else:
self.type = self.LOCK
@cached
def getText(self):
- assert self.type != self.LOCK, "the text output of FrontendInfo cannot be used for lock info"
+ assert self.type not in [self.LOCK, self.SLOT_NUMBER], "the text output of FrontendInfo cannot be used for lock info"
percent = None
if self.type == self.BER: # as count
count = self.source.ber
@@ -40,9 +46,10 @@ class FrontendInfo(Converter, object):
return "%3.02f dB" % (self.source.snr_db / 100.0)
elif self.source.snr is not None: #fallback to normal SNR...
percent = self.source.snr
+ elif self.type == self.TUNER_TYPE:
+ return self.source.frontend_type and self.frontend_type or "Unknown"
if percent is None:
return "N/A"
-
return "%d %%" % (percent * 100 / 65536)
@cached
@@ -69,6 +76,17 @@ class FrontendInfo(Converter, object):
return self.BER or 0
else:
return self.range
+ elif self.type == self.TUNER_TYPE:
+ type = self.source.frontend_type
+ if type == 'DVB-S':
+ return 0
+ elif type == 'DVB-C':
+ return 1
+ elif type == 'DVB-T':
+ return 2
+ return -1
+ elif self.type == self.SLOT_NUMBER:
+ return self.source.slot_number or -1
range = 65536
value = property(getValue)
diff --git a/lib/python/Components/Sources/FrontendInfo.py b/lib/python/Components/Sources/FrontendInfo.py
new file mode 100644
index 00000000..e0df49db
--- /dev/null
+++ b/lib/python/Components/Sources/FrontendInfo.py
@@ -0,0 +1,32 @@
+from Source import Source
+from enigma import eTimer
+
+class FrontendInfo(Source):
+ def __init__(self, service_source = None, frontend_source = None):
+ Source.__init__(self)
+ self.service_source = service_source
+ self.frontend_source = frontend_source
+ self.updateFrontendData()
+
+ def updateFrontendData(self):
+ data = self.getFrontendData()
+ if not data:
+ self.slot_number = self.frontend_type = None
+ else:
+ self.slot_number = data.get("tuner_number")
+ self.frontend_type = data.get("tuner_type")
+ self.changed((self.CHANGED_ALL, ))
+
+ def getFrontendData(self):
+ if self.frontend_source:
+ frontend = self.frontend_source()
+ dict = { }
+ if frontend:
+ frontend.getFrontendData(dict)
+ return dict
+ elif self.service_source:
+ service = self.service_source()
+ feinfo = service and service.frontendInfo()
+ return feinfo and feinfo.getFrontendData()
+ else:
+ return None
diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am
index 0ac22bf4..78d04834 100644
--- a/lib/python/Components/Sources/Makefile.am
+++ b/lib/python/Components/Sources/Makefile.am
@@ -3,4 +3,4 @@ installdir = $(LIBDIR)/enigma2/python/Components/Sources
install_PYTHON = \
__init__.py Clock.py EventInfo.py Source.py List.py CurrentService.py \
FrontendStatus.py Boolean.py Config.py ServiceList.py RdsDecoder.py StreamService.py \
- StaticText.py CanvasSource.py ServiceEvent.py Event.py
+ StaticText.py CanvasSource.py ServiceEvent.py Event.py FrontendInfo.py