summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/HookManager.py18
-rw-r--r--module/PluginManager.py8
-rwxr-xr-xpyLoadCore.py5
3 files changed, 11 insertions, 20 deletions
diff --git a/module/HookManager.py b/module/HookManager.py
index d37c904a9..e4cea0757 100644
--- a/module/HookManager.py
+++ b/module/HookManager.py
@@ -38,27 +38,13 @@ class HookManager():
self.lock.acquire()
plugins = []
- pluginStr = self.core.config["plugins"]["load_hook_plugins"]
- for pluginModule in pluginStr.split(","):
- pluginModule = pluginModule.strip()
- if not pluginModule:
- continue
- pluginName = pluginModule.split(".")[-1]
- if pluginName in self.config.keys():
- if not self.config[pluginName]["activated"]:
- self.logger.info("Deactivated %s" % pluginName)
- continue
- else:
- self.configParser.set(pluginName, {"option": "activated", "type": "bool", "name": "Activated"}, True)
- module = __import__(pluginModule, globals(), locals(), [pluginName], -1)
- pluginClass = getattr(module, pluginName)
+ for pluginClass in self.core.pluginManager.getHookPlugins():
try:
plugin = pluginClass(self.core)
plugin.readConfig()
plugins.append(plugin)
- self.logger.info("Activated %s" % pluginName)
except:
- self.logger.warning("Failed activating %s" % pluginName)
+ self.logger.warning(_("Failed activating %(name)s") % {"name":plugin.__name__})
self.plugins = plugins
self.lock.release()
diff --git a/module/PluginManager.py b/module/PluginManager.py
index f4ecb8f88..fb3948639 100644
--- a/module/PluginManager.py
+++ b/module/PluginManager.py
@@ -40,6 +40,7 @@ class PluginManager():
self.hosterPlugins = []
self.captchaPlugins = []
self.accountPlugins = []
+ self.hookPlugins = []
self.lock = Lock()
self.createIndex()
@@ -51,6 +52,7 @@ class PluginManager():
self.hosterPlugins = self.parse(self.core.config["plugins"]["load_hoster_plugins"], _("Hoster"))
self.captchaPlugins = self.parse(self.core.config["plugins"]["load_captcha_plugins"], _("Captcha"))
self.accountPlugins = self.parse(self.core.config["plugins"]["load_account_plugins"], _("Account"), create=True)
+ self.hookPlugins = self.parse(self.core.config["plugins"]["load_hook_plugins"], _("Hook"))
self.lock.release()
self.logger.info(_("created index of plugins"))
@@ -69,11 +71,12 @@ class PluginManager():
module = __import__(pluginModule, globals(), locals(), [pluginName], -1)
pluginClass = getattr(module, pluginName)
try:
+ self.logger.debug(_("%(type)s: %(name)s added") % {"name":pluginName, "type":ptype})
if create:
pluginClass = pluginClass(self)
plugins.append(pluginClass)
- self.logger.debug(_("%(type)s: %(name)s added") % {"name":pluginName, "type":ptype})
except:
+ self.logger.warning(_("Failed activating %(name)s") % {"name":pluginName})
if self.core.config['general']['debug_mode']:
traceback.print_exc()
return plugins
@@ -101,3 +104,6 @@ class PluginManager():
if plugin.__name__ == name:
return plugin
return None
+
+ def getHookPlugins(self):
+ return self.hookPlugins
diff --git a/pyLoadCore.py b/pyLoadCore.py
index 54c163e59..394dfcf32 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -245,12 +245,11 @@ class Core(object):
self.init_logger(logging.DEBUG) # logging level
else:
self.init_logger(logging.INFO) # logging level
-
- self.init_hooks()
- path.append(self.plugin_folder)
self.requestFactory = RequestFactory(self)
self.create_plugin_index()
+ self.init_hooks()
+ path.append(self.plugin_folder)
self.lastGuiConnected = 0