diff options
-rw-r--r-- | module/XMLConfigParser.py | 6 | ||||
-rw-r--r-- | module/file_list.py | 7 | ||||
-rw-r--r-- | module/plugins/hooks/ContainerDownload.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/Hook.py | 16 | ||||
-rwxr-xr-x | pyLoadCli.py | 31 |
5 files changed, 35 insertions, 27 deletions
diff --git a/module/XMLConfigParser.py b/module/XMLConfigParser.py index 0d2094dae..5b1966152 100644 --- a/module/XMLConfigParser.py +++ b/module/XMLConfigParser.py @@ -101,16 +101,16 @@ class XMLConfigParser(): if opt.nodeType == opt.ELEMENT_NODE: if option == opt.tagName: replace = opt - text = self.createTextNode(value) + text = self.xml.createTextNode(str(value)) if replace: replace.replaceChild(text, replace.firstChild) else: - newNode = self.createElement(option) + newNode = self.xml.createElement(option) newNode.appendChild(text) if sectionNode: sectionNode.appendChild(newNode) else: - newSection = self.createElement(section) + newSection = self.xml.createElement(section) newSection.appendChild(newNode) root.appendChild(newSection) self.saveData() diff --git a/module/file_list.py b/module/file_list.py index e7b80f26d..ef47df6d9 100644 --- a/module/file_list.py +++ b/module/file_list.py @@ -143,6 +143,13 @@ class File_List(object): files.append(pyfile) return files + def getAllFiles(self): + files = [] + for pypack in self.data["queue"] + self.data["packages"]: + for pyfile in pypack.files: + files.append(pyfile) + return files + def countDownloads(self): return len(self.getDownloadList()) diff --git a/module/plugins/hooks/ContainerDownload.py b/module/plugins/hooks/ContainerDownload.py index d031cdf69..417b42ee8 100644 --- a/module/plugins/hooks/ContainerDownload.py +++ b/module/plugins/hooks/ContainerDownload.py @@ -35,6 +35,8 @@ class ContainerDownload(Hook): def downloadFinished(self, pyfile): filename = pyfile.status.filename + if not pyfile.url.startswith("http"): + return if filename.endswith(".dlc") or filename.endswith(".ccf") or filename.endswith(".rsdf"): self.logger.info("ContainerDownload hook: adding container file") location = abspath(join(pyfile.folder, filename)) diff --git a/module/plugins/hooks/Hook.py b/module/plugins/hooks/Hook.py index f02432718..09b21ba49 100644 --- a/module/plugins/hooks/Hook.py +++ b/module/plugins/hooks/Hook.py @@ -19,10 +19,15 @@ """ import logging +from os.path import join + +from module.XMLConfigParser import XMLConfigParser class Hook(): def __init__(self, core): self.logger = logging.getLogger("log") + self.configParser = XMLConfigParser(join("module","config","plugin.xml"), join("module","config","plugin_default.xml")) + self.config = {} props = {} props['name'] = "Hook" props['version'] = "0.1" @@ -32,6 +37,17 @@ class Hook(): self.props = props self.core = core + def readConfig(self): + self.configParser.loadData() + section = self.props['name'] + try: + self.config = self.configParser.getConfig()[section] + except: + self.setup() + + def setup(self): + pass + def downloadStarts(self, pyfile): pass diff --git a/pyLoadCli.py b/pyLoadCli.py index 18efa7272..42ee5fbab 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -443,37 +443,20 @@ if __name__ == "__main__": config['remote']['listenaddr'], config['remote']['port'] ) - - if len(extraparams) == 4: - username, address, port, password = sys.argv[1:5] - - server_url = "http://%s:%s@%s:%s/" % ( - username, - password, - address, - port, - ) - + if len(extraparams) == 1: + server_url = sys.argv[1] else: username = raw_input("Username: ") address = raw_input("Adress: ") - port = raw_input("Port: ") - ssl = raw_input("Use SSL? (y/[n])") - if ssl == "y": + ssl = raw_input("Use SSL? ([y]/n): ") + if ssl == "y" or ssl == "": ssl = "s" else: ssl = "" - + port = raw_input("Port: ") from getpass import getpass password = getpass("Password: ") - server_url = "http%s://%s:%s@%s:%s/" % ( - ssl, - username, - password, - address, - port, - ) - - + server_url = "http%s://%s:%s@%s:%s/" % (ssl, username, password, address, port) + print server_url cli = pyLoadCli(server_url) |