summaryrefslogtreecommitdiffstats
path: root/pyload/datatypes/OnlineCheck.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/datatypes/OnlineCheck.py')
-rw-r--r--pyload/datatypes/OnlineCheck.py33
1 files changed, 32 insertions, 1 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