blob: f1a0a95ad79544f655dc1006f3182dac2ca7cb30 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import os
from Tools.Directories import *
#import Plugins
class PluginComponent:
def __init__(self):
self.plugins = []
self.setPluginPrefix("Plugins.")
def setPluginPrefix(self, prefix):
self.prefix = prefix
def getPluginList(self):
list = []
dir = os.listdir("/usr/lib/enigma2/python/Plugins/")
for x in dir:
if x[-3:] == ".py" and x[:-3] != "__init__":
#try:
print "trying to import " + self.prefix + x[:-3]
exec "import " + self.prefix + x[:-3]
picturepath = eval(self.prefix + x[:-3]).getPicturePath()
pluginname = eval(self.prefix + x[:-3]).getPluginName()
list.append((picturepath, pluginname , x[:-3]))
#except:
#print "Failed to open module - wrong plugin!"
return list
def runPlugin(self, plugin, session):
try:
exec "import " + self.prefix + plugin[2]
eval(self.prefix + plugin[2]).main(session)
except:
print "exec of plugin failed!"
plugins = PluginComponent()
|