diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hooks/ExternalScripts.py | 8 | ||||
-rw-r--r-- | module/plugins/internal/Addon.py | 7 | ||||
-rw-r--r-- | module/plugins/internal/Base.py | 15 | ||||
-rw-r--r-- | module/plugins/internal/Captcha.py | 6 | ||||
-rw-r--r-- | module/plugins/internal/Extractor.py | 6 | ||||
-rw-r--r-- | module/plugins/internal/Hoster.py | 5 | ||||
-rw-r--r-- | module/plugins/internal/MultiCrypter.py | 6 | ||||
-rw-r--r-- | module/plugins/internal/MultiHoster.py | 6 | ||||
-rw-r--r-- | module/plugins/internal/OCR.py | 6 | ||||
-rw-r--r-- | module/plugins/internal/Plugin.py | 8 |
10 files changed, 37 insertions, 36 deletions
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 4309bd3c9..d414d170c 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -84,7 +84,7 @@ class ExternalScripts(Addon): def call(self, script, args=[], lock=None): if lock is None: lock = self.get_config('lock') - + try: script = os.path.abspath(script) args = [script] + map(lambda arg: encode(arg) if isinstance(arg, basestring) else encode(str(arg)), args) @@ -98,12 +98,12 @@ class ExternalScripts(Addon): self.log_error(_("Runtime error: %s") % script, e or _("Unknown error")) - + def _call(self, folder, args=[], lock=None): for script in self.scripts[folder]: self.call(script, args, lock) - - + + def pyload_start(self): self._call('pyload_start') diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py index e5d9a2699..de0852597 100644 --- a/module/plugins/internal/Addon.py +++ b/module/plugins/internal/Addon.py @@ -13,7 +13,6 @@ class Expose(object): def threaded(fn): - def run(*args, **kwargs): hookManager.startThread(fn, *args, **kwargs) @@ -59,6 +58,12 @@ class Addon(Plugin): self.init_events() + #@TODO: Remove in 0.4.10 + def _log(self, level, plugintype, pluginname, messages): + plugintype = "addon" if plugintype is "hook" else plugintype + return super(Addon, self)._log(level, plugintype, pluginname, messages) + + def init_events(self): if self.event_map: for event, funcs in self.event_map.items(): diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py index 7737074b5..865b1d777 100644 --- a/module/plugins/internal/Base.py +++ b/module/plugins/internal/Base.py @@ -96,11 +96,11 @@ class Base(Plugin): def _log(self, level, plugintype, pluginname, messages): log = getattr(self.pyload.log, level) msg = u" | ".join(decode(a).strip() for a in messages if a) - log("%(plugintype)s %(pluginname)s[%(id)s]: %(msg)s" - % {'plugintype': plugintype.upper(), - 'pluginname': pluginname, - 'id' : self.pyfile.id, - 'msg' : msg}) + log("%(plugintype)s %(pluginname)s[%(id)s]: %(msg)s" % + {'plugintype': plugintype.upper(), + 'pluginname': pluginname, + 'id' : self.pyfile.id, + 'msg' : msg}) @classmethod @@ -265,7 +265,10 @@ class Base(Plugin): self.log_debug("Plugin status: " + self.__status__) if self.__status__ is "broken": - self.fail(_("Plugin is currently broken")) + self.fail(_("Plugin is temporarily unavailable")) + + elif self.__status__ is "testing": + self.log_warning(_("Plugin may be unstable")) self.thread = thread self._setup() diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py index e5203c142..4196bcdf3 100644 --- a/module/plugins/internal/Captcha.py +++ b/module/plugins/internal/Captcha.py @@ -37,10 +37,8 @@ class Captcha(Plugin): def _log(self, level, plugintype, pluginname, messages): - return self.plugin._log(level, - plugintype, - self.plugin.__name__, - (self.__name__,) + messages) + messages = (self.__name__,) + messages + return self.plugin._log(level, plugintype, self.plugin.__name__, messages) def recognize(self, image): diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 6bc1ddc71..dfd8105a9 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -124,10 +124,8 @@ class Extractor(Plugin): def _log(self, level, plugintype, pluginname, messages): - return self.plugin._log(level, - plugintype, - self.plugin.__name__, - (self.__name__,) + messages) + messages = (self.__name__,) + messages + return self.plugin._log(level, plugintype, self.plugin.__name__, messages) def verify(self, password=None): diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index eadf4ad7c..cc22a73cd 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -75,7 +75,10 @@ class Hoster(Base): self.log_debug("Plugin status: " + self.__status__) if self.__status__ is "broken": - self.fail(_("Plugin is currently broken")) + self.fail(_("Plugin is temporarily unavailable")) + + elif self.__status__ is "testing": + self.log_warning(_("Plugin may be unstable")) self.thread = thread self._setup() diff --git a/module/plugins/internal/MultiCrypter.py b/module/plugins/internal/MultiCrypter.py index 900f72589..d873da69d 100644 --- a/module/plugins/internal/MultiCrypter.py +++ b/module/plugins/internal/MultiCrypter.py @@ -25,7 +25,5 @@ class MultiCrypter(SimpleCrypter): def _log(self, level, plugintype, pluginname, messages): - return super(MultiCrypter, self)._log(level, - plugintype, - pluginname, - (self.PLUGIN_NAME,) + messages) + messages = (self.PLUGIN_NAME,) + messages + return self.plugin._log(level, plugintype, pluginname, messages) diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index a31a6843b..acecb888b 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -35,10 +35,8 @@ class MultiHoster(SimpleHoster): def _log(self, level, plugintype, pluginname, messages): - return super(MultiHoster, self)._log(level, - plugintype, - pluginname, - (self.PLUGIN_NAME,) + messages) + messages = (self.PLUGIN_NAME,) + messages + return self.plugin._log(level, plugintype, pluginname, messages) def setup(self): diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index 10fd493b7..c78c0c38b 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -42,10 +42,8 @@ class OCR(Plugin): def _log(self, level, plugintype, pluginname, messages): - return self.plugin._log(level, - plugintype, - self.plugin.__name__, - (self.__name__,) + messages) + messages = (self.__name__,) + messages + return self.plugin._log(level, plugintype, self.plugin.__name__, messages) def load_image(self, image): diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 0b5561df8..bbaa16cd2 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -63,10 +63,10 @@ class Plugin(object): def _log(self, level, plugintype, pluginname, messages): log = getattr(self.pyload.log, level) msg = u" | ".join(decode(a).strip() for a in messages if a) - log("%(plugintype)s %(pluginname)s: %(msg)s" - % {'plugintype': plugintype.upper(), - 'pluginname': pluginname, - 'msg' : msg}) + log("%(plugintype)s %(pluginname)s: %(msg)s" % + {'plugintype': plugintype.upper(), + 'pluginname': pluginname, + 'msg' : msg}) def log_debug(self, *args, **kwargs): |