summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-10 01:07:51 +0200
committerGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-10 01:07:51 +0200
commit48a492bcffbf795577fed9f9b03b1e304c91409e (patch)
tree32f7bd233afb48596d9e9a7a138be56d173d7c38
parentfix: OboomCom and SmoozedCom with beaker >= v1.7.x (diff)
downloadpyload-48a492bcffbf795577fed9f9b03b1e304c91409e.tar.xz
more fixes. now running all plugins
-rw-r--r--pyload/manager/Addon.py47
-rw-r--r--pyload/manager/Plugin.py10
-rw-r--r--pyload/plugin/Addon.py6
-rw-r--r--pyload/plugin/Plugin.py16
-rw-r--r--pyload/plugin/addon/ClickAndLoad.py4
-rw-r--r--pyload/plugin/hook/XFileSharingPro.py2
-rw-r--r--pyload/plugin/hoster/OverLoadMe.py2
-rw-r--r--pyload/plugin/internal/MultiHook.py6
-rw-r--r--pyload/webui/app/pyloadweb.py2
9 files changed, 48 insertions, 47 deletions
diff --git a/pyload/manager/Addon.py b/pyload/manager/Addon.py
index 6a9c59c45..0bd51c943 100644
--- a/pyload/manager/Addon.py
+++ b/pyload/manager/Addon.py
@@ -100,31 +100,32 @@ class AddonManager(object):
def createIndex(self):
plugins = []
- active = []
- deactive = []
- for pluginname in self.core.pluginManager.addonPlugins:
- try:
- if self.core.config.getPlugin(pluginname, "activated"):
- pluginClass = self.core.pluginManager.loadClass("addon", pluginname)
- if not pluginClass:
- continue
-
- plugin = pluginClass(self.core, self)
- plugins.append(plugin)
- self.pluginMap[pluginClass.__name__] = plugin
- if plugin.isActivated():
- active.append(pluginClass.__name__)
- else:
- deactive.append(pluginname)
-
- except Exception:
- self.core.log.warning(_("Failed activating %(name)s") % {"name": pluginname})
- if self.core.debug or True:
- traceback.print_exc()
+ for type in ("addon", "hook"):
+ active = []
+ deactive = []
+ for pluginname in getattr(self.core.pluginManager, "%sPlugins" % type):
+ try:
+ if self.core.config.getPlugin("%s_%s" % (pluginname, type), "activated"):
+ pluginClass = self.core.pluginManager.loadClass(type, pluginname)
+ if not pluginClass:
+ continue
+
+ plugin = pluginClass(self.core, self)
+ plugins.append(plugin)
+ self.pluginMap[pluginClass.__name__] = plugin
+ if plugin.isActivated():
+ active.append(pluginClass.__name__)
+ else:
+ deactive.append(pluginname)
+
+ except Exception:
+ self.core.log.warning(_("Failed activating %(name)s") % {"name": pluginname})
+ if self.core.debug or True:
+ traceback.print_exc()
- self.core.log.info(_("Activated addons: %s") % ", ".join(sorted(active)))
- self.core.log.info(_("Deactivated addons: %s") % ", ".join(sorted(deactive)))
+ self.core.log.info(_("Activated %ss: %s") % (type, ", ".join(sorted(active))))
+ self.core.log.info(_("Deactivated %ss: %s") % (type, ", ".join(sorted(deactive))))
self.plugins = plugins
diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py
index 99778c3f3..f1899c0a0 100644
--- a/pyload/manager/Plugin.py
+++ b/pyload/manager/Plugin.py
@@ -60,10 +60,6 @@ class PluginManager(object):
self.plugins[type] = self.parse(type)
setattr(self, "%sPlugins" % type, self.plugins[type])
- # ???????? i don't understand this
- # self.plugins['addon'] = self.addonPlugins.update(self.hookPlugins)
- # ????????
-
self.core.log.debug("Created index of plugins")
@@ -145,7 +141,7 @@ class PluginManager(object):
# internals have no config
if folder == "internal":
- self.core.config.deleteConfig(name)
+ self.core.config.deleteConfig("internal")
continue
config = self.CONFIG.findall(content)
@@ -163,7 +159,7 @@ class PluginManager(object):
if folder not in ("account", "internal") and not [True for item in config if item[0] == "activated"]:
config.insert(0, ["activated", "bool", "Activated", False if folder in ("addon", "hook") else True])
- self.core.config.addPluginConfig(name, config, desc)
+ self.core.config.addPluginConfig("%s_%s" % (name, folder), config, desc)
except Exception:
self.core.log.error("Invalid config in %s: %s" % (name, config))
@@ -173,7 +169,7 @@ class PluginManager(object):
config = (["activated", "bool", "Activated", False],)
try:
- self.core.config.addPluginConfig(name, config, desc)
+ self.core.config.addPluginConfig("%s_%s" % (name, folder), config, desc)
except Exception:
self.core.log.error("Invalid config in %s: %s" % (name, config))
diff --git a/pyload/plugin/Addon.py b/pyload/plugin/Addon.py
index d33cdd400..1f4730851 100644
--- a/pyload/plugin/Addon.py
+++ b/pyload/plugin/Addon.py
@@ -78,7 +78,7 @@ class Addon(Base):
def initPeriodical(self, delay=0, threaded=False):
- self.cb = self.core.scheduler.addJob(max(0, delay), self._periodical, args=[threaded], threaded=threaded)
+ self.cb = self.core.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded)
def _periodical(self, threaded):
@@ -94,7 +94,7 @@ class Addon(Base):
if self.core.debug:
print_exc()
- self.cb = self.core.scheduler.addJob(self.interval, self._periodical, threaded=threaded)
+ self.cb = self.core.scheduler.addJob(self.interval, self._periodical, [threaded], threaded=threaded)
def __repr__(self):
@@ -117,7 +117,7 @@ class Addon(Base):
def isActivated(self):
""" checks if addon is activated"""
- return self.core.config.getPlugin(self.__class__.__name__, "activated")
+ return self.getConfig("activated")
# Event methods - overwrite these if needed
diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py
index 1c2091d66..486dbeb0f 100644
--- a/pyload/plugin/Plugin.py
+++ b/pyload/plugin/Plugin.py
@@ -87,6 +87,10 @@ class Base(object):
return self._log("critical", args)
+ def getPluginConfSection(self):
+ return "%s_%s" % (self.__class__.__name__, getattr(self, "_%s__type" % self.__class__.__name__))
+
+
#: Deprecated method
def setConf(self, option, value):
""" see `setConfig` """
@@ -100,7 +104,7 @@ class Base(object):
:param value:
:return:
"""
- self.core.config.setPlugin(self.__class__.__name__, option, value)
+ self.core.config.setPlugin(self.getPluginConfSection(), option, value)
#: Deprecated method
@@ -115,24 +119,24 @@ class Base(object):
:param option:
:return:
"""
- return self.core.config.getPlugin(self.__class__.__name__, option)
+ return self.core.config.getPlugin(self.getPluginConfSection(), option)
def setStorage(self, key, value):
""" Saves a value persistently to the database """
- self.core.db.setStorage(self.__class__.__name__, key, value)
+ self.core.db.setStorage(self.getPluginConfSection(), key, value)
def store(self, key, value):
""" same as `setStorage` """
- self.core.db.setStorage(self.__class__.__name__, key, value)
+ self.core.db.setStorage(self.getPluginConfSection(), key, value)
def getStorage(self, key=None, default=None):
""" Retrieves saved value or dict of all saved entries if key is None """
if key:
- return self.core.db.getStorage(self.__class__.__name__, key) or default
- return self.core.db.getStorage(self.__class__.__name__, key)
+ return self.core.db.getStorage(self.getPluginConfSection(), key) or default
+ return self.core.db.getStorage(self.getPluginConfSection(), key)
def retrieve(self, *args, **kwargs):
diff --git a/pyload/plugin/addon/ClickAndLoad.py b/pyload/plugin/addon/ClickAndLoad.py
index 708f7da0b..1e420fa8e 100644
--- a/pyload/plugin/addon/ClickAndLoad.py
+++ b/pyload/plugin/addon/ClickAndLoad.py
@@ -37,11 +37,11 @@ class ClickAndLoad(Addon):
def activate(self):
- if not self.config['webinterface']['activated']:
+ if not self.core.config['webui']['activated']:
return
ip = "" if self.getConfig('extern') else "127.0.0.1"
- webport = self.config['webinterface']['port']
+ webport = self.core.config['webui']['port']
cnlport = self.getConfig('port')
self.proxy(ip, webport, cnlport)
diff --git a/pyload/plugin/hook/XFileSharingPro.py b/pyload/plugin/hook/XFileSharingPro.py
index 9ded9cd53..1f3a27fd5 100644
--- a/pyload/plugin/hook/XFileSharingPro.py
+++ b/pyload/plugin/hook/XFileSharingPro.py
@@ -50,7 +50,7 @@ class XFileSharingPro(Hook):
def loadPattern(self):
- use_builtin_list = self.getConfig('use_builtin_list')
+ use_builtin_list = self.getConfig("use_builtin_list")
for type in ("hoster", "crypter"):
every_plugin = not self.getConfig('use_%s_list' % type)
diff --git a/pyload/plugin/hoster/OverLoadMe.py b/pyload/plugin/hoster/OverLoadMe.py
index ca365549a..ad15f60df 100644
--- a/pyload/plugin/hoster/OverLoadMe.py
+++ b/pyload/plugin/hoster/OverLoadMe.py
@@ -47,6 +47,6 @@ class OverLoadMe(MultiHoster):
pyfile.size = parseFileSize(data['filesize'])
http_repl = ["http://", "https://"]
- self.link = data['downloadlink'].replace(*http_repl if self.getConfig('ssl') else *http_repl[::-1])
+ self.link = data['downloadlink'].replace(*http_repl if self.getConfig('ssl') else http_repl[::-1])
diff --git a/pyload/plugin/internal/MultiHook.py b/pyload/plugin/internal/MultiHook.py
index c5fb21db5..acf17f6dc 100644
--- a/pyload/plugin/internal/MultiHook.py
+++ b/pyload/plugin/internal/MultiHook.py
@@ -68,15 +68,15 @@ class MultiHook(Hook):
def _initPlugin(self):
- plugin, type = self.core.pluginManager.findPlugin(self.__class__.__name__)
+ plugin = self.core.pluginManager.findPlugin("hoster", self.__class__.__name__)
if not plugin:
self.logWarning("Hook plugin will be deactivated due missing plugin reference")
self.setConfig('activated', False)
else:
self.pluginname = self.__class__.__name__
- self.plugintype = type
- self.pluginmodule = self.core.pluginManager.loadModule(type, self.__class__.__name__)
+ self.plugintype = "hoster"
+ self.pluginmodule = self.core.pluginManager.loadModule("hoster", self.__class__.__name__)
self.pluginclass = getattr(self.pluginmodule, self.__class__.__name__)
diff --git a/pyload/webui/app/pyloadweb.py b/pyload/webui/app/pyloadweb.py
index fd6e8c89a..d71d0d306 100644
--- a/pyload/webui/app/pyloadweb.py
+++ b/pyload/webui/app/pyloadweb.py
@@ -99,7 +99,7 @@ def server_js(theme, file):
time.gmtime(time.time() + 24 * 7 * 60 * 60))
response.headers['Cache-control'] = "public"
- path = join(theme, file)
+ path = "/".join((theme, file))
return env.get_template(path).render()
else:
return server_static(theme, file)