aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components/Sources/ServiceList.py
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2006-09-22 16:47:27 +0000
committerFelix Domke <tmbinc@elitedvb.net>2006-09-22 16:47:27 +0000
commitd4c326ff3537c63c2a7fac1fec98fb08bed0f0ee (patch)
treeb41a56b0cdf1e4a32c62720e2c411128578a2458 /lib/python/Components/Sources/ServiceList.py
parent7b55dfbd380cb3c207089cc22ce15b18ce181fc7 (diff)
downloadenigma2-d4c326ff3537c63c2a7fac1fec98fb08bed0f0ee.tar.gz
enigma2-d4c326ff3537c63c2a7fac1fec98fb08bed0f0ee.zip
add servicelist source
Diffstat (limited to 'lib/python/Components/Sources/ServiceList.py')
-rw-r--r--lib/python/Components/Sources/ServiceList.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/python/Components/Sources/ServiceList.py b/lib/python/Components/Sources/ServiceList.py
new file mode 100644
index 00000000..4d184152
--- /dev/null
+++ b/lib/python/Components/Sources/ServiceList.py
@@ -0,0 +1,43 @@
+from Source import Source
+from enigma import eServiceCenter, eServiceReference
+
+class ServiceList(Source):
+ def __init__(self, root, command_func = None):
+ Source.__init__(self)
+ self.root = root
+ self.command_func = command_func
+
+ def getServicesAsList(self, format = "SN"):
+ services = self.getServiceList()
+ return services and services.getContent(format, True)
+
+ def getServiceList(self):
+ serviceHandler = eServiceCenter.getInstance()
+ return serviceHandler.list(self.root)
+
+ def validateReference(self, ref):
+ return ref in self.getServicesAsList("S")
+
+ list = property(getServicesAsList)
+ lut = {"Reference": 0, "Name": 1}
+
+ def getRoot(self):
+ return self.__root
+
+ def setRoot(self, root):
+ assert isinstance(root, eServiceReference)
+ self.__root = root
+ self.changed()
+
+ root = property(getRoot, setRoot)
+
+ def handleCommand(self, cmd):
+ print "ServiceList handle command"
+
+ if not self.validateReference(cmd):
+ print "Service reference did not validate!"
+ return
+
+ ref = eServiceReference(cmd)
+ if self.command_func:
+ self.command_func(ref)