diff options
Diffstat (limited to 'module/plugins/accounts/PremiumTo.py')
-rw-r--r-- | module/plugins/accounts/PremiumTo.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index ba8f24c6d..74859d8a5 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -6,9 +6,13 @@ from module.plugins.internal.Account import Account class PremiumTo(Account): __name__ = "PremiumTo" __type__ = "account" - __version__ = "0.11" + __version__ = "0.13" __status__ = "testing" + __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), + ("mh_list" , "str" , "Hoster list (comma separated)", "" ), + ("mh_interval", "int" , "Reload interval in minutes" , 60 )] + __description__ = """Premium.to account plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org"), @@ -16,10 +20,16 @@ class PremiumTo(Account): ("stickell", "l.stickell@yahoo.it")] - def parse_info(self, user, password, data, req): + def grab_hosters(self, user, password, data): + html = self.load("http://premium.to/api/hosters.php", + get={'username': user, 'password': password}) + return [x for x in map(str.strip, html.replace("\"", "").split(",")) if x] + + + def grab_info(self, user, password, data): traffic = self.load("http://premium.to/api/straffic.php", #@TODO: Revert to `https` in 0.4.10 - get={'username': self.username, - 'password': self.password}) + get={'username': user, + 'password': password}) if "wrong username" not in traffic: trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 @@ -28,12 +38,10 @@ class PremiumTo(Account): return {'premium': False, 'trafficleft': None, 'validuntil': None} - def login(self, user, password, data, req): - self.username = user - self.password = password + def signin(self, user, password, data): authcode = self.load("http://premium.to/api/getauthcode.php", #@TODO: Revert to `https` in 0.4.10 get={'username': user, - 'password': self.password}) + 'password': password}) if "wrong username" in authcode: - self.login_fail() + self.fail_login() |