01d5745615fe99fa6341a9589354c24ed3f5ac33
[enigma2.git] / lib / python / Plugins / tuxboxplugins / plugin.py
1 # must be fixed for the new plugin interface
2 from enigma import *
3 from Screens.Screen import Screen
4 from Screens.MessageBox import MessageBox
5 from Components.ActionMap import ActionMap
6 from Components.Label import Label
7
8 import os
9
10 def getPlugins():
11         pluginlist = []
12
13         try:
14                 dir = os.listdir("/usr/lib/tuxbox/plugins/")
15         
16                 for x in dir:
17                         try:
18                                 if x[-3:] == "cfg":
19                                         params = getPluginParams(x)
20                                         pluginlist.append((params["name"], params["desc"], "function", "main", x))
21                         except:
22                                 pass
23         except:
24                 print "no tuxbox plugins found"
25         return pluginlist
26
27 def getPicturePaths():
28         list = []
29         try:
30                 dir = os.listdir("/usr/lib/tuxbox/plugins/")
31                 for x in dir: list.append("tuxbox.png")
32         except:
33                 print "no tuxbox plugins found"
34         return list
35
36 def getPluginParams(file):
37         params = {}
38         try:
39                 file = open("/usr/lib/tuxbox/plugins/" + file, "r")
40                 for x in file.readlines():
41                         split = x.split("=")
42                         params[split[0]] = split[1]
43                 file.close()
44         except:
45                 print "not tuxbox plugins found"
46
47         return params
48
49 def main(session, args):
50         print "Running plugin " + args[:-4] + ".so with config file", args
51         print getPluginParams(args)