summaryrefslogtreecommitdiffstats
path: root/module/Plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/Plugin.py')
-rw-r--r--module/Plugin.py17
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