summaryrefslogtreecommitdiffstats
path: root/module/download_thread.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-04 13:46:44 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-04 13:46:44 +0200
commit618c03fc5c5b57c154772b1fd373004e186ae0f8 (patch)
treefc6e14b69785a86e2b69d257685e182d23a434b3 /module/download_thread.py
parentremoved test files (diff)
downloadpyload-618c03fc5c5b57c154772b1fd373004e186ae0f8.tar.xz
remove links from txt + several improvments
Diffstat (limited to 'module/download_thread.py')
-rw-r--r--module/download_thread.py28
1 files changed, 2 insertions, 26 deletions
diff --git a/module/download_thread.py b/module/download_thread.py
index d5e4f4edc..5313a7d34 100644
--- a/module/download_thread.py
+++ b/module/download_thread.py
@@ -19,7 +19,6 @@
###
import threading
-import random
from time import time, sleep
@@ -30,35 +29,12 @@ class Status(object):
self.pyfile = pyfile
self.type = None
self.status_queue = None
- self.total_kb = 0
- self.downloaded_kb = 0
- self.rate = 0
- self.expected_time = 0
self.filename = None
self.url = None
self.exists = False
self.waituntil = None
self.want_reconnect = False
-# def __call__(self, blocks_read, block_size, total_size):
-# if self.status_queue == None:
-# return False
-# self.start = time()
-# self.last_status = time()
-# self.total_kb = total_size / 1024
-# self.downloaded_kb = (blocks_read * block_size) / 1024
-# elapsed_time = time() - self.start
-# if elapsed_time != 0:
-# self.rate = self.downloaded_kb / elapsed_time
-# if self.rate != 0:
-# self.expected_time = self.downloaded_kb / self.rate
-# if self.last_status+0.2 < time():
-# self.status_queue.put(copy(self))
-# self.last_status = time()
-#
- def set_status_queue(self, queue):
- self.status_queue = queue
-
def get_ETA(self):
return self.pyfile.plugin.req.get_ETA()
def get_speed(self):
@@ -86,6 +62,7 @@ class Download_Thread(threading.Thread):
self.download(self.loadedPyFile)
except Exception, e:
print "Error:", e #catch up all error here
+ self.loadedPyFile.status.type = "failed"
finally:
self.parent.job_finished(self.loadedPyFile)
sleep(0.5)
@@ -96,7 +73,6 @@ class Download_Thread(threading.Thread):
def download(self, pyfile):
status = pyfile.status
pyfile.prepareDownload()
- print "dl prepared", status.filename
if not status.exists:
raise "FileDontExists" #i know its deprecated, who cares^^
@@ -104,7 +80,7 @@ class Download_Thread(threading.Thread):
status.type = "waiting"
while (time() < status.waituntil):
- if self.parent.init_reconnect(pyfile) or self.parent.reconnecting:
+ if self.parent.init_reconnect() or self.parent.reconnecting:
status.type = "reconnected"
status.want_reconnect = False
return False