diff options
author | spoob <spoob@gmx.de> | 2009-09-02 13:19:43 +0200 |
---|---|---|
committer | spoob <spoob@gmx.de> | 2009-09-02 13:19:43 +0200 |
commit | 583f139f4411b06edf3b68fc63679a4d9e618346 (patch) | |
tree | 7f32d3c09cf90ad68666b6985f1a170b685bca55 | |
parent | downtime patch (diff) | |
download | pyload-583f139f4411b06edf3b68fc63679a4d9e618346.tar.xz |
cleaning
-rw-r--r-- | module/Py_Load_File.py | 37 | ||||
-rw-r--r-- | module/file_list.py | 36 | ||||
-rwxr-xr-x | module/network/Request.py | 3 | ||||
-rwxr-xr-x | pyLoadCli.py | 14 | ||||
-rwxr-xr-x | pyLoadCore.py | 1 |
5 files changed, 45 insertions, 46 deletions
diff --git a/module/Py_Load_File.py b/module/Py_Load_File.py deleted file mode 100644 index 278b8f6c7..000000000 --- a/module/Py_Load_File.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -import re - -from download_thread import Status - -class PyLoadFile: - """ represents the url or file - """ - def __init__(self, parent, url): - self.parent = parent - self.id = None - self.url = url - self.filename = "filename" - self.download_folder = "" - self.modul = __import__(self._get_my_plugin()) - pluginClass = getattr(self.modul, self.modul.__name__) - self.plugin = pluginClass(self) - self.status = Status(self) - - def _get_my_plugin(self): - """ searches the right plugin for an url - """ - for plugin, plugin_pattern in self.parent.plugins_avaible.items(): - if re.match(plugin_pattern, self.url) != None: - return plugin - - return "Plugin" - - def init_download(self): - - 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 - diff --git a/module/file_list.py b/module/file_list.py index e3c3f68ae..b7455410c 100644 --- a/module/file_list.py +++ b/module/file_list.py @@ -23,7 +23,6 @@ LIST_VERSION = 2 from threading import RLock import cPickle -from Py_Load_File import PyLoadFile from module.remote.RequestObject import RequestObject class File_List(object): @@ -139,3 +138,38 @@ class File_List(object): class Data(): def __init__(self, url): self.url = url + +import re + +from download_thread import Status + +class PyLoadFile: + """ represents the url or file + """ + def __init__(self, parent, url): + self.parent = parent + self.id = None + self.url = url + self.filename = "filename" + self.download_folder = "" + self.modul = __import__(self._get_my_plugin()) + pluginClass = getattr(self.modul, self.modul.__name__) + self.plugin = pluginClass(self) + self.status = Status(self) + + def _get_my_plugin(self): + """ searches the right plugin for an url + """ + for plugin, plugin_pattern in self.parent.plugins_avaible.items(): + if re.match(plugin_pattern, self.url) != None: + return plugin + + return "Plugin" + + def init_download(self): + + 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 + diff --git a/module/network/Request.py b/module/network/Request.py index 9adfa41a0..e693afa1d 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -219,8 +219,7 @@ class Request: if self.curl: - download_folder = dirname(file_name) + sep - file_temp = download_folder + str(time.time()) + ".part" + file_temp = file_name + ".part" fp = open(file_temp, 'wb') self.init_curl() diff --git a/pyLoadCli.py b/pyLoadCli.py index d01dc2280..2f94fb2ce 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -18,6 +18,7 @@ # ### import ConfigParser +import subprocess import os import os.path import sys @@ -315,8 +316,8 @@ def white(string): if __name__ == "__main__": - if len(sys.argv) == 2: - + if len(sys.argv) > 1: + shortOptions = 'l' longOptions = ['local'] @@ -330,13 +331,16 @@ if __name__ == "__main__": port = config.get("remote", "port") password = config.get("remote", "password") - elif len(sys.argv) != 4: + if len(extraparams) == 3: + address, port, password = sys.argv[1:4] + else: address = raw_input("Adress:") port = raw_input("Port:") password = raw_input("Password:") - else: - address, port, password = sys.argv[1:4] + print address + print port + print password cli = pyLoadCli(address, port, password) diff --git a/pyLoadCore.py b/pyLoadCore.py index b92d61114..049160e49 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -18,7 +18,6 @@ # ### CURRENT_VERSION = '0.1.1' -print_test_status = False import ConfigParser import gettext |