From 681deb7ff09956be0bee04453e33ac6e9d6dab4a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 8 Jun 2015 05:56:10 +0200 Subject: Move base plugins to internal folder --- module/plugins/internal/Hook.py | 161 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 module/plugins/internal/Hook.py (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py new file mode 100644 index 000000000..5efd08bae --- /dev/null +++ b/module/plugins/internal/Hook.py @@ -0,0 +1,161 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: mkaay + @interface-version: 0.2 +""" + +from traceback import print_exc + +from Plugin import Base + +class Expose(object): + """ used for decoration to declare rpc services """ + + def __new__(cls, f, *args, **kwargs): + hookManager.addRPC(f.__module__, f.func_name, f.func_doc) + return f + +def threaded(f): + def run(*args,**kwargs): + hookManager.startThread(f, *args, **kwargs) + return run + +class Hook(Base): + """ + Base class for hook plugins. + """ + __name__ = "Hook" + __version__ = "0.2" + __type__ = "hook" + __threaded__ = [] + __config__ = [ ("name", "type", "desc" , "default") ] + __description__ = """interface for hook""" + __author_name__ = ("mkaay", "RaNaN") + __author_mail__ = ("mkaay@mkaay.de", "RaNaN@pyload.org") + + #: automatically register event listeners for functions, attribute will be deleted dont use it yourself + event_map = None + + # Alternative to event_map + #: List of events the plugin can handle, name the functions exactly like eventname. + event_list = None # dont make duplicate entries in event_map + + + #: periodic call interval in secondc + interval = 60 + + def __init__(self, core, manager): + Base.__init__(self, core) + + #: Provide information in dict here, usable by API `getInfo` + self.info = None + + #: Callback of periodical job task, used by hookmanager + self.cb = None + + #: `HookManager` + self.manager = manager + + #register events + if self.event_map: + for event, funcs in self.event_map.iteritems(): + if type(funcs) in (list, tuple): + for f in funcs: + self.manager.addEvent(event, getattr(self,f)) + else: + self.manager.addEvent(event, getattr(self,funcs)) + + #delete for various reasons + self.event_map = None + + if self.event_list: + for f in self.event_list: + self.manager.addEvent(f, getattr(self,f)) + + self.event_list = None + + self.initPeriodical() + self.setup() + + def initPeriodical(self): + if self.interval >=1: + self.cb = self.core.scheduler.addJob(0, self._periodical, threaded=False) + + def _periodical(self): + try: + if self.isActivated(): self.periodical() + except Exception, e: + self.core.log.error(_("Error executing hooks: %s") % str(e)) + if self.core.debug: + print_exc() + + self.cb = self.core.scheduler.addJob(self.interval, self._periodical, threaded=False) + + + def __repr__(self): + return "" % self.__name__ + + def setup(self): + """ more init stuff if needed """ + pass + + def unload(self): + """ called when hook was deactivated """ + pass + + def isActivated(self): + """ checks if hook is activated""" + return self.config.getPlugin(self.__name__, "activated") + + + #event methods - overwrite these if needed + def coreReady(self): + pass + + def coreExiting(self): + pass + + def downloadPreparing(self, pyfile): + pass + + def downloadFinished(self, pyfile): + pass + + def downloadFailed(self, pyfile): + pass + + def packageFinished(self, pypack): + pass + + def beforeReconnecting(self, ip): + pass + + def afterReconnecting(self, ip): + pass + + def periodical(self): + pass + + def newCaptchaTask(self, task): + """ new captcha task for the plugin, it MUST set the handler and timeout or will be ignored """ + pass + + def captchaCorrect(self, task): + pass + + def captchaInvalid(self, task): + pass \ No newline at end of file -- cgit v1.2.3 From 0e1ef9bc01579328e17e79416fa3c1c7b77adcc8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 8 Jun 2015 06:08:01 +0200 Subject: Update everything --- module/plugins/internal/Hook.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 5efd08bae..5f2639dce 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - + @author: mkaay @interface-version: 0.2 """ @@ -39,7 +39,7 @@ class Hook(Base): Base class for hook plugins. """ __name__ = "Hook" - __version__ = "0.2" + __version__ = "0.02" __type__ = "hook" __threaded__ = [] __config__ = [ ("name", "type", "desc" , "default") ] @@ -108,7 +108,7 @@ class Hook(Base): def __repr__(self): return "" % self.__name__ - + def setup(self): """ more init stuff if needed """ pass @@ -116,37 +116,37 @@ class Hook(Base): def unload(self): """ called when hook was deactivated """ pass - + def isActivated(self): """ checks if hook is activated""" return self.config.getPlugin(self.__name__, "activated") - - #event methods - overwrite these if needed + + #event methods - overwrite these if needed def coreReady(self): pass def coreExiting(self): pass - + def downloadPreparing(self, pyfile): pass - + def downloadFinished(self, pyfile): pass - + def downloadFailed(self, pyfile): pass - + def packageFinished(self, pypack): pass def beforeReconnecting(self, ip): pass - + def afterReconnecting(self, ip): pass - + def periodical(self): pass -- cgit v1.2.3 From 117e670d59db7f8d6047562f69cb152a1e2dee53 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 14 Jun 2015 18:35:38 +0200 Subject: Update Hook --- module/plugins/internal/Hook.py | 175 +++++++++++++++++++++++----------------- 1 file changed, 102 insertions(+), 73 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 5f2639dce..5f7f3db55 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -1,161 +1,190 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. +import traceback - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. +from module.plugins.internal.Plugin import Plugin - You should have received a copy of the GNU General Public License - along with this program; if not, see . - - @author: mkaay - @interface-version: 0.2 -""" - -from traceback import print_exc - -from Plugin import Base class Expose(object): - """ used for decoration to declare rpc services """ + """Used for decoration to declare rpc services""" def __new__(cls, f, *args, **kwargs): hookManager.addRPC(f.__module__, f.func_name, f.func_doc) return f -def threaded(f): - def run(*args,**kwargs): - hookManager.startThread(f, *args, **kwargs) + +def threaded(fn): + + def run(*args, **kwargs): + hookManager.startThread(fn, *args, **kwargs) + return run -class Hook(Base): - """ - Base class for hook plugins. - """ - __name__ = "Hook" - __version__ = "0.02" - __type__ = "hook" - __threaded__ = [] - __config__ = [ ("name", "type", "desc" , "default") ] - __description__ = """interface for hook""" - __author_name__ = ("mkaay", "RaNaN") - __author_mail__ = ("mkaay@mkaay.de", "RaNaN@pyload.org") - #: automatically register event listeners for functions, attribute will be deleted dont use it yourself - event_map = None +class Hook(Plugin): + __name__ = "Hook" + __type__ = "hook" + __version__ = "0.03" - # Alternative to event_map - #: List of events the plugin can handle, name the functions exactly like eventname. - event_list = None # dont make duplicate entries in event_map + __config__ = [] #: [("name", "type", "desc", "default")] + __description__ = """Base hook plugin""" + __license__ = "GPLv3" + __authors__ = [("mkaay" , "mkaay@mkaay.de" ), + ("RaNaN" , "RaNaN@pyload.org" ), + ("Walter Purcaro", "vuolter@gmail.com")] - #: periodic call interval in secondc - interval = 60 def __init__(self, core, manager): - Base.__init__(self, core) - #: Provide information in dict here, usable by API `getInfo` - self.info = None + self.info = {} - #: Callback of periodical job task, used by hookmanager - self.cb = None + #: Callback of periodical job task, used by HookManager + self.cb = None + self.interval = 60 #: `HookManager` self.manager = manager - #register events + self.setup() + + #: automatically register event listeners for functions, attribute will be deleted dont use it yourself + self.event_map = {} + + # Deprecated alternative to event_map + #: List of events the plugin can handle, name the functions exactly like eventname. + self.event_list = [] #@NOTE: dont make duplicate entries in event_map + + # register events if self.event_map: for event, funcs in self.event_map.iteritems(): if type(funcs) in (list, tuple): for f in funcs: - self.manager.addEvent(event, getattr(self,f)) + self.manager.addEvent(event, getattr(self, f)) else: - self.manager.addEvent(event, getattr(self,funcs)) + self.manager.addEvent(event, getattr(self, funcs)) - #delete for various reasons + # delete for various reasons self.event_map = None if self.event_list: + self.logWarning(_("Deprecated method `event_list`, use `event_map` instead")) + for f in self.event_list: - self.manager.addEvent(f, getattr(self,f)) + self.manager.addEvent(f, getattr(self, f)) self.event_list = None - self.initPeriodical() - self.setup() - def initPeriodical(self): - if self.interval >=1: - self.cb = self.core.scheduler.addJob(0, self._periodical, threaded=False) + def initPeriodical(self, delay=0, threaded=False): + self.cb = self.core.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded) + + + def _periodical(self, threaded): + if self.interval < 0: + self.cb = None + return - def _periodical(self): try: - if self.isActivated(): self.periodical() + self.periodical() + except Exception, e: - self.core.log.error(_("Error executing hooks: %s") % str(e)) + self.logError(_("Error executing hook: %s") % e) if self.core.debug: - print_exc() + traceback.print_exc() - self.cb = self.core.scheduler.addJob(self.interval, self._periodical, threaded=False) + self.cb = self.core.scheduler.addJob(self.interval, self._periodical, [threaded], threaded=threaded) def __repr__(self): return "" % self.__name__ + def setup(self): - """ more init stuff if needed """ + """More init stuff if needed""" pass - def unload(self): - """ called when hook was deactivated """ - pass def isActivated(self): - """ checks if hook is activated""" - return self.config.getPlugin(self.__name__, "activated") + """Checks if hook is activated""" + return self.getConfig("activated") + + + def deactivate(self): + """Called when hook was deactivated""" + pass + + #: Deprecated, use method `deactivate` instead + def unload(self): + self.logWarning(_("Deprecated method `unload`, use `deactivate` instead")) + return self.deactivate() - #event methods - overwrite these if needed + + def activate(self): + """Called when hook was activated""" + pass + + + #: Deprecated, use method `activate` instead def coreReady(self): + self.logWarning(_("Deprecated method `coreReady`, use `activate` instead")) + return self.activate() + + + def exit(self): + """Called by core.shutdown just before pyLoad exit""" pass + + #: Deprecated, use method `exit` instead def coreExiting(self): - pass + self.logWarning(_("Deprecated method `coreExiting`, use `exit` instead")) + return self.exit() + def downloadPreparing(self, pyfile): pass + def downloadFinished(self, pyfile): pass + def downloadFailed(self, pyfile): pass + def packageFinished(self, pypack): pass + def beforeReconnecting(self, ip): pass + def afterReconnecting(self, ip): pass + def periodical(self): pass - def newCaptchaTask(self, task): - """ new captcha task for the plugin, it MUST set the handler and timeout or will be ignored """ + + def captchaTask(self, task): + """New captcha task for the plugin, it MUST set the handler and timeout or will be ignored""" pass + + #: Deprecated, use method `captchaTask` instead + def newCaptchaTask(self, task): + self.logWarning(_("Deprecated method `newCaptchaTask`, use `captchaTask` instead")) + return self.captchaTask() + + def captchaCorrect(self, task): pass + def captchaInvalid(self, task): - pass \ No newline at end of file + pass -- cgit v1.2.3 From 312f6decf9f0f07d46a3470c97707dd74698172c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 14 Jun 2015 19:46:30 +0200 Subject: Hook back to Base class --- module/plugins/internal/Hook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 5f7f3db55..d34435349 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -2,7 +2,7 @@ import traceback -from module.plugins.internal.Plugin import Plugin +from module.plugins.internal.Plugin import Base class Expose(object): @@ -21,7 +21,7 @@ def threaded(fn): return run -class Hook(Plugin): +class Hook(Base): __name__ = "Hook" __type__ = "hook" __version__ = "0.03" -- cgit v1.2.3 From 71d5584e82050a66aa5306ce99e43e7cbc3a62a7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 00:17:49 +0200 Subject: Fix new internal plugins --- module/plugins/internal/Hook.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index d34435349..6931a7dba 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -26,7 +26,8 @@ class Hook(Base): __type__ = "hook" __version__ = "0.03" - __config__ = [] #: [("name", "type", "desc", "default")] + __config__ = [] #: [("name", "type", "desc", "default")] + __threaded__ = [] #@TODO: Remove in 0.4.10 __description__ = """Base hook plugin""" __license__ = "GPLv3" @@ -36,6 +37,8 @@ class Hook(Base): def __init__(self, core, manager): + super(Hook, self).__init__(core) + #: Provide information in dict here, usable by API `getInfo` self.info = {} @@ -55,7 +58,12 @@ class Hook(Base): #: List of events the plugin can handle, name the functions exactly like eventname. self.event_list = [] #@NOTE: dont make duplicate entries in event_map - # register events + self.initEvents() + # self.initPeriodical(10) + + + def initEvents(self): + # register events if self.event_map: for event, funcs in self.event_map.iteritems(): if type(funcs) in (list, tuple): @@ -117,7 +125,6 @@ class Hook(Base): #: Deprecated, use method `deactivate` instead def unload(self): - self.logWarning(_("Deprecated method `unload`, use `deactivate` instead")) return self.deactivate() @@ -128,7 +135,6 @@ class Hook(Base): #: Deprecated, use method `activate` instead def coreReady(self): - self.logWarning(_("Deprecated method `coreReady`, use `activate` instead")) return self.activate() @@ -139,7 +145,6 @@ class Hook(Base): #: Deprecated, use method `exit` instead def coreExiting(self): - self.logWarning(_("Deprecated method `coreExiting`, use `exit` instead")) return self.exit() @@ -178,7 +183,6 @@ class Hook(Base): #: Deprecated, use method `captchaTask` instead def newCaptchaTask(self, task): - self.logWarning(_("Deprecated method `newCaptchaTask`, use `captchaTask` instead")) return self.captchaTask() -- cgit v1.2.3 From 725f4ee53a8e8797492329d015af18262e9ca369 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 02:05:56 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1496 --- module/plugins/internal/Hook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 6931a7dba..71e8866f3 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -24,7 +24,7 @@ def threaded(fn): class Hook(Base): __name__ = "Hook" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" __config__ = [] #: [("name", "type", "desc", "default")] __threaded__ = [] #@TODO: Remove in 0.4.10 @@ -183,7 +183,7 @@ class Hook(Base): #: Deprecated, use method `captchaTask` instead def newCaptchaTask(self, task): - return self.captchaTask() + return self.captchaTask(task) def captchaCorrect(self, task): -- cgit v1.2.3 From 8fdf7ff12b8a7c80292c4599e0220439cb9cfcac Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 05:31:32 +0200 Subject: Update Hook (2) --- module/plugins/internal/Hook.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 71e8866f3..4f9a01bb3 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -24,7 +24,7 @@ def threaded(fn): class Hook(Base): __name__ = "Hook" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" __config__ = [] #: [("name", "type", "desc", "default")] __threaded__ = [] #@TODO: Remove in 0.4.10 @@ -59,11 +59,10 @@ class Hook(Base): self.event_list = [] #@NOTE: dont make duplicate entries in event_map self.initEvents() - # self.initPeriodical(10) + self.initPeriodical(10) def initEvents(self): - # register events if self.event_map: for event, funcs in self.event_map.iteritems(): if type(funcs) in (list, tuple): @@ -123,7 +122,7 @@ class Hook(Base): pass - #: Deprecated, use method `deactivate` instead + #: Deprecated method, use `deactivate` instead def unload(self): return self.deactivate() @@ -133,7 +132,7 @@ class Hook(Base): pass - #: Deprecated, use method `activate` instead + #: Deprecated method, use `activate` instead def coreReady(self): return self.activate() @@ -143,7 +142,7 @@ class Hook(Base): pass - #: Deprecated, use method `exit` instead + #: Deprecated method, use `exit` instead def coreExiting(self): return self.exit() @@ -176,14 +175,14 @@ class Hook(Base): pass - def captchaTask(self, task): + def captcha_task(self, task): """New captcha task for the plugin, it MUST set the handler and timeout or will be ignored""" pass - #: Deprecated, use method `captchaTask` instead + #: Deprecated method, use `captcha_task` instead def newCaptchaTask(self, task): - return self.captchaTask(task) + return self.captcha_task(task) def captchaCorrect(self, task): -- cgit v1.2.3 From a0d0d3ccd041097c01a100861d3b6d1b1460df16 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 18:07:17 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1502 --- module/plugins/internal/Hook.py | 87 ++++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 19 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 4f9a01bb3..deeb5a097 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -24,7 +24,7 @@ def threaded(fn): class Hook(Base): __name__ = "Hook" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [] #: [("name", "type", "desc", "default")] __threaded__ = [] #@TODO: Remove in 0.4.10 @@ -39,17 +39,11 @@ class Hook(Base): def __init__(self, core, manager): super(Hook, self).__init__(core) - #: Provide information in dict here, usable by API `getInfo` - self.info = {} - - #: Callback of periodical job task, used by HookManager - self.cb = None - self.interval = 60 - #: `HookManager` self.manager = manager - self.setup() + #: Provide information in dict here, usable by API `getInfo` + self.info = {} #: automatically register event listeners for functions, attribute will be deleted dont use it yourself self.event_map = {} @@ -58,11 +52,16 @@ class Hook(Base): #: List of events the plugin can handle, name the functions exactly like eventname. self.event_list = [] #@NOTE: dont make duplicate entries in event_map - self.initEvents() - self.initPeriodical(10) + #: Callback of periodical job task, used by HookManager + self.cb = None + self.interval = 60 + + self.setup() + self.init_events() + self.init_periodical(10) - def initEvents(self): + def init_events(self): if self.event_map: for event, funcs in self.event_map.iteritems(): if type(funcs) in (list, tuple): @@ -83,10 +82,15 @@ class Hook(Base): self.event_list = None - def initPeriodical(self, delay=0, threaded=False): + def init_periodical(self, delay=0, threaded=False): self.cb = self.core.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded) + #: Deprecated method, use `init_periodical` instead + def initPeriodical(self): + return self.init_periodical() + + def _periodical(self, threaded): if self.interval < 0: self.cb = None @@ -103,6 +107,10 @@ class Hook(Base): self.cb = self.core.scheduler.addJob(self.interval, self._periodical, [threaded], threaded=threaded) + def periodical(self): + pass + + def __repr__(self): return "" % self.__name__ @@ -112,11 +120,16 @@ class Hook(Base): pass - def isActivated(self): + def is_activated(self): """Checks if hook is activated""" return self.getConfig("activated") + #: Deprecated method, use `is_activated` instead + def isActivated(self): + return self.is_activated() + + def deactivate(self): """Called when hook was deactivated""" pass @@ -147,32 +160,58 @@ class Hook(Base): return self.exit() + def download_preparing(self, pyfile): + pass + + + #: Deprecated method, use `download_preparing` instead def downloadPreparing(self, pyfile): + return self.download_preparing(pyfile) + + + def download_finished(self, pyfile): pass + #: Deprecated method, use `download_finished` instead def downloadFinished(self, pyfile): + return self.download_finished(pyfile) + + + def download_failed(self, pyfile): pass + #: Deprecated method, use `download_failed` instead def downloadFailed(self, pyfile): + return self.download_failed(pyfile) + + + def package_finished(self, pypack): pass + #: Deprecated method, use `package_finished` instead def packageFinished(self, pypack): + return self.package_finished(pyfile) + + + def before_reconnect(self, ip): pass + #: Deprecated method, use `before_reconnect` instead def beforeReconnecting(self, ip): - pass + return self.before_reconnect(ip) - def afterReconnecting(self, ip): + def after_reconnect(self, ip, oldip): pass - def periodical(self): - pass + #: Deprecated method, use `after_reconnect` instead + def afterReconnecting(self, ip): + return self.after_reconnect(ip, None) def captcha_task(self, task): @@ -185,9 +224,19 @@ class Hook(Base): return self.captcha_task(task) + def captcha_correct(self, task): + pass + + + #: Deprecated method, use `captcha_correct` instead def captchaCorrect(self, task): + return self.captcha_correct(task) + + + def captcha_invalid(self, task): pass + #: Deprecated method, use `captcha_invalid` instead def captchaInvalid(self, task): - pass + return self.captcha_invalid(task) -- cgit v1.2.3 From eb7a80a8c30a16f5a828823e79893bdc4764704c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 18:45:14 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1504 --- module/plugins/internal/Hook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index deeb5a097..0eec4c008 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -74,7 +74,7 @@ class Hook(Base): self.event_map = None if self.event_list: - self.logWarning(_("Deprecated method `event_list`, use `event_map` instead")) + self.logDebug("Deprecated method `event_list`, use `event_map` instead") for f in self.event_list: self.manager.addEvent(f, getattr(self, f)) -- cgit v1.2.3 From 7bc0b193735b5e98c33ae6f0f10e3d49d441fdf0 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 19:00:15 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1503 --- module/plugins/internal/Hook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 0eec4c008..0eeca5556 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -24,7 +24,7 @@ def threaded(fn): class Hook(Base): __name__ = "Hook" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" __config__ = [] #: [("name", "type", "desc", "default")] __threaded__ = [] #@TODO: Remove in 0.4.10 -- cgit v1.2.3 From 5e5775d7ef1a59f9ad166995483dc7a38e096f22 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 20:31:11 +0200 Subject: Fix http://forum.pyload.org/viewtopic.php?f=10&t=4328 --- module/plugins/internal/Hook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 0eeca5556..7d785ded0 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -24,7 +24,7 @@ def threaded(fn): class Hook(Base): __name__ = "Hook" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" __config__ = [] #: [("name", "type", "desc", "default")] __threaded__ = [] #@TODO: Remove in 0.4.10 @@ -193,7 +193,7 @@ class Hook(Base): #: Deprecated method, use `package_finished` instead def packageFinished(self, pypack): - return self.package_finished(pyfile) + return self.package_finished(pypack) def before_reconnect(self, ip): -- cgit v1.2.3 From 5a139055ae658d3a05cbb658cbd66aeae0d01db5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 21:06:10 +0200 Subject: Spare code cosmetics --- module/plugins/internal/Hook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 7d785ded0..8d620e794 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -2,7 +2,7 @@ import traceback -from module.plugins.internal.Plugin import Base +from module.plugins.internal.Plugin import Plugin class Expose(object): @@ -21,7 +21,7 @@ def threaded(fn): return run -class Hook(Base): +class Hook(Plugin): __name__ = "Hook" __type__ = "hook" __version__ = "0.08" -- cgit v1.2.3 From c1764e2fea0bb05164c83a876e8cd58b97f58f25 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 16 Jun 2015 17:31:38 +0200 Subject: Update all --- module/plugins/internal/Hook.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 8d620e794..01ffbc5f2 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -42,9 +42,6 @@ class Hook(Plugin): #: `HookManager` self.manager = manager - #: Provide information in dict here, usable by API `getInfo` - self.info = {} - #: automatically register event listeners for functions, attribute will be deleted dont use it yourself self.event_map = {} -- cgit v1.2.3 From 164512b6a74c94a731fcee7435dce1ccfa2f71e7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:29:50 +0200 Subject: Spare code cosmetics --- module/plugins/internal/Hook.py | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 01ffbc5f2..3a0431feb 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -6,8 +6,9 @@ from module.plugins.internal.Plugin import Plugin class Expose(object): - """Used for decoration to declare rpc services""" - + """ + Used for decoration to declare rpc services + """ def __new__(cls, f, *args, **kwargs): hookManager.addRPC(f.__module__, f.func_name, f.func_doc) return f @@ -113,12 +114,16 @@ class Hook(Plugin): def setup(self): - """More init stuff if needed""" + """ + More init stuff if needed + """ pass def is_activated(self): - """Checks if hook is activated""" + """ + Checks if hook is activated + """ return self.getConfig("activated") @@ -128,7 +133,9 @@ class Hook(Plugin): def deactivate(self): - """Called when hook was deactivated""" + """ + Called when hook was deactivated + """ pass @@ -138,7 +145,9 @@ class Hook(Plugin): def activate(self): - """Called when hook was activated""" + """ + Called when hook was activated + """ pass @@ -148,7 +157,9 @@ class Hook(Plugin): def exit(self): - """Called by core.shutdown just before pyLoad exit""" + """ + Called by core.shutdown just before pyLoad exit + """ pass @@ -212,7 +223,9 @@ class Hook(Plugin): def captcha_task(self, task): - """New captcha task for the plugin, it MUST set the handler and timeout or will be ignored""" + """ + New captcha task for the plugin, it MUST set the handler and timeout or will be ignored + """ pass -- cgit v1.2.3 From 20b6a2ec022202b0efb6cb69415239fb8f4d1445 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:59:20 +0200 Subject: Spare code cosmetics (2) --- module/plugins/internal/Hook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 3a0431feb..5959089b5 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -46,7 +46,7 @@ class Hook(Plugin): #: automatically register event listeners for functions, attribute will be deleted dont use it yourself self.event_map = {} - # Deprecated alternative to event_map + #: Deprecated alternative to event_map #: List of events the plugin can handle, name the functions exactly like eventname. self.event_list = [] #@NOTE: dont make duplicate entries in event_map @@ -68,7 +68,7 @@ class Hook(Plugin): else: self.manager.addEvent(event, getattr(self, funcs)) - # delete for various reasons + #: delete for various reasons self.event_map = None if self.event_list: -- cgit v1.2.3 From b1759bc440cd6013837697eb8de540914f693ffd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Jul 2015 01:23:55 +0200 Subject: No camelCase style anymore --- module/plugins/internal/Hook.py | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 5959089b5..7ef8f0189 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -25,7 +25,7 @@ def threaded(fn): class Hook(Plugin): __name__ = "Hook" __type__ = "hook" - __version__ = "0.08" + __version__ = "0.09" __config__ = [] #: [("name", "type", "desc", "default")] __threaded__ = [] #@TODO: Remove in 0.4.10 @@ -72,7 +72,7 @@ class Hook(Plugin): self.event_map = None if self.event_list: - self.logDebug("Deprecated method `event_list`, use `event_map` instead") + self.log_debug("Deprecated method `event_list`, use `event_map` instead") for f in self.event_list: self.manager.addEvent(f, getattr(self, f)) @@ -85,8 +85,8 @@ class Hook(Plugin): #: Deprecated method, use `init_periodical` instead - def initPeriodical(self): - return self.init_periodical() + def initPeriodical(self, *args, **kwargs): + return self.init_periodical(*args, **kwargs) def _periodical(self, threaded): @@ -98,7 +98,7 @@ class Hook(Plugin): self.periodical() except Exception, e: - self.logError(_("Error executing hook: %s") % e) + self.log_error(_("Error executing hook: %s") % e) if self.core.debug: traceback.print_exc() @@ -124,12 +124,12 @@ class Hook(Plugin): """ Checks if hook is activated """ - return self.getConfig("activated") + return self.get_config("activated") #: Deprecated method, use `is_activated` instead - def isActivated(self): - return self.is_activated() + def isActivated(self, *args, **kwargs): + return self.is_activated(*args, **kwargs) def deactivate(self): @@ -140,8 +140,8 @@ class Hook(Plugin): #: Deprecated method, use `deactivate` instead - def unload(self): - return self.deactivate() + def unload(self, *args, **kwargs): + return self.deactivate(*args, **kwargs) def activate(self): @@ -152,8 +152,8 @@ class Hook(Plugin): #: Deprecated method, use `activate` instead - def coreReady(self): - return self.activate() + def coreReady(self, *args, **kwargs): + return self.activate(*args, **kwargs) def exit(self): @@ -164,8 +164,8 @@ class Hook(Plugin): #: Deprecated method, use `exit` instead - def coreExiting(self): - return self.exit() + def coreExiting(self, *args, **kwargs): + return self.exit(*args, **kwargs) def download_preparing(self, pyfile): @@ -173,8 +173,8 @@ class Hook(Plugin): #: Deprecated method, use `download_preparing` instead - def downloadPreparing(self, pyfile): - return self.download_preparing(pyfile) + def downloadPreparing(self, *args, **kwargs): + return self.download_preparing(*args, **kwargs) def download_finished(self, pyfile): @@ -182,8 +182,8 @@ class Hook(Plugin): #: Deprecated method, use `download_finished` instead - def downloadFinished(self, pyfile): - return self.download_finished(pyfile) + def downloadFinished(self, *args, **kwargs): + return self.download_finished(*args, **kwargs) def download_failed(self, pyfile): @@ -191,8 +191,8 @@ class Hook(Plugin): #: Deprecated method, use `download_failed` instead - def downloadFailed(self, pyfile): - return self.download_failed(pyfile) + def downloadFailed(self, *args, **kwargs): + return self.download_failed(*args, **kwargs) def package_finished(self, pypack): @@ -200,8 +200,8 @@ class Hook(Plugin): #: Deprecated method, use `package_finished` instead - def packageFinished(self, pypack): - return self.package_finished(pypack) + def packageFinished(self, *args, **kwargs): + return self.package_finished(*args, **kwargs) def before_reconnect(self, ip): @@ -209,8 +209,8 @@ class Hook(Plugin): #: Deprecated method, use `before_reconnect` instead - def beforeReconnecting(self, ip): - return self.before_reconnect(ip) + def beforeReconnecting(self, *args, **kwargs): + return self.before_reconnect(*args, **kwargs) def after_reconnect(self, ip, oldip): @@ -230,8 +230,8 @@ class Hook(Plugin): #: Deprecated method, use `captcha_task` instead - def newCaptchaTask(self, task): - return self.captcha_task(task) + def newCaptchaTask(self, *args, **kwargs): + return self.captcha_task(*args, **kwargs) def captcha_correct(self, task): @@ -239,8 +239,8 @@ class Hook(Plugin): #: Deprecated method, use `captcha_correct` instead - def captchaCorrect(self, task): - return self.captcha_correct(task) + def captchaCorrect(self, *args, **kwargs): + return self.captcha_correct(*args, **kwargs) def captcha_invalid(self, task): @@ -248,5 +248,5 @@ class Hook(Plugin): #: Deprecated method, use `captcha_invalid` instead - def captchaInvalid(self, task): - return self.captcha_invalid(task) + def captchaInvalid(self, *args, **kwargs): + return self.captcha_invalid(*args, **kwargs) -- cgit v1.2.3 From dad722ac7255640e7e0541c4094a4d2e4de79cd3 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 00:05:58 +0200 Subject: Code cosmetics (2) --- module/plugins/internal/Hook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 7ef8f0189..162c9ecbf 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -43,7 +43,7 @@ class Hook(Plugin): #: `HookManager` self.manager = manager - #: automatically register event listeners for functions, attribute will be deleted dont use it yourself + #: Automatically register event listeners for functions, attribute will be deleted dont use it yourself self.event_map = {} #: Deprecated alternative to event_map @@ -68,7 +68,7 @@ class Hook(Plugin): else: self.manager.addEvent(event, getattr(self, funcs)) - #: delete for various reasons + #: Delete for various reasons self.event_map = None if self.event_list: -- cgit v1.2.3 From 502517f37c7540b0bddb092e69386d9d6f08800c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 09:42:34 +0200 Subject: Fix addons --- module/plugins/internal/Hook.py | 238 +--------------------------------------- 1 file changed, 4 insertions(+), 234 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 162c9ecbf..a17037a11 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -1,34 +1,14 @@ # -*- coding: utf-8 -*- -import traceback +from module.plugins.internal.Addon import Addon -from module.plugins.internal.Plugin import Plugin - -class Expose(object): - """ - Used for decoration to declare rpc services - """ - def __new__(cls, f, *args, **kwargs): - hookManager.addRPC(f.__module__, f.func_name, f.func_doc) - return f - - -def threaded(fn): - - def run(*args, **kwargs): - hookManager.startThread(fn, *args, **kwargs) - - return run - - -class Hook(Plugin): +class Hook(Addon): __name__ = "Hook" __type__ = "hook" - __version__ = "0.09" + __version__ = "0.10" __config__ = [] #: [("name", "type", "desc", "default")] - __threaded__ = [] #@TODO: Remove in 0.4.10 __description__ = """Base hook plugin""" __license__ = "GPLv3" @@ -38,215 +18,5 @@ class Hook(Plugin): def __init__(self, core, manager): - super(Hook, self).__init__(core) - - #: `HookManager` - self.manager = manager - - #: Automatically register event listeners for functions, attribute will be deleted dont use it yourself - self.event_map = {} - - #: Deprecated alternative to event_map - #: List of events the plugin can handle, name the functions exactly like eventname. - self.event_list = [] #@NOTE: dont make duplicate entries in event_map - - #: Callback of periodical job task, used by HookManager - self.cb = None - self.interval = 60 - - self.setup() - self.init_events() + super(Hook, self).__init__(core, manager) self.init_periodical(10) - - - def init_events(self): - if self.event_map: - for event, funcs in self.event_map.iteritems(): - if type(funcs) in (list, tuple): - for f in funcs: - self.manager.addEvent(event, getattr(self, f)) - else: - self.manager.addEvent(event, getattr(self, funcs)) - - #: Delete for various reasons - self.event_map = None - - if self.event_list: - self.log_debug("Deprecated method `event_list`, use `event_map` instead") - - for f in self.event_list: - self.manager.addEvent(f, getattr(self, f)) - - self.event_list = None - - - def init_periodical(self, delay=0, threaded=False): - self.cb = self.core.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded) - - - #: Deprecated method, use `init_periodical` instead - def initPeriodical(self, *args, **kwargs): - return self.init_periodical(*args, **kwargs) - - - def _periodical(self, threaded): - if self.interval < 0: - self.cb = None - return - - try: - self.periodical() - - except Exception, e: - self.log_error(_("Error executing hook: %s") % e) - if self.core.debug: - traceback.print_exc() - - self.cb = self.core.scheduler.addJob(self.interval, self._periodical, [threaded], threaded=threaded) - - - def periodical(self): - pass - - - def __repr__(self): - return "" % self.__name__ - - - def setup(self): - """ - More init stuff if needed - """ - pass - - - def is_activated(self): - """ - Checks if hook is activated - """ - return self.get_config("activated") - - - #: Deprecated method, use `is_activated` instead - def isActivated(self, *args, **kwargs): - return self.is_activated(*args, **kwargs) - - - def deactivate(self): - """ - Called when hook was deactivated - """ - pass - - - #: Deprecated method, use `deactivate` instead - def unload(self, *args, **kwargs): - return self.deactivate(*args, **kwargs) - - - def activate(self): - """ - Called when hook was activated - """ - pass - - - #: Deprecated method, use `activate` instead - def coreReady(self, *args, **kwargs): - return self.activate(*args, **kwargs) - - - def exit(self): - """ - Called by core.shutdown just before pyLoad exit - """ - pass - - - #: Deprecated method, use `exit` instead - def coreExiting(self, *args, **kwargs): - return self.exit(*args, **kwargs) - - - def download_preparing(self, pyfile): - pass - - - #: Deprecated method, use `download_preparing` instead - def downloadPreparing(self, *args, **kwargs): - return self.download_preparing(*args, **kwargs) - - - def download_finished(self, pyfile): - pass - - - #: Deprecated method, use `download_finished` instead - def downloadFinished(self, *args, **kwargs): - return self.download_finished(*args, **kwargs) - - - def download_failed(self, pyfile): - pass - - - #: Deprecated method, use `download_failed` instead - def downloadFailed(self, *args, **kwargs): - return self.download_failed(*args, **kwargs) - - - def package_finished(self, pypack): - pass - - - #: Deprecated method, use `package_finished` instead - def packageFinished(self, *args, **kwargs): - return self.package_finished(*args, **kwargs) - - - def before_reconnect(self, ip): - pass - - - #: Deprecated method, use `before_reconnect` instead - def beforeReconnecting(self, *args, **kwargs): - return self.before_reconnect(*args, **kwargs) - - - def after_reconnect(self, ip, oldip): - pass - - - #: Deprecated method, use `after_reconnect` instead - def afterReconnecting(self, ip): - return self.after_reconnect(ip, None) - - - def captcha_task(self, task): - """ - New captcha task for the plugin, it MUST set the handler and timeout or will be ignored - """ - pass - - - #: Deprecated method, use `captcha_task` instead - def newCaptchaTask(self, *args, **kwargs): - return self.captcha_task(*args, **kwargs) - - - def captcha_correct(self, task): - pass - - - #: Deprecated method, use `captcha_correct` instead - def captchaCorrect(self, *args, **kwargs): - return self.captcha_correct(*args, **kwargs) - - - def captcha_invalid(self, task): - pass - - - #: Deprecated method, use `captcha_invalid` instead - def captchaInvalid(self, *args, **kwargs): - return self.captcha_invalid(*args, **kwargs) -- cgit v1.2.3 From d38e830b7c0b3c6561a0072c74bbccb5fcdf4a61 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 14:43:42 +0200 Subject: New __status__ magic key --- module/plugins/internal/Hook.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index a17037a11..c3b14ef73 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -7,6 +7,7 @@ class Hook(Addon): __name__ = "Hook" __type__ = "hook" __version__ = "0.10" + __status__ = "stable" __config__ = [] #: [("name", "type", "desc", "default")] -- cgit v1.2.3 From 94d017cd2a5c1f194960827a8c7e46afc3682008 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 06:55:49 +0200 Subject: Hotfixes (2) --- module/plugins/internal/Hook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index c3b14ef73..fbd6934ce 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -7,7 +7,7 @@ class Hook(Addon): __name__ = "Hook" __type__ = "hook" __version__ = "0.10" - __status__ = "stable" + __status__ = "testing" __config__ = [] #: [("name", "type", "desc", "default")] -- cgit v1.2.3 From ecf37227de05c73b7ffe2da89a5eda1259a72543 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Jul 2015 01:09:59 +0200 Subject: Improve _log method --- module/plugins/internal/Hook.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index fbd6934ce..3d8fb0dde 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -6,7 +6,7 @@ from module.plugins.internal.Addon import Addon class Hook(Addon): __name__ = "Hook" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __config__ = [] #: [("name", "type", "desc", "default")] @@ -21,3 +21,8 @@ class Hook(Addon): def __init__(self, core, manager): super(Hook, self).__init__(core, manager) self.init_periodical(10) + + + #@TODO: Remove in 0.4.10 + def _log(self, level, plugintype, pluginname, messages): + return super(self.__name__, self)._log(level, plugintype, pluginname.replace("Hook", ""), messages) -- cgit v1.2.3 From 4135729a0d32abdbe14e422ff91aef74a8e2092c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Jul 2015 02:53:25 +0200 Subject: [Hook] Hotfix _log method --- module/plugins/internal/Hook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 3d8fb0dde..36c85fc19 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -6,7 +6,7 @@ from module.plugins.internal.Addon import Addon class Hook(Addon): __name__ = "Hook" __type__ = "hook" - __version__ = "0.11" + __version__ = "0.12" __status__ = "testing" __config__ = [] #: [("name", "type", "desc", "default")] @@ -25,4 +25,4 @@ class Hook(Addon): #@TODO: Remove in 0.4.10 def _log(self, level, plugintype, pluginname, messages): - return super(self.__name__, self)._log(level, plugintype, pluginname.replace("Hook", ""), messages) + return super(Addon, self)._log(level, plugintype, pluginname.replace("Hook", ""), messages) -- cgit v1.2.3 From 44e7152a5fa2e6a1b85f5e68100d4d19c03f61e4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Jul 2015 16:50:39 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1577 and https://github.com/pyload/pyload/issues/1580 --- module/plugins/internal/Hook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/internal/Hook.py') diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py index 36c85fc19..1f566f824 100644 --- a/module/plugins/internal/Hook.py +++ b/module/plugins/internal/Hook.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Addon import Addon +from module.plugins.internal.Addon import Addon, threaded class Hook(Addon): __name__ = "Hook" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __config__ = [] #: [("name", "type", "desc", "default")] -- cgit v1.2.3