diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-09-26 16:40:38 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-09-26 16:40:50 +0200 |
commit | 967d6dd16c25ceba22dcd105079f72534ddb87e9 (patch) | |
tree | 4c971ff446dc955f1884e5aa80ef4cb62bbf55fe /pyload/datatypes | |
parent | new DLC plugins (diff) | |
download | pyload-967d6dd16c25ceba22dcd105079f72534ddb87e9.tar.xz |
rewritten decrypter and info fetching thread
Diffstat (limited to 'pyload/datatypes')
-rw-r--r-- | pyload/datatypes/OnlineCheck.py | 33 | ||||
-rw-r--r-- | pyload/datatypes/PyFile.py | 6 |
2 files changed, 35 insertions, 4 deletions
diff --git a/pyload/datatypes/OnlineCheck.py b/pyload/datatypes/OnlineCheck.py index 4b31e848b..2797828bf 100644 --- a/pyload/datatypes/OnlineCheck.py +++ b/pyload/datatypes/OnlineCheck.py @@ -1 +1,32 @@ -__author__ = 'christian' +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from time import time + +from pyload.Api import OnlineCheck as OC + +class OnlineCheck: + """ Helper class that holds result of an initiated online check """ + + def __init__(self, rid, owner): + self.rid = rid + self.owner = owner + self.result = {} + self.done = False + + self.timestamp = time() + + def update(self, result): + self.timestamp = time() + self.result.update(result) + + def toApiData(self): + self.timestamp = time() + oc = OC(self.rid, self.result) + # getting the results clears the older ones + self.result = {} + # indication for no more data + if self.done: + oc.rid = -1 + + return oc
\ No newline at end of file diff --git a/pyload/datatypes/PyFile.py b/pyload/datatypes/PyFile.py index 2cc28fa24..de7288d22 100644 --- a/pyload/datatypes/PyFile.py +++ b/pyload/datatypes/PyFile.py @@ -49,7 +49,7 @@ class PyFile(object): Represents a file object at runtime """ __slots__ = ("m", "fid", "_name", "_size", "filestatus", "media", "added", "fileorder", - "url", "pluginname", "hash", "status", "error", "packageid", "ownerid", + "url", "pluginname", "hash", "status", "error", "packageid", "owner", "lock", "plugin", "waitUntil", "abort", "statusname", "reconnected", "pluginclass") @@ -83,7 +83,7 @@ class PyFile(object): self.hash = hash self.status = status self.error = error - self.ownerid = owner + self.owner = owner self.packageid = package # database information ends here @@ -183,7 +183,7 @@ class PyFile(object): def toInfoData(self): - return FileInfo(self.fid, self.getName(), self.packageid, self.ownerid, self.getSize(), self.filestatus, + return FileInfo(self.fid, self.getName(), self.packageid, self.owner, self.getSize(), self.filestatus, self.media, self.added, self.fileorder, DownloadInfo( self.url, self.pluginname, self.hash, self.status, self.getStatusName(), self.error ) |