diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/FileDatabase.py | 3 | ||||
-rwxr-xr-x | module/network/Request.py | 7 | ||||
-rw-r--r-- | module/plugins/captcha/GigasizeCom.py | 8 | ||||
-rw-r--r-- | module/plugins/captcha/captcha.py | 5 |
4 files changed, 15 insertions, 8 deletions
diff --git a/module/FileDatabase.py b/module/FileDatabase.py index 62f42917e..b8116d14e 100644 --- a/module/FileDatabase.py +++ b/module/FileDatabase.py @@ -347,6 +347,7 @@ class FileHandler: self.cache[id].abortDownload() self.cache[id].status = 3 self.cache[id].name = self.cache[id].url + self.cache[id].error = "" self.cache[id].sync() else: self.db.restartFile(id) @@ -679,7 +680,7 @@ class FileDatabaseBackend(Thread): @async def restartFile(self, id): - self.c.execute('UPDATE links SET status=3 WHERE id=?', ( str(id), ) ) + self.c.execute('UPDATE links SET status=3,error="" WHERE id=?', ( str(id), ) ) @async def restartPackage(self, id): diff --git a/module/network/Request.py b/module/network/Request.py index 7413358d7..45fd3f66b 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -167,6 +167,13 @@ class Request: self.lastEffectiveURL = self.pycurl.getinfo(pycurl.EFFECTIVE_URL) self.addCookies() + #reset progress + + self.dl_time = 0 + self.dl_finished = 0 + self.dl_size = 0 + self.dl_arrived = 0 + self.lastURL = url header = self.get_header() diff --git a/module/plugins/captcha/GigasizeCom.py b/module/plugins/captcha/GigasizeCom.py index 136092181..d31742eb5 100644 --- a/module/plugins/captcha/GigasizeCom.py +++ b/module/plugins/captcha/GigasizeCom.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from captcha import OCR class GigasizeCom(OCR): @@ -7,9 +8,12 @@ class GigasizeCom(OCR): def get_captcha(self, image): self.load_image(image) self.threshold(2.8) - self.run_gocr() + self.run_tesser(True, False, False, True) return self.result_captcha if __name__ == '__main__': ocr = GigasizeCom() - print ocr.get_captcha('gigasize-com/7.jpg') + import urllib + urllib.urlretrieve('http://www.gigasize.com/randomImage.php', "gigasize_tmp.jpg") + + print ocr.get_captcha('gigasize_tmp.jpg') diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index 8b3b4ccbc..12486fbc5 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -77,11 +77,6 @@ class OCR(object): result = thread.e(command, inputdata) return result - def run_gocr(self): - tmp = tempfile.NamedTemporaryFile(suffix=".jpg") - self.image.save(tmp) - self.result_captcha = self.run(['gocr', tmp.name]).replace("\n", "") - def run_tesser(self, subset=False, digits=True, lowercase=True, uppercase=True): #self.logger.debug("create tmp tif") tmp = tempfile.NamedTemporaryFile(suffix=".tif") |