diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-08-13 12:06:08 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-08-13 12:06:08 +0200 |
commit | ecfd3fcbe4dd04b6074f46383526aa975fe8ed4b (patch) | |
tree | 26ab6beadd9bb0938754f0d38f9b6a487ed6ef35 | |
parent | Added tag v0.1.1 for changeset cc58a87cd432 (diff) | |
download | pyload-ecfd3fcbe4dd04b6074f46383526aa975fe8ed4b.tar.xz |
little fixes
-rw-r--r-- | module/file_list.py | 2 | ||||
-rwxr-xr-x | module/network/Request.py | 14 | ||||
-rw-r--r-- | module/thread_list.py | 9 |
3 files changed, 15 insertions, 10 deletions
diff --git a/module/file_list.py b/module/file_list.py index 8c1c32564..a83ab61a5 100644 --- a/module/file_list.py +++ b/module/file_list.py @@ -56,7 +56,7 @@ class File_List(object): self.append(url) def remove(self, pyfile): - if not self.config['debug_mode']: + if not self.core.config['debug_mode']: if pyfile in self.files: self.files.remove(pyfile) diff --git a/module/network/Request.py b/module/network/Request.py index 86c9996ce..ccf12e756 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -8,6 +8,7 @@ authored by: RaNaN import base64 import cookielib from gzip import GzipFile +import re import time import urllib @@ -52,7 +53,7 @@ class Request: if self.curl: - self.init_curl() + self.init_curl() else: self.cookies = [] @@ -97,9 +98,9 @@ class Request: self.pycurl.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.10") self.pycurl.setopt(pycurl.ENCODING, "gzip, deflate") self.pycurl.setopt(pycurl.HTTPHEADER, ["Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", - "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", - "Connection: keep-alive", - "Keep-Alive: 300"]) + "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7", + "Connection: keep-alive", + "Keep-Alive: 300"]) def load(self, url, get={}, post={}, ref=True, cookies=False): @@ -265,6 +266,10 @@ class Request: def write_header(self, string): self.header += string + try: + self.dl_size = int(re.findall(r"Content-Length:.([0-9]+)", self.header, re.IGNORECASE)[0]) + except: + self.dl_size = 0 def get_rep(self): value = self.rep.getvalue() @@ -294,7 +299,6 @@ class Request: def progress(self, dl_t, dl_d, up_t, up_d): if self.abort: raise AbortDownload - self.dl_size = int(dl_t) self.dl_arrived = int(dl_d) if __name__ == "__main__": diff --git a/module/thread_list.py b/module/thread_list.py index 18e445209..3691c9f5e 100644 --- a/module/thread_list.py +++ b/module/thread_list.py @@ -87,15 +87,15 @@ class Thread_List(object): """manage completing download""" self.lock.acquire() - if pyfile.plugin.req.curl: + if not pyfile.plugin.multi_dl: + self.occ_plugins.remove(pyfile.modul.__name__) + + if pyfile.plugin.req.curl and not pyfile.status == "reconnected": try: pyfile.plugin.req.pycurl.close() except: pass - if not pyfile.plugin.multi_dl: - self.occ_plugins.remove(pyfile.modul.__name__) - self.py_downloading.remove(pyfile) if pyfile.status.type == "finished": @@ -106,6 +106,7 @@ class Thread_List(object): if pyfile.plugin.props['type'] == "container": self.list.extend(pyfile.plugin.links) + elif pyfile.status.type == "reconnected":#put it back in queque self.list.files.insert(0, pyfile) |