add arabic to the language list
[enigma2.git] / lib / python / Components / PluginComponent.py
index 10e1b59d6f6a6a5bc8e0c2b3dcee7122b2cc7228..172e33e32e60732ae65495ed9d0e0fe3cb86a622 100644 (file)
@@ -20,31 +20,32 @@ class PluginComponent:
 
                for x in dir:
                        path = resolveFilename(SCOPE_PLUGINS, x) + "/"
-                       try:
-                               if os.path.exists(path):
-                                       if fileExists(path + "plugin.py"):
-                                               pluginmodule = self.prefix + x + ".plugin"
-                                               print "trying to import " + pluginmodule
-                                               exec "import " + pluginmodule
-                                               plugin = eval(pluginmodule)
-                                               picturepath = plugin.getPicturePath()
-                                               pluginname = plugin.getPluginName()
-                                               try:
-                                                       for menuEntry in plugin.getMenuRegistrationList():
-                                                               self.menuEntries.append([menuEntry, pluginmodule])
-                                               except:
-                                                       pass
-               
-                                               list.append((picturepath, pluginname , x))
-                                               if runAutostartPlugins:
-                                                       try: plugin.autostart()
-                                                       except: pass
-                                               if runAutoendPlugins:
-                                                       try: plugin.autoend()
-                                                       except: pass
+                       #try:
+                       if os.path.exists(path):
+                               if fileExists(path + "plugin.py"):
+                                       pluginmodule = self.prefix + x + ".plugin"
+                                       print "trying to import " + pluginmodule
+                                       exec "import " + pluginmodule
+                                       plugin = eval(pluginmodule)
+                                       picturepaths = plugin.getPicturePaths()
+                                       plugins = plugin.getPlugins()
+                                       try:
+                                               for menuEntry in plugin.getMenuRegistrationList():
+                                                       self.menuEntries.append([menuEntry, pluginmodule])
+                                       except:
+                                               pass
+
+                                       for y in range(len(plugins)):
+                                               list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][1], plugins[y][2]))
+                                       if runAutostartPlugins:
+                                               try: plugin.autostart()
+                                               except: pass
+                                       if runAutoendPlugins:
+                                               try: plugin.autoend()
+                                               except: pass
                                                        
-                       except:
-                               print "Directory", path, "contains a faulty plugin"
+                       #except:
+                       #       print "Directory", path, "contains a faulty plugin"
                self.menuUpdate()
                return list
        
@@ -57,10 +58,14 @@ class PluginComponent:
                        menuupdater.addMenuItem(menuEntry[0][0], menuEntry[0][2], menuEntry[1], menuEntry[0][3])
        
        def runPlugin(self, plugin, session):
-               try:
-                       exec "import " + self.prefix + plugin[2] + ".plugin"
-                       eval(self.prefix + plugin[2] + ".plugin").main(session)
-               except:
-                       print "exec of plugin failed!"
+               #try:
+                       exec("import " + self.prefix + plugin[2] + ".plugin")
+                       print self.prefix + plugin[2] + ".plugin." + plugin[4]
+                       if plugin[3] == "screen":
+                               session.open(eval(self.prefix + plugin[2] + ".plugin." + plugin[4]))
+                       elif plugin[3] == "function":
+                               eval(self.prefix + plugin[2] + ".plugin." + plugin[4])(session)
+               #except:
+                       #print "exec of plugin failed!"
 
 plugins = PluginComponent()