diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-09 19:33:40 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-09 19:33:40 +0200 |
commit | d050a96342627db76dc5ac9af951c948de2fc075 (patch) | |
tree | 7ab189620a2cdcdf0b989266d75b9d6a124350b1 | |
parent | account save function, DELETE OLD accounts.conf !!! (diff) | |
download | pyload-d050a96342627db76dc5ac9af951c948de2fc075.tar.xz |
removed gocr dependency
-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 | ||||
-rwxr-xr-x | pyLoadCore.py | 3 | ||||
-rw-r--r-- | systemCheck.py | 13 |
6 files changed, 21 insertions, 18 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") diff --git a/pyLoadCore.py b/pyLoadCore.py index 2bc2a946e..644ccf925 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -182,11 +182,10 @@ class Core(object): #@TODO refractor self.check_install("Crypto", _("pycrypto to decode container files")) - self.check_install("Image", _("Python Image Libary (PIL) for captha reading")) + self.check_install("Image", _("Python Image Libary (PIL) for captcha reading")) self.check_install("pycurl", _("pycurl to download any files"), True, True) self.check_install("django", _("Django for webinterface")) self.check_install("tesseract", _("tesseract for captcha reading"), False) - self.check_install("gocr", _("gocr for captcha reading"), False) self.check_file(self.config['general']['download_folder'], _("folder for downloads"), True) diff --git a/systemCheck.py b/systemCheck.py index 70de6d123..85c37873d 100644 --- a/systemCheck.py +++ b/systemCheck.py @@ -5,6 +5,8 @@ from os.path import join import subprocess import sys +from module import InitHomeDir + def main(): print "##### System Information #####" print "" @@ -59,8 +61,8 @@ def main(): core_err = [] core_info = [] - if sys.version_info > (2, 7): - core_err.append("Your python version is to new, Please use Python 2.6") + if sys.version_info > (2, 8): + core_err.append("Your python version is to new, Please use Python 2.6/2.7") if sys.version_info < (2, 5): core_err.append("Your python version is to old, Please use at least Python 2.5") @@ -88,11 +90,6 @@ def main(): core_err.append("Please install tesseract to use Hoster, which uses captchas.") try: - p = subprocess.call(["gocr"], stdout=pipe, stderr=pipe) - except: - core_info.append("Install gocr to use some Hoster, which uses captchas.") - - try: import OpenSSL except: core_info.append("Install OpenSSL if you want to create a secure connection to the core.") @@ -148,7 +145,7 @@ def main(): except: web_err.append("Webinterface won't work without django !!") - if not exists(join(dirname(__file__), "module", "web", "pyload.db")): + if not exists("pyload.db"): web_err.append("You dont have created database yet.") web_err.append("Please run: python %s syncdb" % join(dirname(__file__), "module", "web", "manage.py")) |