From 6cdb1ae0fe8f4faf897220d0520ca3e753e9f3e4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 16 Apr 2015 17:48:30 +0200 Subject: [config] Use get method instead dict access --- pyload/manager/Thread.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'pyload/manager/Thread.py') diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py index dd1582eb7..1f1a2dc5c 100644 --- a/pyload/manager/Thread.py +++ b/pyload/manager/Thread.py @@ -150,7 +150,7 @@ class ThreadManager(object): def tryReconnect(self): """checks if reconnect needed""" - if not (self.core.config["reconnect"]["activated"] and self.core.api.isTimeReconnect()): + if not (self.core.config.get("reconnect", "activated") and self.core.api.isTimeReconnect()): return False active = [x.active.plugin.wantReconnect and x.active.plugin.waiting for x in self.threads if x.active] @@ -158,11 +158,11 @@ class ThreadManager(object): if not (0 < active.count(True) == len(active)): return False - if not exists(self.core.config['reconnect']['method']): - if exists(join(pypath, self.core.config['reconnect']['method'])): - self.core.config['reconnect']['method'] = join(pypath, self.core.config['reconnect']['method']) + if not exists(self.core.config.get("reconnect", "method")): + if exists(join(pypath, self.core.config.get("reconnect", "method"))): + self.core.config['reconnect']['method'] = join(pypath, self.core.config.get("reconnect", "method")) else: - self.core.config["reconnect"]["activated"] = False + self.core.config['reconnect']['activated'] = False self.core.log.warning(_("Reconnect script not found!")) return @@ -181,10 +181,10 @@ class ThreadManager(object): self.core.log.debug("Old IP: %s" % ip) try: - reconn = Popen(self.core.config['reconnect']['method'], bufsize=-1, shell=True) # , stdout=subprocess.PIPE) + reconn = Popen(self.core.config.get("reconnect", "method"), bufsize=-1, shell=True) # , stdout=subprocess.PIPE) except Exception: self.core.log.warning(_("Failed executing reconnect script!")) - self.core.config["reconnect"]["activated"] = False + self.core.config['reconnect']['activated'] = False self.reconnecting.clear() if self.core.debug: print_exc() @@ -278,8 +278,8 @@ class ThreadManager(object): return if job.plugin.getPluginType() == "hoster": - spaceLeft = freeSpace(self.core.config["general"]["download_folder"]) / 1024 / 1024 - if spaceLeft < self.core.config["general"]["min_free_space"]: + spaceLeft = freeSpace(self.core.config.get("general", "download_folder")) / 1024 / 1024 + if spaceLeft < self.core.config.get("general", "min_free_space"): self.core.log.warning(_("Not enough space left on device")) self.pause = True -- cgit v1.2.3