diff options
author | mkaay <mkaay@mkaay.de> | 2010-01-03 16:21:53 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-01-03 16:21:53 +0100 |
commit | ae4f0dfc38c49e19ef2b290f0974df9923bf1b94 (patch) | |
tree | c537601a7cf8e61f66ed8434f0be5002d9bf3190 /module/Plugin.py | |
parent | Full Config File (diff) | |
download | pyload-ae4f0dfc38c49e19ef2b290f0974df9923bf1b94.tar.xz |
SecuredIn plugin
Diffstat (limited to 'module/Plugin.py')
-rw-r--r-- | module/Plugin.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/module/Plugin.py b/module/Plugin.py index c33e0d565..7854aa66d 100644 --- a/module/Plugin.py +++ b/module/Plugin.py @@ -21,10 +21,13 @@ import logging import re from os.path import exists, join +from time import sleep from module.network.Request import Request from module.XMLConfigParser import XMLConfigParser +from module.download_thread import CaptchaError + class Plugin(): def __init__(self, parent): @@ -145,3 +148,17 @@ class Plugin(): 20 - unknown error """ return (True, 10) + + def waitForCaptcha(self, captchaData, imgType): + captchaManager = self.parent.core.captchaManager + task = captchaManager.newTask(self) + task.setCaptcha(captchaData, imgType) + task.setWaiting() + while not task.getStatus() == "done": + if not self.parent.core.isGUIConnected(): + task.removeTask() + raise CaptchaError + sleep(1) + result = task.getResult() + task.removeTask() + return result |