diff options
author | mkaay <mkaay@mkaay.de> | 2010-12-22 23:44:33 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-12-22 23:44:33 +0100 |
commit | c66a630a502a5e118d8773b32820aca861ce32cd (patch) | |
tree | fa7b4c5d0f107fb2448a3f399041927182e098a5 /module/plugins | |
parent | final cookie fix :D (diff) | |
download | pyload-c66a630a502a5e118d8773b32820aca861ce32cd.tar.xz |
new download backend integrated so far, downloading works, but still big todo list
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Plugin.py | 19 | ||||
-rw-r--r-- | module/plugins/hoster/RapidshareCom.py | 3 | ||||
-rw-r--r-- | module/plugins/hoster/UploadedTo.py | 5 |
3 files changed, 20 insertions, 7 deletions
diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index f2c3b18eb..4af3d0d8b 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -42,6 +42,8 @@ from mimetypes import guess_type from itertools import islice +from module.network.helper import waitFor + def chunks(iterable, size): it = iter(iterable) item = list(islice(it, size)) @@ -86,6 +88,8 @@ class Plugin(object): self.wantReconnect = False self.multiDL = True self.limitDL = 0 + self.chunkLimit = 1 + self.resumeDownload = False self.waitUntil = 0 # time() + wait in seconds self.waiting = False @@ -113,7 +117,12 @@ class Plugin(object): self.js = self.core.js # js engine #self.setup() - + + def getChunkCount(self): + if self.chunkLimit <= 0: + return self.config["general"]["chunks"] + return min(self.config["general"]["chunks"], self.chunkLimit) + def __call__(self): return self.__name__ @@ -283,7 +292,7 @@ class Plugin(object): """ returns the content loaded """ if self.pyfile.abort: raise Abort - res = self.req.load(url, get, post, ref, cookies, just_header, no_post_encode, raw_cookies) + res = self.req.getPage(url, get=get, post=post, cookies=cookies) if self.core.debug: from inspect import currentframe frame = currentframe() @@ -320,8 +329,10 @@ class Plugin(object): self.log.warning(_("Setting User and Group failed: %s") % str(e)) name = self.pyfile.name.encode(sys.getfilesystemencoding(), "replace") - newname = self.req.download(url, name, location, get, post, ref, cookies) - newname = basename(newname) + filename = join(location, name) + d = self.req.httpDownload(url, filename, get=get, post=post, chunks=self.getChunkCount(), resume=self.resumeDownload) + waitFor(d) + newname = basename(filename) self.pyfile.size = self.req.dl_size diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index 8370aebb7..8163ffc44 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -66,7 +66,8 @@ class RapidshareCom(Hoster): if self.account: self.multiDL = True - self.req.canContinue = True + self.chunkLimit = -1 + self.resumeDownload = True def process(self, pyfile): self.url = self.pyfile.url diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 5d4798d4e..1bfafc9c6 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -38,7 +38,8 @@ class UploadedTo(Hoster): self.url = False if self.account: self.multiDL = True - self.req.canContinue = True + self.chunkLimit = -1 + self.resumeDownload = True def process(self, pyfile): @@ -157,4 +158,4 @@ class UploadedTo(Hoster): url = url.replace("/?id=", "/file/") url = url.replace("?id=", "file/") url = re.sub("/\?(.*?)&id=", "/file/", url, 1) - return url
\ No newline at end of file + return url |