diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-12-28 22:51:10 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-12-28 22:51:10 +0100 |
commit | 52ba83f29d9221c05434857e79f12c44752a321e (patch) | |
tree | 42369d33d8b0116524e26c429c649ec40cec516a /module/plugins | |
parent | working speedlimit + proxy support, closed #197 (diff) | |
download | pyload-52ba83f29d9221c05434857e79f12c44752a321e.tar.xz |
more fixes and chunk+resume debug
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/Plugin.py | 13 | ||||
-rw-r--r-- | module/plugins/hooks/MultiHome.py | 2 | ||||
-rw-r--r-- | module/plugins/hoster/Ftp.py | 33 |
3 files changed, 16 insertions, 32 deletions
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 <http://www.gnu.org/licenses/>.
- @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)
+
|