summaryrefslogtreecommitdiffstats
path: root/module/PyFile.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-12-23 11:28:03 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2010-12-23 11:28:03 +0100
commita4ba4ba12aff34c967f958576db40806656c3de8 (patch)
tree57a26d6559279fa4ed9c28fadfa31f4d36a7eceb /module/PyFile.py
parentnew download backend integrated so far, downloading works, but still big todo... (diff)
downloadpyload-a4ba4ba12aff34c967f958576db40806656c3de8.tar.xz
fixed eta and progress, ready for first test
Diffstat (limited to 'module/PyFile.py')
-rw-r--r--module/PyFile.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/module/PyFile.py b/module/PyFile.py
index 1723808c7..e7c7c2c2b 100644
--- a/module/PyFile.py
+++ b/module/PyFile.py
@@ -70,6 +70,7 @@ class PyFile():
# database information ends here
self.plugin = None
+ self.download = None
self.waitUntil = 0 # time() + time to wait
@@ -207,21 +208,21 @@ class PyFile():
def getSpeed(self):
""" calculates speed """
try:
- return self.plugin.req.speed/1024 #kb/s
+ return self.download.speed
except:
return 0
def getETA(self):
""" gets established time of arrival"""
try:
- return self.plugin.req.get_ETA()
+ return self.getBytesLeft() / self.getSpeed()
except:
return 0
def getBytesLeft(self):
""" gets bytes left """
try:
- return self.plugin.req.bytes_left()
+ return self.download.size - self.download.arrived
except:
return 0
@@ -234,7 +235,8 @@ class PyFile():
if self.size: return self.size
else:
try:
- return self.plugin.req.dl_size
+ if not self.download.size: return 0
+ return self.download.size
except:
return 0