From 3e87db92c439a4b8378a165f42a01ba142b56a5c Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Fri, 17 Apr 2015 00:50:31 +0200 Subject: Spare code cosmetics (1) --- pyload/manager/Thread.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pyload/manager/Thread.py') diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py index 015bc9ab1..e24b20d59 100644 --- a/pyload/manager/Thread.py +++ b/pyload/manager/Thread.py @@ -160,9 +160,9 @@ class ThreadManager(object): 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")) + self.core.config.set("reconnect", "method", join(pypath, self.core.config.get("reconnect", "method"))) else: - self.core.config['reconnect']['activated'] = False + self.core.config.set("reconnect", "activated", False) self.core.log.warning(_("Reconnect script not found!")) return @@ -184,7 +184,7 @@ class ThreadManager(object): 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.set("reconnect", "activated", False) self.reconnecting.clear() if self.core.debug: print_exc() -- cgit v1.2.3 From e48abf98766b0a9c5799f17073d867dc09b23663 Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Fri, 17 Apr 2015 17:54:19 +0200 Subject: PEP-8, Python Zen, refactor and reduce code (part 3 in master module) Conflicts: module/InitHomeDir.py module/debug.py module/forwarder.py module/unescape.py pyload/datatype/Package.py pyload/manager/Event.py pyload/manager/Thread.py pyload/manager/event/Scheduler.py pyload/utils/__init__.py pyload/webui/filters.py --- pyload/manager/Thread.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'pyload/manager/Thread.py') diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py index e24b20d59..b255523d6 100644 --- a/pyload/manager/Thread.py +++ b/pyload/manager/Thread.py @@ -51,7 +51,7 @@ class ThreadManager(object): pycurl.global_init(pycurl.GLOBAL_DEFAULT) - for i in range(0, self.core.config.get("download", "max_downloads")): + for _i in range(0, self.core.config.get("download", "max_downloads")): self.createThread() @@ -206,7 +206,7 @@ class ThreadManager(object): ("http://checkip.dyndns.org/", ".*Current IP Address: (\S+)</body>.*")] ip = "" - for i in range(10): + for _i in range(10): try: sv = choice(services) ip = getURL(sv[0]) @@ -285,7 +285,7 @@ class ThreadManager(object): if free and not self.pause: thread = free[0] - #self.downloaded += 1 + # self.downloaded += 1 thread.put(job) else: @@ -299,7 +299,6 @@ class ThreadManager(object): if job: job.initPlugin() thread = DecrypterThread(self, job) - else: thread = DecrypterThread(self, job) -- cgit v1.2.3 From bb5a115533711fd8bb87f53cb32ff7342137208d Mon Sep 17 00:00:00 2001 From: Walter Purcaro <vuolter@users.noreply.github.com> Date: Sat, 18 Apr 2015 00:29:55 +0200 Subject: Spare code cosmetics (5) --- pyload/manager/Thread.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pyload/manager/Thread.py') diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py index b255523d6..a8550e504 100644 --- a/pyload/manager/Thread.py +++ b/pyload/manager/Thread.py @@ -250,10 +250,12 @@ class ThreadManager(object): def assignJob(self): """assing a job to a thread if possible""" - if self.pause or not self.core.api.isTimeDownload(): return + if self.pause or not self.core.api.isTimeDownload(): + return # if self.downloaded > 20: - # if not self.cleanPyCurl(): return + # if not self.cleanPyCurl(): + return free = [x for x in self.threads if not x.active] -- cgit v1.2.3