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 | |
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')
-rw-r--r-- | module/datatypes/PyFile.py | 26 | ||||
-rw-r--r-- | module/datatypes/PyPackage.py | 5 |
2 files changed, 18 insertions, 13 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)) diff --git a/module/datatypes/PyPackage.py b/module/datatypes/PyPackage.py index be2f23eea..654a36f76 100644 --- a/module/datatypes/PyPackage.py +++ b/module/datatypes/PyPackage.py @@ -47,6 +47,9 @@ class PyPackage: self.packageorder = packageorder self.timestamp = time() + #: Finish event already fired + self.setFinished = False + @property def id(self): self.m.core.log.debug("Deprecated package attr .id, use .pid instead") @@ -62,7 +65,7 @@ class PyPackage: def getChildren(self): """get information about contained links""" - return self.m.getPackageData(self.id)["links"] + return self.m.getPackageData(self.pid)["links"] def getPath(self, name=""): self.timestamp = time() |