diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-09-21 14:36:22 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-09-21 14:36:22 +0200 |
commit | f9fc367427e30b7a3ca2ccad6144cb76b21f0257 (patch) | |
tree | d35656dd6253edcfdd4d19efe1756c0fddacaf27 /module/plugins/hoster/Ftp.py | |
parent | Fix pyfile.name processing (diff) | |
download | pyload-f9fc367427e30b7a3ca2ccad6144cb76b21f0257.tar.xz |
Spare code cosmetics
Diffstat (limited to 'module/plugins/hoster/Ftp.py')
-rw-r--r-- | module/plugins/hoster/Ftp.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 25eb44604..c9f5fa6b6 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -35,6 +35,7 @@ class Ftp(Hoster): pyfile.name = parsed_url.path.rpartition('/')[2] try: pyfile.name = urllib.unquote(str(pyfile.name)).decode('utf8') + except Exception: pass @@ -63,16 +64,22 @@ class Ftp(Hoster): if m: pyfile.size = int(m.group(1)) self.download(pyfile.url) + else: #: Naive ftp directory listing if re.search(r'^25\d.*?"', self.req.http.header, re.M): pyfile.url = pyfile.url.rstrip('/') pkgname = "/".join([pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]]) + pyfile.url += '/' + self.req.http.c.setopt(48, 1) #: CURLOPT_DIRLISTONLY res = self.load(pyfile.url, decode=False) + links = [pyfile.url + x for x in res.splitlines()] self.log_debug("LINKS", links) + self.pyload.api.addPackage(pkgname, links) + else: self.fail(_("Unexpected server response")) |