summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-26 15:36:51 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-26 15:36:51 +0200
commitd02541c948a71533469663b3400bc4a3179548c2 (patch)
tree021232e6a2e0f05b99b21041e66ae1ccdc651ea5 /module
parentbetter youtube video id parsing, nicer testoutput (diff)
downloadpyload-d02541c948a71533469663b3400bc4a3179548c2.tar.xz
introduced logger
Diffstat (limited to 'module')
-rw-r--r--module/download_thread.py18
-rwxr-xr-xmodule/network/Request.py3
-rw-r--r--module/thread_list.py2
3 files changed, 12 insertions, 11 deletions
diff --git a/module/download_thread.py b/module/download_thread.py
index 502d42ddc..96bc4dd34 100644
--- a/module/download_thread.py
+++ b/module/download_thread.py
@@ -83,13 +83,12 @@ class Download_Thread(threading.Thread):
if self.parent.py_load_files:
self.loadedPyFile = self.parent.get_job()
if self.loadedPyFile:
- try:
+ try:
self.download(self.loadedPyFile)
- except Exception, e:
- print "Error:", e
- #catch up all error here
- finally:
- self.parent.job_finished(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)
@@ -99,9 +98,9 @@ class Download_Thread(threading.Thread):
pyfile = py_load_file
status = pyfile.status
pyfile.prepareDownload()
-
- if not status.exists:
- raise "FileDontExists" #i know its deprecated, who cares^^
+
+ if not status.exists:
+ raise "FileDontExists" #i know its deprecated, who cares^^
if status.want_reconnect:
print "handle reconnect"
@@ -112,7 +111,6 @@ class Download_Thread(threading.Thread):
try:
status.type = "downloading"
- print "download", status.filename
pyfile.plugin.proceed(status.url, pyfile.download_folder + "/" + status.filename)
status.type = "finished"
diff --git a/module/network/Request.py b/module/network/Request.py
index 1c0317cc7..510f6d069 100755
--- a/module/network/Request.py
+++ b/module/network/Request.py
@@ -27,6 +27,7 @@ class Request:
def __init__(self):
self.dl_time = 0
+ self.dl_finished = 0
self.dl_size = 0
self.dl_arrived = 0
self.dl = False
@@ -114,7 +115,7 @@ class Request:
def get_ETA(self):
try:
- return (self.dl_size - self.dl_arrived) / (self.dl_arrived / (time.time() - self.dl_time))
+ return (self.dl_size - self.dl_arrived) / (self.dl_arrived / (time.time() - self.dl_time if self.dl else self.dl_finished))
except:
return "No Download"
diff --git a/module/thread_list.py b/module/thread_list.py
index 979a98c60..065318a56 100644
--- a/module/thread_list.py
+++ b/module/thread_list.py
@@ -73,6 +73,7 @@ class Thread_List(object):
self.py_downloading.append(pyfile)
if not pyfile.plugin.multi_dl:
self.occ_plugins.append(pyfile.modul.__name__)
+ self.parent.logger.info('start downloading ' + pyfile.url )
self.lock.release()
return pyfile
@@ -85,6 +86,7 @@ class Thread_List(object):
self.occ_plugins.remove(pyfile.modul.__name__)
self.py_downloading.remove(pyfile)
+ self.parent.logger.info('finished downloading ' + pyfile.url + ' @'+str(pyfile.status.get_speed())+'kb/s')
if pyfile.plugin.plugin_type == "container":
self.parent.extend_links(pyfile.plugin.links)