diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-09-24 15:41:13 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-09-24 15:41:13 +0200 |
commit | fb145cf68c0178b9551eaae3213ec01be112bf76 (patch) | |
tree | 61d8dd381a831da4c34359b5e471e11d687f4746 /module/datatypes/PyFile.py | |
parent | added some animations, code for show/hiding items (diff) | |
download | pyload-fb145cf68c0178b9551eaae3213ec01be112bf76.tar.xz |
fixed some things, so downloads works again
Diffstat (limited to 'module/datatypes/PyFile.py')
-rw-r--r-- | module/datatypes/PyFile.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/module/datatypes/PyFile.py b/module/datatypes/PyFile.py index 1a515493c..d6270acaa 100644 --- a/module/datatypes/PyFile.py +++ b/module/datatypes/PyFile.py @@ -19,7 +19,7 @@ from time import sleep, time from threading import RLock -from module.Api import FileInfo, DownloadInfo, DownloadStatus +from module.Api import ProgressInfo, DownloadProgress, FileInfo, DownloadInfo, DownloadStatus from module.utils import format_size, format_time, lock statusMap = { @@ -48,8 +48,8 @@ class PyFile(object): """ __slots__ = ("m", "fid", "_name", "_size", "filestatus", "media", "added", "fileorder", "url", "pluginname", "hash", "status", "error", "packageid", "ownerid", - "lock", "plugin", "waitUntil", "active", "abort", "statusname", - "reconnected", "progress", "maxprogress", "pluginclass") + "lock", "plugin", "waitUntil", "abort", "statusname", + "reconnected", "pluginclass") @staticmethod def fromInfoData(m, info): @@ -88,19 +88,14 @@ class PyFile(object): self.lock = RLock() self.plugin = None - #self.download = None self.waitUntil = 0 # time() + time to wait # status attributes - self.active = False #obsolete? self.abort = False self.reconnected = False - self.statusname = None - self.progress = 0 - self.maxprogress = 100 @property def id(self): @@ -249,6 +244,13 @@ class PyFile(object): except: return 0 + def getBytesArrived(self): + """ gets bytes arrived """ + try: + return self.plugin.req.arrived + except: + return 0 + def getBytesLeft(self): """ gets bytes left """ try: @@ -279,7 +281,7 @@ class PyFile(object): def notifyChange(self): self.m.core.eventManager.dispatchEvent("linkUpdated", self.id, self.packageid) - def setProgress(self, value): - if not value == self.progress: - self.progress = value - self.notifyChange() + def getProgressInfo(self): + return ProgressInfo(self.plugin, self.name, self.statusname, self.getETA(), self.formatETA(), + self.getBytesArrived(), self.getSize(), + DownloadProgress(self.fid, self.packageid, self.getSpeed(), self.status)) |