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