finish the tuxbox plugin parser plugin
[enigma2.git] / lib / python / Plugins / tuxboxplugins / plugin.py
index 1e8d52ee6502f968ec5df63ff60cbf6dbc07c503..65f7a86336f9f800274a3a395a9ccdf505737e6b 100644 (file)
@@ -7,8 +7,26 @@ from Components.Label import Label
 import os
 
 def getPlugins():
 import os
 
 def getPlugins():
-       return [("Tuxbox-Plugin1", "function", "main", 0),
-                       ("Tuxbox-Plugin2", "function", "main", 1)]
+       dir = os.listdir("/usr/lib/tuxbox/plugins/")
+       
+       pluginlist = []
+       for x in dir:
+               try:
+                       if x[-3:] == "cfg":
+                               pluginlist.append((getPluginParams(x)["name"], "function", "main", x))
+               except:
+                       pass
+       return pluginlist
+
+def getPluginParams(file):
+       file = open("/usr/lib/tuxbox/plugins/" + file, "r")
+       lines = file.readlines()
+       file.close()
+       params = {}
+       for x in lines:
+               split = x.split("=")
+               params[split[0]] = split[1]
+       return params
 
 def main(session, args):
        print "Running plugin with number", args
\ No newline at end of file
 
 def main(session, args):
        print "Running plugin with number", args
\ No newline at end of file