From 52ba83f29d9221c05434857e79f12c44752a321e Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 28 Dec 2010 22:51:10 +0100 Subject: more fixes and chunk+resume debug --- module/plugins/Plugin.py | 13 +++++++------ module/plugins/hooks/MultiHome.py | 2 +- module/plugins/hoster/Ftp.py | 33 ++++++++------------------------- 3 files changed, 16 insertions(+), 32 deletions(-) (limited to 'module/plugins') diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 3da6e5116..a7ee72fd2 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -78,7 +78,6 @@ class Plugin(object): __author_name__ = ("RaNaN", "spoob", "mkaay") __author_mail__ = ("RaNaN@pyload.org", "spoob@pyload.org", "mkaay@mkaay.de") - def __init__(self, pyfile): self.config = pyfile.m.core.config self.core = pyfile.m.core @@ -91,8 +90,6 @@ class Plugin(object): self.waitUntil = 0 # time() + wait in seconds self.waiting = False - - self.premium = False self.ocr = None # captcha reader instance self.account = pyfile.m.core.accountManager.getAccountPlugin(self.__name__) # account handler instance @@ -100,7 +97,8 @@ class Plugin(object): if self.account: self.user, data = self.account.selectAccount() self.req = self.account.getAccountRequest(self.user) - #self.req.canContinue = True + self.chunkLimit = -1 #enable chunks for all premium plugins + self.resumeDownload = True #also enable resume (both will be ignored if server dont accept chunks) else: self.req = pyfile.m.core.requestFactory.getRequest(self.__name__) @@ -286,7 +284,10 @@ class Plugin(object): """ returns the content loaded """ if self.pyfile.abort: raise Abort - res = self.req.getPage(url, get, post, ref, cookies) + if raw_cookies: self.log.warning("Deprecated argument raw cookies: %s" % raw_cookies) + if no_post_encode: self.log.warning("Deprecated argument no_post_encode: %s" % no_post_encode) + + res = self.req.load(url, get, post, ref, cookies, just_header) if self.core.debug: from inspect import currentframe frame = currentframe() @@ -329,7 +330,7 @@ class Plugin(object): name = self.pyfile.name.encode(sys.getfilesystemencoding(), "replace") filename = join(location, name) - self.req.httpDownload(url, filename, get=get, post=post, chunks=self.getChunkCount(), resume=self.resumeDownload) + self.req.httpDownload(url, filename, get=get, post=post, ref=ref, chunks=self.getChunkCount(), resume=self.resumeDownload) newname = basename(filename) diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 88491f6f4..4678412bf 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -34,7 +34,7 @@ class MultiHome(Hook): self.interfaces = [] self.parseInterfaces(self.getConfig("interfaces").split(";")) if not self.interfaces: - self.parseInterfaces([self.config["general"]["download_interface"]]) + self.parseInterfaces([self.config["download"]["interface"]]) self.setConfig("interfaces", self.toConfig()) def toConfig(self): diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 9303b00c8..ca0689c62 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -14,17 +14,10 @@ You should have received a copy of the GNU General Public License along with this program; if not, see . - @author: jeix + @author: jeix @author: mkaay """ -import logging -from os.path import exists -from os.path import join -from os.path import exists -from os import makedirs -import sys - from module.plugins.Hoster import Hoster @@ -38,21 +31,11 @@ class Ftp(Hoster): __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de") def process(self, pyfile): - self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="FTP") + self.req = pyfile.m.core.requestFactory.getRequest(self.__name__) pyfile.name = self.pyfile.url.rpartition('/')[2] - - self.doDownload(pyfile.url, pyfile.name) - - def doDownload(self, url, filename): - self.pyfile.setStatus("downloading") - - download_folder = self.core.config['general']['download_folder'] - location = join(download_folder, self.pyfile.package().folder.decode(sys.getfilesystemencoding())) - if not exists(location): - makedirs(location) - - newname = self.req.download(str(url), join(location, filename.decode(sys.getfilesystemencoding()))) - self.pyfile.size = self.req.dl_size - - if newname: - self.pyfile.name = newname + + self.chunkLimit = -1 + self.resumeDownload = True + + self.download(pyfile.url) + -- cgit v1.2.3