diff options
Diffstat (limited to 'pyload/plugin')
-rw-r--r-- | pyload/plugin/Addon.py | 6 | ||||
-rw-r--r-- | pyload/plugin/Plugin.py | 16 | ||||
-rw-r--r-- | pyload/plugin/addon/ClickAndLoad.py | 4 | ||||
-rw-r--r-- | pyload/plugin/hook/XFileSharingPro.py | 2 | ||||
-rw-r--r-- | pyload/plugin/hoster/OverLoadMe.py | 2 | ||||
-rw-r--r-- | pyload/plugin/internal/MultiHook.py | 6 |
6 files changed, 20 insertions, 16 deletions
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__) |