summaryrefslogtreecommitdiffstats
path: root/module/download_thread.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-26 00:04:33 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-26 00:04:33 +0200
commitd44888ca5ab15913db944d1b1646df8f103c4ba6 (patch)
treee1d9d6109cb29ae45db1fe065b8395e5f3f789eb /module/download_thread.py
parentchanged variable names (diff)
downloadpyload-d44888ca5ab15913db944d1b1646df8f103c4ba6.tar.xz
improved plugins
Diffstat (limited to 'module/download_thread.py')
-rw-r--r--module/download_thread.py41
1 files changed, 23 insertions, 18 deletions
diff --git a/module/download_thread.py b/module/download_thread.py
index 31d449472..f103b2271 100644
--- a/module/download_thread.py
+++ b/module/download_thread.py
@@ -83,7 +83,13 @@ class Download_Thread(threading.Thread):
if self.parent.py_load_files:
self.loadedPyFile = self.parent.get_job()
if self.loadedPyFile:
- self.download(self.loadedPyFile)
+ try:
+ self.download(self.loadedPyFile)
+ except Exception, e:
+ print "Error:", e
+ #catch up all error here
+ finally:
+ self.parent.job_finished(self.loadedPyFile)
sleep(0.5)
if self.shutdown:
sleep(1)
@@ -94,26 +100,25 @@ class Download_Thread(threading.Thread):
status = pyfile.status
pyfile.prepareDownload()
- if status.exists:
-
- if status.want_reconnect:
- print "handle reconnect"
-
- while (time() < status.waituntil):
- status.type = "waiting"
- sleep(1) #eventuell auf genaue zeit warten
+ if not status.exists:
+ raise "FileDontExists" #i know its deprecated, who cares^^
-
- status.type = "downloading"
- print status.url , status.filename
+
+ if status.want_reconnect:
+ print "handle reconnect"
- try:
- pyfile.plugin.req.download(status.url, pyfile.download_folder + "/" + status.filename)
- status.type = "finished"
- except:
- status.type = "failed"
+ while (time() < status.waituntil):
+ status.type = "waiting"
+ sleep(1) #eventuell auf genaue zeit warten
- self.parent.job_finished(pyfile)
+ try:
+ status.type = "downloading"
+ print status.url , status.filename
+
+ pyfile.plugin.req.download(status.url, pyfile.download_folder + "/" + status.filename)
+ status.type = "finished"
+ except:
+ status.type = "failed"
#startet downloader
#urllib.urlretrieve(status.url, pyfile.download_folder + "/" + status.filename, status)