diff options
author | mkaay <mkaay@mkaay.de> | 2010-03-30 15:49:01 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-03-30 15:49:01 +0200 |
commit | d56fd050ced8c31eabae7a1ceabe8adaeec6b3bd (patch) | |
tree | 8d6329b93957ca5848f01f76c69d107268f7ad18 /module | |
parent | new server method (get_config) (diff) | |
download | pyload-d56fd050ced8c31eabae7a1ceabe8adaeec6b3bd.tar.xz |
fixes #64
Diffstat (limited to 'module')
-rw-r--r-- | module/XMLConfigParser.py | 8 | ||||
-rw-r--r-- | module/config/core_default.xml | 1 | ||||
-rw-r--r-- | module/thread_list.py | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/module/XMLConfigParser.py b/module/XMLConfigParser.py index bde46afe5..0aede384c 100644 --- a/module/XMLConfigParser.py +++ b/module/XMLConfigParser.py @@ -70,11 +70,13 @@ class XMLConfigParser(): self.xml.writexml(fh) def _read_config(self): - def format(val): + def format(val, t="str"): if val.lower() == "true": return True elif val.lower() == "false": return False + elif t == "int": + return int(val) else: return val root = self.xml.documentElement @@ -92,8 +94,8 @@ class XMLConfigParser(): if opt.nodeType == opt.ELEMENT_NODE: data[section]["options"][opt.tagName] = {} try: - config[section][opt.tagName] = format(opt.firstChild.data) - data[section]["options"][opt.tagName]["value"] = format(opt.firstChild.data) + config[section][opt.tagName] = format(opt.firstChild.data, opt.getAttribute("type")) + data[section]["options"][opt.tagName]["value"] = format(opt.firstChild.data, opt.getAttribute("type")) except: config[section][opt.tagName] = "" data[section]["options"][opt.tagName]["name"] = opt.getAttribute("name") diff --git a/module/config/core_default.xml b/module/config/core_default.xml index 8223768ec..4925c06cf 100644 --- a/module/config/core_default.xml +++ b/module/config/core_default.xml @@ -40,6 +40,7 @@ <max_download_time type="int" name="Max Download Time">5</max_download_time> <download_speed_limit type="int" name="Download Speed Limit">0</download_speed_limit> <checksum type="bool" name="Use Checksum">True</checksum> + <min_free_space type="int" name="Min Free Space (MB)">200</min_free_space> </general> <updates name="Updates"> <search_updates type="bool" name="Search">True</search_updates> diff --git a/module/thread_list.py b/module/thread_list.py index 13dba309e..000e86d27 100644 --- a/module/thread_list.py +++ b/module/thread_list.py @@ -41,7 +41,7 @@ class Thread_List(object): self.lock = RLock() self.py_downloading = [] # files downloading self.occ_plugins = [] #occupied plugins - self.pause = False + self.pause = True self.reconnecting = False self.select_thread() @@ -69,6 +69,10 @@ class Thread_List(object): if not self.parent.server_methods.is_time_download() or self.pause or self.reconnecting or self.list.queueEmpty(): #conditions when threads dont download return None + + if self.parent.freeSpace() < self.parent.config["general"]["min_free_space"]: + self.parent.logger.debug("min free space exceeded") + return None self.init_reconnect() |