diff options
author | 2014-12-30 20:21:23 +0100 | |
---|---|---|
committer | 2014-12-30 20:21:23 +0100 | |
commit | ac9ba34bd5e629ddfbe67dec88ff2e0653e80356 (patch) | |
tree | f77bc281bd083145b19e82bf0e5ff34f5cd6f01a /module/plugins/accounts/PremiumTo.py | |
parent | [Oboom] new hoster and account (diff) | |
parent | Update some MultiHoster __pattern__ (diff) | |
download | pyload-ac9ba34bd5e629ddfbe67dec88ff2e0653e80356.tar.xz |
Merge pull request #1 from pyload/stable
Merge
Diffstat (limited to 'module/plugins/accounts/PremiumTo.py')
-rw-r--r-- | module/plugins/accounts/PremiumTo.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py new file mode 100644 index 000000000..ef3d0cc19 --- /dev/null +++ b/module/plugins/accounts/PremiumTo.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account + + +class PremiumTo(Account): + __name__ = "PremiumTo" + __type__ = "account" + __version__ = "0.05" + + __description__ = """Premium.to account plugin""" + __license__ = "GPLv3" + __authors__ = [("RaNaN", "RaNaN@pyload.org"), + ("zoidberg", "zoidberg@mujmail.cz"), + ("stickell", "l.stickell@yahoo.it")] + + + def loadAccountInfo(self, user, req): + api_r = req.load("http://premium.to/api/straffic.php", + get={'username': self.username, 'password': self.password}) + + trafficleft = sum(map(float, api_r.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + + return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1} + + + def login(self, user, data, req): + self.username = user + self.password = data['password'] + authcode = req.load("http://premium.to/api/getauthcode.php", + get={'username': user, 'password': self.password}).strip() + + if "wrong username" in authcode: + self.wrongPassword() |