diff options
author | ardi69 <armin@diedering.de> | 2015-04-18 14:08:18 +0200 |
---|---|---|
committer | ardi69 <armin@diedering.de> | 2015-04-18 14:08:18 +0200 |
commit | 6e8f84e1dc06cff6fa9387559992f555182c1774 (patch) | |
tree | 476600f9896fae029880e4049eb4c5e6021b202d /pyload/manager | |
parent | fix: config cast (diff) | |
parent | Spare code cosmetics (5) (diff) | |
download | pyload-6e8f84e1dc06cff6fa9387559992f555182c1774.tar.xz |
Merge pull request #3 from vuolter/0.4.10
merge vuolter HEAD
Diffstat (limited to 'pyload/manager')
-rw-r--r-- | pyload/manager/Account.py | 9 | ||||
-rw-r--r-- | pyload/manager/Addon.py | 2 | ||||
-rw-r--r-- | pyload/manager/Event.py | 8 | ||||
-rw-r--r-- | pyload/manager/Plugin.py | 5 | ||||
-rw-r--r-- | pyload/manager/Remote.py | 7 | ||||
-rw-r--r-- | pyload/manager/Thread.py | 19 | ||||
-rw-r--r-- | pyload/manager/thread/Addon.py | 4 | ||||
-rw-r--r-- | pyload/manager/thread/Info.py | 2 | ||||
-rw-r--r-- | pyload/manager/thread/Server.py | 2 |
9 files changed, 35 insertions, 23 deletions
diff --git a/pyload/manager/Account.py b/pyload/manager/Account.py index 4e4a82aed..44a5e5c65 100644 --- a/pyload/manager/Account.py +++ b/pyload/manager/Account.py @@ -90,9 +90,12 @@ class AccountManager(object): for line in content[1:]: line = line.strip() - if not line: continue - if line.startswith("#"): continue - if line.startswith("version"): continue + if not line: + continue + if line.startswith("#"): + continue + if line.startswith("version"): + continue if line.endswith(":") and line.count(":") == 1: plugin = line[:-1] diff --git a/pyload/manager/Addon.py b/pyload/manager/Addon.py index cf23715b6..5ac56a349 100644 --- a/pyload/manager/Addon.py +++ b/pyload/manager/Addon.py @@ -41,8 +41,6 @@ class AddonManager(object): | Notes: | all_downloads-processed is *always* called before all_downloads-finished. | config-changed is *always* called before pluginConfigChanged. - - """ def __init__(self, core): diff --git a/pyload/manager/Event.py b/pyload/manager/Event.py index 90aaaca30..b3d22619f 100644 --- a/pyload/manager/Event.py +++ b/pyload/manager/Event.py @@ -4,6 +4,7 @@ from time import time from pyload.utils import uniqify + class PullManager(object): def __init__(self, core): @@ -41,6 +42,7 @@ class PullManager(object): for client in self.clients: client.addEvent(event) + class Client(object): def __init__(self, uuid): @@ -62,6 +64,7 @@ class Client(object): def addEvent(self, event): self.events.append(event) + class UpdateEvent(object): def __init__(self, itype, iid, destination): @@ -75,6 +78,7 @@ class UpdateEvent(object): def toList(self): return ["update", self.destination, self.type, self.id] + class RemoveEvent(object): def __init__(self, itype, iid, destination): @@ -88,6 +92,7 @@ class RemoveEvent(object): def toList(self): return ["remove", self.destination, self.type, self.id] + class InsertEvent(object): def __init__(self, itype, iid, after, destination): @@ -102,6 +107,7 @@ class InsertEvent(object): def toList(self): return ["insert", self.destination, self.type, self.id, self.after] + class ReloadAllEvent(object): def __init__(self, destination): @@ -112,11 +118,13 @@ class ReloadAllEvent(object): def toList(self): return ["reload", self.destination] + class AccountUpdateEvent(object): def toList(self): return ["account"] + class ConfigUpdateEvent(object): def toList(self): diff --git a/pyload/manager/Plugin.py b/pyload/manager/Plugin.py index 69a77fdf8..905ce524e 100644 --- a/pyload/manager/Plugin.py +++ b/pyload/manager/Plugin.py @@ -230,7 +230,7 @@ class PluginManager(object): elif name not in self.plugins[type]: self.core.log.warning(_("Plugin [%(type)s] %(name)s not found | Using plugin: [internal] BasePlugin") % {'name': name, 'type': type}) - return self.internalPlugins["BasePlugin"] + return self.internalPlugins['BasePlugin'] else: return self.plugins[type][name] @@ -313,7 +313,8 @@ class PluginManager(object): else: user = 0 # used as bool and int split = fullname.split(".") - if len(split) != 4 - user: return + if len(split) != 4 - user: + return type, name = split[2 - user:4 - user] if type in self.plugins and name in self.plugins[type]: diff --git a/pyload/manager/Remote.py b/pyload/manager/Remote.py index a27667070..c2d254932 100644 --- a/pyload/manager/Remote.py +++ b/pyload/manager/Remote.py @@ -4,6 +4,7 @@ from threading import Thread from traceback import print_exc + class BackendBase(Thread): def __init__(self, manager): @@ -43,7 +44,7 @@ class BackendBase(Thread): def stop(self): - self.enabled = False# set flag and call shutdowm message, so thread can react + self.enabled = False #: set flag and call shutdowm message, so thread can react self.shutdown() @@ -57,8 +58,8 @@ class RemoteManager(object): if self.core.remote: self.available.append("ThriftBackend") -# else: -# self.available.append("SocketBackend") + # else: + # self.available.append("SocketBackend") def startBackends(self): diff --git a/pyload/manager/Thread.py b/pyload/manager/Thread.py index 015bc9ab1..a8550e504 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() @@ -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() @@ -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]) @@ -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] @@ -285,7 +287,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 +301,6 @@ class ThreadManager(object): if job: job.initPlugin() thread = DecrypterThread(self, job) - else: thread = DecrypterThread(self, job) diff --git a/pyload/manager/thread/Addon.py b/pyload/manager/thread/Addon.py index f3d219989..1da164543 100644 --- a/pyload/manager/thread/Addon.py +++ b/pyload/manager/thread/Addon.py @@ -55,14 +55,14 @@ class AddonThread(PluginThread): def run(self): try: try: - self.kwargs["thread"] = self + self.kwargs['thread'] = self self.f(*self.args, **self.kwargs) except TypeError, e: #dirty method to filter out exceptions if "unexpected keyword argument 'thread'" not in e.args[0]: raise - del self.kwargs["thread"] + del self.kwargs['thread'] self.f(*self.args, **self.kwargs) finally: local = copy(self.active) diff --git a/pyload/manager/thread/Info.py b/pyload/manager/thread/Info.py index 487c3b924..28a2e8e91 100644 --- a/pyload/manager/thread/Info.py +++ b/pyload/manager/thread/Info.py @@ -117,7 +117,7 @@ class InfoThread(PluginThread): self.updateResult(pluginname, result, True) - self.m.infoResults[self.rid]["ALL_INFO_FETCHED"] = {} + self.m.infoResults[self.rid]['ALL_INFO_FETCHED'] = {} self.m.timestamp = time() + 5 * 60 diff --git a/pyload/manager/thread/Server.py b/pyload/manager/thread/Server.py index 990325f5d..83e886253 100644 --- a/pyload/manager/thread/Server.py +++ b/pyload/manager/thread/Server.py @@ -66,7 +66,7 @@ class WebServer(threading.Thread): self.server = "builtin" else: self.core.log.info(_("Server set to threaded, due to known performance problems on windows.")) - self.core.config['webui']['server'] = "threaded" + self.core.config.set("webui", "server", "threaded") self.server = "threaded" if self.server == "threaded": |