diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2014-01-18 18:45:13 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2014-01-18 18:45:13 +0100 |
commit | 453c1e55c71a96c9529ecdca1d55278cc41088d6 (patch) | |
tree | 7a516a84e5590ce5f1f3def71c24bcb14f209023 /pyload/threads/DownloadThread.py | |
parent | small fixes and improvements for download engine (diff) | |
download | pyload-453c1e55c71a96c9529ecdca1d55278cc41088d6.tar.xz |
rewritten download scheduling, improved account manager, db version increased all data will be overwritten
Diffstat (limited to 'pyload/threads/DownloadThread.py')
-rw-r--r-- | pyload/threads/DownloadThread.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pyload/threads/DownloadThread.py b/pyload/threads/DownloadThread.py index d1672531b..b8f7e4965 100644 --- a/pyload/threads/DownloadThread.py +++ b/pyload/threads/DownloadThread.py @@ -18,6 +18,7 @@ @author: RaNaN """ +from threading import Event from Queue import Queue from time import sleep, time from traceback import print_exc @@ -37,6 +38,9 @@ class DownloadThread(BaseThread): """Constructor""" BaseThread.__init__(self, manager) + self.isWorking = Event() + self.isWorking.clear() + self.queue = Queue() # job queue self.active = None @@ -53,12 +57,19 @@ class DownloadThread(BaseThread): if self.active == "quit": self.active = None - self.m.threads.remove(self) + self.m.stop(self) return True try: - if not pyfile.hasPlugin(): continue + pyfile.initPlugin() + + # after initialization the thread is fully ready + self.isWorking.set() + #this pyfile was deleted while queuing + # TODO: what will happen with new thread manager? + #if not pyfile.hasPlugin(): continue + pyfile.plugin.checkForSameFiles(starting=True) self.log.info(_("Download starts: %s" % pyfile.name)) @@ -204,7 +215,9 @@ class DownloadThread(BaseThread): self.core.files.save() pyfile.checkIfProcessed() exc_clear() - + # manager could still be waiting for it + self.isWorking.set() + self.m.done(self) #pyfile.plugin.req.clean() |