diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-08-02 09:16:39 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-08-02 09:16:39 +0200 |
commit | 04f4b7aa724454a69588ecc9fa46f7dd6e65c747 (patch) | |
tree | 5964736149857953abef602be65a894ef7d118b1 /module/plugins/internal | |
parent | Fix https://github.com/pyload/pyload/issues/1649 (diff) | |
download | pyload-04f4b7aa724454a69588ecc9fa46f7dd6e65c747.tar.xz |
Fix https://github.com/pyload/pyload/issues/1630
Diffstat (limited to 'module/plugins/internal')
-rw-r--r-- | module/plugins/internal/Captcha.py | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py index 3ebe42a89..8564d88d9 100644 --- a/module/plugins/internal/Captcha.py +++ b/module/plugins/internal/Captcha.py @@ -12,7 +12,7 @@ from module.plugins.internal.Plugin import Plugin class Captcha(Plugin): __name__ = "Captcha" __type__ = "captcha" - __version__ = "0.40" + __version__ = "0.41" __status__ = "testing" __description__ = """Base anti-captcha plugin""" @@ -79,38 +79,38 @@ class Captcha(Plugin): with open(os.path.join("tmp", "captcha_image_%s_%s.%s" % (self.plugin.__name__, time_ref, input_type)), "wb") as tmp_img: tmp_img.write(raw) - if ocr: - if isinstance(ocr, basestring): - OCR = self.pyload.pluginManager.loadClass("captcha", ocr) #: Rename `captcha` to `ocr` in 0.4.10 - result = OCR(self.plugin).recognize(tmp_img.name) - else: - result = self.recognize(tmp_img.name) + if ocr: + if isinstance(ocr, basestring): + OCR = self.pyload.pluginManager.loadClass("captcha", ocr) #: Rename `captcha` to `ocr` in 0.4.10 + result = OCR(self.plugin).recognize(tmp_img.name) + else: + result = self.recognize(tmp_img.name) - if not result: - captchaManager = self.pyload.captchaManager + if not result: + captchaManager = self.pyload.captchaManager - try: - self.task = captchaManager.newTask(raw, input_type, tmp_img.name, output_type) + try: + self.task = captchaManager.newTask(raw, input_type, tmp_img.name, output_type) - captchaManager.handleCaptcha(self.task) + captchaManager.handleCaptcha(self.task) - self.task.setWaiting(max(timeout, 50)) #@TODO: Move to `CaptchaManager` in 0.4.10 - while self.task.isWaiting(): - if self.plugin.pyfile.abort: - self.plugin.abort() - time.sleep(1) + self.task.setWaiting(max(timeout, 50)) #@TODO: Move to `CaptchaManager` in 0.4.10 + while self.task.isWaiting(): + if self.plugin.pyfile.abort: + self.plugin.abort() + time.sleep(1) - finally: - captchaManager.removeTask(self.task) + finally: + captchaManager.removeTask(self.task) - if self.task.error: - self.fail(task.error) + if self.task.error: + self.fail(task.error) - elif not self.task.result: - self.invalid() - self.plugin.retry(reason=_("No captcha result obtained in appropiate time")) + elif not self.task.result: + self.invalid() + self.plugin.retry(reason=_("No captcha result obtained in appropiate time")) - result = self.task.result + result = self.task.result if not self.pyload.debug: try: |