diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-08-10 20:18:37 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-08-10 20:18:37 +0200 |
commit | 922d6aca5f0a1a3ce9e6fb855a3e55c367069943 (patch) | |
tree | b7aaf8748b5332128e5c6b436da0d7e374ca5085 | |
parent | captcha fix (diff) | |
download | pyload-922d6aca5f0a1a3ce9e6fb855a3e55c367069943.tar.xz |
some plugin fixes
-rw-r--r-- | Plugins/UploadedTo.py | 7 | ||||
-rw-r--r-- | captcha/NetloadIn.py | 2 | ||||
-rwxr-xr-x | module/network/Request.py | 38 |
3 files changed, 24 insertions, 23 deletions
diff --git a/Plugins/UploadedTo.py b/Plugins/UploadedTo.py index e163a3230..bbfeb7f19 100644 --- a/Plugins/UploadedTo.py +++ b/Plugins/UploadedTo.py @@ -48,6 +48,8 @@ class UploadedTo(Plugin): thread.wait(self.parent) + pyfile.status.filename = self.get_file_name() + tries += 1 if tries > 5: raise Exception, "Error while preparing DL, HTML dump: %s" % self.html @@ -75,13 +77,14 @@ class UploadedTo(Plugin): return None def get_file_name(self): - if not self.want_reconnect: + try: file_name = re.search(r"<td><b>\s+(.+)\s", self.html).group(1) file_suffix = re.search(r"</td><td>(\..+)</td></tr>", self.html) if not file_suffix: return file_name return file_name + file_suffix.group(1) - else: + except: + self.parent.status.url = None return self.parent.url def file_exists(self): diff --git a/captcha/NetloadIn.py b/captcha/NetloadIn.py index 9799a6a2b..df8809a6a 100644 --- a/captcha/NetloadIn.py +++ b/captcha/NetloadIn.py @@ -9,7 +9,9 @@ class NetloadIn(OCR): self.to_greyscale() self.clean(3) self.clean(3) + self.logger.debug("Start tesseract") self.run_tesser() + self.logger.debug("Finished tesseract") self.correct({ ("$", "g"): "5", diff --git a/module/network/Request.py b/module/network/Request.py index 8e3ece456..a2bc3ec3d 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -147,27 +147,23 @@ class Request: if not self.dl: self.dl = True file = open(filename, 'wb') - try: - conn = self.downloader.open(req, post) - if conn.headers.has_key("content-length"): - self.dl_size = int(conn.headers["content-length"]) - else: - self.dl_size = 0 - self.dl_arrived = 0 - self.dl_time = time.time() - for chunk in conn: - if self.abort: raise AbortDownload - self.dl_arrived += len(chunk) - file.write(chunk) - - file.close() - self.dl = False - self.dl_finished = time.time() - return True - except HTTPError, e: - print e - except URLError, e: - print e + + conn = self.downloader.open(req, post) + if conn.headers.has_key("content-length"): + self.dl_size = int(conn.headers["content-length"]) + else: + self.dl_size = 0 + self.dl_arrived = 0 + self.dl_time = time.time() + for chunk in conn: + if self.abort: raise AbortDownload + self.dl_arrived += len(chunk) + file.write(chunk) + + file.close() + self.dl = False + self.dl_finished = time.time() + return True def get_speed(self): try: |