diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-26 19:32:51 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-26 19:32:51 +0100 |
commit | 78a460054a2940037c12b2e82df394bf84a57959 (patch) | |
tree | b193d93353773f553213af4616ba29341fe1d174 /module/PluginThread.py | |
parent | [UptoboxCom] Now multiDL should be allowed again (diff) | |
download | pyload-78a460054a2940037c12b2e82df394bf84a57959.tar.xz |
[PluginThread] Clean pyfile.error before task starting
Diffstat (limited to 'module/PluginThread.py')
-rw-r--r-- | module/PluginThread.py | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/module/PluginThread.py b/module/PluginThread.py index 56c36c778..6dc6a0fe1 100644 --- a/module/PluginThread.py +++ b/module/PluginThread.py @@ -155,7 +155,7 @@ class DownloadThread(PluginThread): """Constructor""" PluginThread.__init__(self, manager) - self.queue = Queue() # job queue + self.queue = Queue() #: job queue self.active = False self.start() @@ -176,7 +176,8 @@ class DownloadThread(PluginThread): return True try: - if not pyfile.hasPlugin(): continue + if not pyfile.hasPlugin(): + continue #this pyfile was deleted while queueing pyfile.plugin.checkForSameFiles(starting=True) @@ -184,6 +185,7 @@ class DownloadThread(PluginThread): # start download self.m.core.hookManager.downloadPreparing(pyfile) + pyfile.error = "" pyfile.plugin.preprocessing(self) self.m.log.info(_("Download finished: %s") % pyfile.name) @@ -317,7 +319,7 @@ class DownloadThread(PluginThread): pyfile.checkIfProcessed() exc_clear() - + #pyfile.plugin.req.clean() self.active = False @@ -359,41 +361,41 @@ class DecrypterThread(PluginThread): retry = False try: - self.m.log.info(_("Decrypting starts: %s") % self.active.name) - self.active.plugin.preprocessing(self) + self.m.log.info(_("Decrypting starts: %s") % pyfile.name) + pyfile.error = "" + pyfile.plugin.preprocessing(self) except NotImplementedError: - self.m.log.error(_("Plugin %s is missing a function.") % self.active.pluginname) + self.m.log.error(_("Plugin %s is missing a function.") % pyfile.pluginname) return except Fail, e: msg = e.args[0] if msg == "offline": - self.active.setStatus("offline") - self.m.log.warning(_("Download is offline: %s") % self.active.name) + pyfile.setStatus("offline") + self.m.log.warning(_("Download is offline: %s") % pyfile.name) else: - self.active.setStatus("failed") - self.m.log.error(_("Decrypting failed: %(name)s | %(msg)s") % {"name": self.active.name, "msg": msg}) - self.active.error = msg + pyfile.setStatus("failed") + self.m.log.error(_("Decrypting failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": msg}) + pyfile.error = msg return except Abort: self.m.log.info(_("Download aborted: %s") % pyfile.name) pyfile.setStatus("aborted") - return except Retry: - self.m.log.info(_("Retrying %s") % self.active.name) + self.m.log.info(_("Retrying %s") % pyfile.name) retry = True return self.run() except Exception, e: - self.active.setStatus("failed") - self.m.log.error(_("Decrypting failed: %(name)s | %(msg)s") % {"name": self.active.name, "msg": str(e)}) - self.active.error = str(e) + pyfile.setStatus("failed") + self.m.log.error(_("Decrypting failed: %(name)s | %(msg)s") % {"name": pyfile.name, "msg": str(e)}) + pyfile.error = str(e) if self.m.core.debug: print_exc() @@ -401,21 +403,14 @@ class DecrypterThread(PluginThread): return - finally: if not retry: - self.active.release() + pyfile.release() self.active = False self.m.core.files.save() self.m.localThreads.remove(self) exc_clear() - - #self.m.core.hookManager.downloadFinished(pyfile) - - - #self.m.localThreads.remove(self) - #self.active.finishIfDone() if not retry: pyfile.delete() @@ -461,7 +456,7 @@ class HookThread(PluginThread): #dirty method to filter out exceptions if "unexpected keyword argument 'thread'" not in e.args[0]: raise - + del self.kwargs["thread"] self.f(*self.args, **self.kwargs) finally: |