diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-09 13:41:35 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-01-09 13:41:35 +0100 |
commit | 0b6f6fd4ec80f8805cfa9135980903f3038f4c49 (patch) | |
tree | 7989f1d540d630e629844329817330d5f10d6068 | |
parent | encoding fix (diff) | |
download | pyload-0b6f6fd4ec80f8805cfa9135980903f3038f4c49.tar.xz |
-rw-r--r-- | module/PluginThread.py | 3 | ||||
-rw-r--r-- | module/network/HTTPChunk.py | 15 | ||||
-rw-r--r-- | module/network/HTTPDownload.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/FilesMailRu.py | 5 | ||||
-rw-r--r-- | module/web/pyload/views.py | 11 |
5 files changed, 29 insertions, 9 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py index d5f969f80..67148e325 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -223,6 +223,9 @@ class DownloadThread(PluginThread): if code in (7, 18, 28, 52, 56): self.m.log.warning(_("Couldn't connect to host or connection resetted waiting 1 minute and retry.")) wait = time() + 60 + + pyfile.waitUntil = wait + pyfile.setStatus("waiting") while time() < wait: sleep(1) if pyfile.abort: diff --git a/module/network/HTTPChunk.py b/module/network/HTTPChunk.py index f66121880..eb22fa3c8 100644 --- a/module/network/HTTPChunk.py +++ b/module/network/HTTPChunk.py @@ -142,21 +142,28 @@ class HTTPChunk(HTTPRequest): self.c.setopt(pycurl.WRITEFUNCTION, self.writeBody) self.c.setopt(pycurl.HEADERFUNCTION, self.writeHeader) + # request one byte more, since some servers in russia seems to have a defect arihmetic unit + if self.resume: self.fp = open(self.p.info.getChunkName(self.id), "ab") self.arrived = self.fp.tell() if self.range: - print "Chunked resume with range %i-%i" % (self.arrived+self.range[0], self.range[1]) - self.c.setopt(pycurl.RANGE, "%i-%i" % (self.arrived+self.range[0], self.range[1])) + #do nothing if chunk already finished + if not self.arrived+self.range[0] - self.range[1]: return None + + range = "%i-%i" % (self.arrived+self.range[0], self.range[1]+1) + print "Chunked resume with range %s" % range + self.c.setopt(pycurl.RANGE, range) else: print "Resume File from %i" % self.arrived self.c.setopt(pycurl.RESUME_FROM, self.arrived) else: if self.range: - print "Chunked with range %i-%i" % self.range - self.c.setopt(pycurl.RANGE, "%i-%i" % self.range) + range = "%i-%i" % (self.range[0], self.range[1]+1) + print "Chunked with range %s" % range + self.c.setopt(pycurl.RANGE, range) self.fp = open(self.p.info.getChunkName(self.id), "wb") diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index ecc7f24b8..1c1f53b88 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -146,7 +146,9 @@ class HTTPDownload(): for i in range(1, chunks): c = HTTPChunk(i, self, self.info.getChunkRange(i), resume) self.chunks.append(c) - self.m.add_handle(c.getHandle()) + handle = c.getHandle() + if handle: self.m.add_handle(handle) + while 1: ret, num_handles = self.m.perform() diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 8c73f9cea..3fa40cbd0 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -37,6 +37,11 @@ class FilesMailRu(Hoster): __author_name__ = ("oZiRiz") __author_mail__ = ("ich@oziriz.de") + + def setup(self): + self.multiDL = True + self.resumeDownload = True + self.chunkLimit = -1 def process(self, pyfile): self.html = self.load(pyfile.url) diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index 29ad90867..76f991921 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -145,16 +145,19 @@ def downloads(request): 'files': [] } - for item in listdir(root): + for item in sorted(listdir(root)): if isdir(join(root, item)): folder = { 'name': item, 'path': item, 'files': [] } - for file in listdir(join(root, item)): - if isfile(join(root, item, file)): - folder['files'].append(file) + for file in sorted(listdir(join(root, item))): + try: + if isfile(join(root, item, file)): + folder['files'].append(file) + except: + pass data['folder'].append(folder) elif isfile(join(root, item)): |