summaryrefslogtreecommitdiffstats
path: root/pyload/api/StatisticsApi.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2014-01-18 18:45:13 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2014-01-18 18:45:13 +0100
commit453c1e55c71a96c9529ecdca1d55278cc41088d6 (patch)
tree7a516a84e5590ce5f1f3def71c24bcb14f209023 /pyload/api/StatisticsApi.py
parentsmall fixes and improvements for download engine (diff)
downloadpyload-453c1e55c71a96c9529ecdca1d55278cc41088d6.tar.xz
rewritten download scheduling, improved account manager, db version increased all data will be overwritten
Diffstat (limited to 'pyload/api/StatisticsApi.py')
-rw-r--r--pyload/api/StatisticsApi.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/pyload/api/StatisticsApi.py b/pyload/api/StatisticsApi.py
new file mode 100644
index 000000000..d313e4d0e
--- /dev/null
+++ b/pyload/api/StatisticsApi.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from pyload.Api import Api, RequirePerm, Permission
+
+from ApiComponent import ApiComponent
+
+CACHE = {}
+QUOTA_UNLIMITED = -1
+
+
+class StatisticsApi(ApiComponent):
+ """ Retrieve download statistics and quota """
+
+ def recordDownload(self, pyfile):
+ """ Add download record to the statistics """
+ del CACHE[:]
+
+ def calcQuota(self, uid):
+ return QUOTA_UNLIMITED
+
+ def getQuota(self):
+ """ Number of bytes the user has left for download """
+ return self.calcQuota(self.user.true_primary)
+
+
+if Api.extend(StatisticsApi):
+ del StatisticsApi \ No newline at end of file