diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-12 18:15:36 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-03-12 18:15:36 +0100 |
commit | d2b45c5442aeb0e02f251916ae1beb06830ef4c1 (patch) | |
tree | b5587ad618f0780c7e7443195cda652d9a2eadbb /module/threads | |
parent | renamed most events, push events to webui (diff) | |
download | pyload-d2b45c5442aeb0e02f251916ae1beb06830ef4c1.tar.xz |
render download progress
Diffstat (limited to 'module/threads')
-rw-r--r-- | module/threads/ThreadManager.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/module/threads/ThreadManager.py b/module/threads/ThreadManager.py index a0ece3463..f67179d08 100644 --- a/module/threads/ThreadManager.py +++ b/module/threads/ThreadManager.py @@ -118,9 +118,23 @@ class ThreadManager: def setInfoResults(self, rid, result): self.infoResults[rid].update(result) - def getActiveDownloads(self): + def getActiveDownloads(self, user=None): + # TODO: user context return [x.active for x in self.threads if x.active and isinstance(x.active, PyFile)] + def getProgressList(self, user=None): + info = [] + + # TODO: local threads can create multiple progresses + for thread in self.threads + self.localThreads: + # skip if not belong to current user + if user and thread.user != user: continue + + progress = thread.getProgress() + if progress: info.append(progress) + + return info + def getActiveFiles(self): active = self.getActiveDownloads() @@ -133,9 +147,6 @@ class ThreadManager: """get a id list of all pyfiles processed""" return [x.id for x in self.getActiveFiles()] - def allProgressInfo(self): - pass #TODO - def work(self): """run all task which have to be done (this is for repetetive call by core)""" try: |