diff options
Diffstat (limited to 'pyload/api/StatisticsApi.py')
-rw-r--r-- | pyload/api/StatisticsApi.py | 28 |
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 |