disable test-plugin
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 20 Jan 2006 15:33:12 +0000 (15:33 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Fri, 20 Jan 2006 15:33:12 +0000 (15:33 +0000)
reenable the try/except block for faulty plugin catching
don't expect a directory /usr/lib/tuxbox/plugins to be present by the tuxbox plugin starter

lib/python/Components/PluginComponent.py
lib/python/Plugins/Makefile.am
lib/python/Plugins/tuxboxplugins/plugin.py

index 26eadd1..adfc98a 100644 (file)
@@ -20,38 +20,38 @@ 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)
-                                       plugins = plugin.getPlugins()
-                                       try: picturepaths = plugin.getPicturePaths()
-                                       except:
-                                               picturepaths = []
-                                               for p in plugins:
-                                                       picturepaths.append("")
-                                       try:
-                                               for menuEntry in plugin.getMenuRegistrationList():
-                                                       self.menuEntries.append([menuEntry, pluginmodule])
-                                       except:
-                                               pass
-
-                                       for y in range(len(plugins)):
-                                               if len(plugins[y]) < 5:
-                                                       list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][2], plugins[y][3], None, plugins[y][1]))
-                                               else:
-                                                       list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][2], plugins[y][3], plugins[y][4], plugins[y][1]))
-                                       if runAutostartPlugins:
-                                               try: plugin.autostart()
-                                               except: pass
-                                       if runAutoendPlugins:
-                                               try: plugin.autoend()
-                                               except: pass
-#                      except:
-#                              print "Directory", path, "contains a faulty plugin"
+                       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)
+                                               plugins = plugin.getPlugins()
+                                               try: picturepaths = plugin.getPicturePaths()
+                                               except:
+                                                       picturepaths = []
+                                                       for p in plugins:
+                                                               picturepaths.append("")
+                                               try:
+                                                       for menuEntry in plugin.getMenuRegistrationList():
+                                                               self.menuEntries.append([menuEntry, pluginmodule])
+                                               except:
+                                                       pass
+       
+                                               for y in range(len(plugins)):
+                                                       if len(plugins[y]) < 5:
+                                                               list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][2], plugins[y][3], None, plugins[y][1]))
+                                                       else:
+                                                               list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][2], plugins[y][3], plugins[y][4], plugins[y][1]))
+                                               if runAutostartPlugins:
+                                                       try: plugin.autostart()
+                                                       except: pass
+                                               if runAutoendPlugins:
+                                                       try: plugin.autoend()
+                                                       except: pass
+                       except:
+                               print "Directory", path, "contains a faulty plugin"
                self.menuUpdate()
                return list
        
index 93ee65a..01f21d4 100644 (file)
@@ -1,6 +1,6 @@
 installdir = $(LIBDIR)/enigma2/python/Plugins
 
-SUBDIRS = update tuxboxplugins web test
+SUBDIRS = update tuxboxplugins web
 
 install_PYTHON =       \
        __init__.py
index b700566..bf78946 100644 (file)
@@ -7,31 +7,41 @@ from Components.Label import Label
 import os
 
 def getPlugins():
-       dir = os.listdir("/usr/lib/tuxbox/plugins/")
-       
        pluginlist = []
-       for x in dir:
-               try:
-                       if x[-3:] == "cfg":
-                               params = getPluginParams(x)
-                               pluginlist.append((params["name"], params["desc"], "function", "main", x))
-               except:
-                       pass
+
+       try:
+               dir = os.listdir("/usr/lib/tuxbox/plugins/")
+       
+               for x in dir:
+                       try:
+                               if x[-3:] == "cfg":
+                                       params = getPluginParams(x)
+                                       pluginlist.append((params["name"], params["desc"], "function", "main", x))
+                       except:
+                               pass
+       except:
+               print "no tuxbox plugins found"
        return pluginlist
 
 def getPicturePaths():
        list = []
-       dir = os.listdir("/usr/lib/tuxbox/plugins/")
-       for x in dir: list.append("tuxbox.png")
+       try:
+               dir = os.listdir("/usr/lib/tuxbox/plugins/")
+               for x in dir: list.append("tuxbox.png")
+       except:
+               print "no tuxbox plugins found"
        return list
 
 def getPluginParams(file):
        params = {}
-       file = open("/usr/lib/tuxbox/plugins/" + file, "r")
-       for x in file.readlines():
-               split = x.split("=")
-               params[split[0]] = split[1]
-       file.close()
+       try:
+               file = open("/usr/lib/tuxbox/plugins/" + file, "r")
+               for x in file.readlines():
+                       split = x.split("=")
+                       params[split[0]] = split[1]
+               file.close()
+       except:
+               print "not tuxbox plugins found"
 
        return params