disable test-plugin
[vuplus_dvbapp] / lib / python / Plugins / tuxboxplugins / plugin.py
index 1e8d52e..bf78946 100644 (file)
@@ -7,8 +7,44 @@ from Components.Label import Label
 import os
 
 def getPlugins():
-       return [("Tuxbox-Plugin1", "function", "main", 0),
-                       ("Tuxbox-Plugin2", "function", "main", 1)]
+       pluginlist = []
+
+       try:
+               dir = os.listdir("/usr/lib/tuxbox/plugins/")
+       
+               for x in dir:
+                       try:
+                               if x[-3:] == "cfg":
+                                       params = getPluginParams(x)
+                                       pluginlist.append((params["name"], params["desc"], "function", "main", x))
+                       except:
+                               pass
+       except:
+               print "no tuxbox plugins found"
+       return pluginlist
+
+def getPicturePaths():
+       list = []
+       try:
+               dir = os.listdir("/usr/lib/tuxbox/plugins/")
+               for x in dir: list.append("tuxbox.png")
+       except:
+               print "no tuxbox plugins found"
+       return list
+
+def getPluginParams(file):
+       params = {}
+       try:
+               file = open("/usr/lib/tuxbox/plugins/" + file, "r")
+               for x in file.readlines():
+                       split = x.split("=")
+                       params[split[0]] = split[1]
+               file.close()
+       except:
+               print "not tuxbox plugins found"
+
+       return params
 
 def main(session, args):
-       print "Running plugin with number", args
\ No newline at end of file
+       print "Running plugin " + args[:-4] + ".so with config file", args
+       print getPluginParams(args)
\ No newline at end of file