summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/Py_Load_File.py2
-rw-r--r--module/download_thread.py41
-rw-r--r--module/thread_list.py13
3 files changed, 31 insertions, 25 deletions
diff --git a/module/Py_Load_File.py b/module/Py_Load_File.py
index c4bf2b08c..9f962ffb3 100644
--- a/module/Py_Load_File.py
+++ b/module/Py_Load_File.py
@@ -23,7 +23,7 @@ class PyLoadFile:
if re.match(plugin_pattern, self.url) != None:
return plugin
#logger: kein plugin gefunden # was soll passieren wenn nichts gefunden wird?!?
- return None
+ return "Plugin"
def prepareDownload(self):
self.status.exists = self.plugin.file_exists()
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)
diff --git a/module/thread_list.py b/module/thread_list.py
index 34fa05599..1f967540b 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -53,11 +53,11 @@ class Thread_List(object):
def remove_thread(self, thread):
self.threads.remove(thread)
- def status(self):
- if not self.status_queue.empty():
- while not self.status_queue.empty():
- status = self.status_queue.get()
- self.py_load_files[status.id].status = status
+# def status(self):
+# if not self.status_queue.empty():
+# while not self.status_queue.empty():
+# status = self.status_queue.get()
+# self.py_load_files[status.id].status = status
def get_job(self):
# return job if suitable, otherwise send thread idle
@@ -71,7 +71,8 @@ class Thread_List(object):
if pyfile:
self.py_downloading.append(pyfile)
- self.occ_plugins.append(pyfile.modul.__name__)
+ if not pyfile.plugin.multi_dl:
+ self.occ_plugins.append(pyfile.modul.__name__)
self.lock.release()
return pyfile