diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-09-10 17:18:31 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2009-09-10 17:18:31 +0200 |
commit | 741096db58bb86a1e73e101d540959390b213436 (patch) | |
tree | cfd40abb16209c35bd4457f8c190eb2a81e842ba | |
parent | cat replacement (diff) | |
download | pyload-741096db58bb86a1e73e101d540959390b213436.tar.xz |
save specific download folder
-rw-r--r-- | module/file_list.py | 19 | ||||
-rwxr-xr-x | module/network/Request.py | 3 | ||||
-rw-r--r-- | module/plugins/Plugin.py | 4 |
3 files changed, 15 insertions, 11 deletions
diff --git a/module/file_list.py b/module/file_list.py index fadab0425..244132905 100644 --- a/module/file_list.py +++ b/module/file_list.py @@ -18,7 +18,7 @@ # ### -LIST_VERSION = 2 +LIST_VERSION = 3 from threading import RLock from download_thread import Status @@ -34,22 +34,23 @@ class File_List(object): self.lock = RLock() self.load() - def new_pyfile(self, url): + def new_pyfile(self, url, folder): url = url.replace("\n", "") pyfile = PyLoadFile(self.core, url) pyfile.download_folder = self.core.config['general']['download_folder'] pyfile.id = self.get_id() + pyfile.folder = folder return pyfile - def append(self, url): + def append(self, url, folder=""): if not url: return False #@TODO: filter non existence and invalid links #re.compile("https?://[-a-z0-9\.]{4,}(?::\d+)?/[^#?]+(?:#\S+)?",re.IGNORECASE) - new_file = self.new_pyfile(url) + new_file = self.new_pyfile(url, folder) self.files.append(new_file) - self.data[new_file.id] = Data(url) + self.data[new_file.id] = Data(url, folder) self.data['order'].append(int(new_file.id)) def extend(self, urls): @@ -126,7 +127,7 @@ class File_List(object): obj = {'version': LIST_VERSION, 'order': []} for i in obj['order']: - self.append(obj[i].url) + self.append(obj[i].url, obj[i].folder) self.core.logger.info("Links loaded: " + str(int(len(obj) - 2))) @@ -138,8 +139,9 @@ class File_List(object): self.core.server.push_all(obj) class Data(): - def __init__(self, url): + def __init__(self, url, folder=""): self.url = url + self.folder = folder class PyLoadFile: """ represents the url or file @@ -148,6 +150,7 @@ class PyLoadFile: self.parent = parent self.id = None self.url = url + self.folder = None self.filename = "filename" self.download_folder = "" self.modul = __import__(self._get_my_plugin()) @@ -169,5 +172,5 @@ class PyLoadFile: if self.parent.config['proxy']['activated']: self.plugin.req.add_proxy(self.parent.config['proxy']['protocol'], self.parent.config['proxy']['adress']) - #@todo: check dependicies, ocr etc + #@TODO: check dependicies, ocr etc diff --git a/module/network/Request.py b/module/network/Request.py index 084c84f95..742111a2a 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -5,6 +5,7 @@ """ authored by: RaNaN, Spoob """ +import os import base64 import cookielib from gzip import GzipFile @@ -204,7 +205,7 @@ class Request: self.opener.add_handler(handler) self.downloader.add_handler(handler) - def download(self, url, file_name, get={}, post={}, ref=True, cookies=False): + def download(self, url, file_name, folder="", get={}, post={}, ref=True, cookies=False): if post: post = urllib.urlencode(post) diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 5b3c7ee8c..011f0e8f5 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -96,8 +96,8 @@ class Plugin(): self.download_html() return self.time_plus_wait - def proceed(self, url, location): - self.req.download(url, location) + def proceed(self, url, location, folder=""): + self.req.download(url, location, folder) def set_config(self): pass |