From 3692522c1bfb896dc4f9abdfa391fd86e8470150 Mon Sep 17 00:00:00 2001 From: rukasuzu Date: Sat, 17 Jan 2015 20:07:52 +0100 Subject: [CatShareNet] Added traffic left info --- module/plugins/accounts/CatShareNet.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'module') diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index 90cdfe013..6fac87ecb 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -24,6 +24,7 @@ class CatShareNet(Account): def loadAccountInfo(self, user, req): premium = False validuntil = -1 + trafficleft = -1 html = req.load("http://catshare.net/", decode=True) @@ -39,10 +40,13 @@ class CatShareNet(Account): expiredate = m.group(1) if "-" not in expiredate: validuntil = mktime(strptime(expiredate, "%d.%m.%Y")) + m = re.search(r'([0-9.]+ [kMG]B)', html) + if m: + trafficleft = int(self.parseTraffic(m.group(1))) except Exception: pass - return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} + return {'premium': premium, 'trafficleft': trafficleft, 'validuntil': validuntil} def login(self, user, data, req): -- cgit v1.2.3