From 29f9dc8fb3396b03d732ebcbeb1cc8f00fe13897 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 25 Aug 2010 18:22:27 +0200 Subject: new dirs --- core/module/plugins/hoster/Ftp.py | 58 --------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 core/module/plugins/hoster/Ftp.py (limited to 'core/module/plugins/hoster/Ftp.py') diff --git a/core/module/plugins/hoster/Ftp.py b/core/module/plugins/hoster/Ftp.py deleted file mode 100644 index 9303b00c8..000000000 --- a/core/module/plugins/hoster/Ftp.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- - -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . - - @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 - - -class Ftp(Hoster): - __name__ = "Ftp" - __version__ = "0.3" - __pattern__ = r'ftp://(.*?:.*?@)?.*?/.*' # ftp://user:password@ftp.server.org/path/to/file - __type__ = "hoster" - __description__ = """A Plugin that allows you to download from an from an ftp directory""" - __author_name__ = ("jeix", "mkaay") - __author_mail__ = ("jeix@hasnomail.com", "mkaay@mkaay.de") - - def process(self, pyfile): - self.req = pyfile.m.core.requestFactory.getRequest(self.__name__, type="FTP") - 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 -- cgit v1.2.3