From ab695d17397e101447102877cdd282d825051035 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 2 Oct 2015 04:22:19 +0200 Subject: [Account] Improve parse_traffic method + code cosmetics --- module/plugins/accounts/CzshareCom.py | 4 ++-- module/plugins/accounts/FreeWayMe.py | 4 ++-- module/plugins/accounts/FshareVn.py | 4 ++-- module/plugins/accounts/HellshareCz.py | 4 ++-- module/plugins/accounts/LinksnappyCom.py | 4 ++-- module/plugins/accounts/MultishareCz.py | 4 ++-- module/plugins/accounts/NitroflareCom.py | 4 ++-- module/plugins/accounts/RehostTo.py | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) (limited to 'module/plugins/accounts') diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 448722dd9..209a94f60 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __status__ = "testing" __description__ = """Czshare.com account plugin, now Sdilej.cz""" @@ -30,7 +30,7 @@ class CzshareCom(Account): try: m = re.search(self.CREDIT_LEFT_PATTERN, html) - trafficleft = self.parse_traffic(m.group(1).replace(' ', '').replace(',', '.')) + m.group(2) + trafficleft = self.parse_traffic(m.group(1), m.group(2) validuntil = time.mktime(time.strptime(m.group(3), '%d.%m.%y %H:%M')) except Exception, e: diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index b554f592a..5e214db35 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -32,7 +32,7 @@ class FreeWayMe(Account): account_info = {'validuntil': -1, 'premium': False} if status['premium'] == "Free": - account_info['trafficleft'] = self.parse_traffic(status['guthaben'] + "MB") + account_info['trafficleft'] = self.parse_traffic(status['guthaben'], "MB") elif status['premium'] == "Spender": account_info['trafficleft'] = -1 elif status['premium'] == "Flatrate": diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 24a858274..e692394ef 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class FshareVn(Account): __name__ = "FshareVn" __type__ = "account" - __version__ = "0.13" + __version__ = "0.14" __status__ = "testing" __description__ = """Fshare.vn account plugin""" @@ -58,4 +58,4 @@ class FshareVn(Account): def get_traffic_left(self): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - return self.parse_traffic(m.group(1) + m.group(2)) if m else 0 + return self.parse_traffic(m.group(1), m.group(2)) if m else 0 diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 3031c26b6..cdfa9937a 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class HellshareCz(Account): __name__ = "HellshareCz" __type__ = "account" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __description__ = """Hellshare.cz account plugin""" @@ -42,7 +42,7 @@ class HellshareCz(Account): trafficleft = -1 else: #: Traffic-based account - trafficleft = self.parse_traffic(credit + "MB") + trafficleft = self.parse_traffic(credit, "MB") validuntil = -1 except Exception, e: diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index cf69791e7..6953f311c 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -9,7 +9,7 @@ from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -55,7 +55,7 @@ class LinksnappyCom(Account): if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): trafficleft = -1 else: - trafficleft = self.parse_traffic("%d MB" % j['return']['trafficleft']) + trafficleft = self.parse_traffic(j['return']['trafficleft'], "MB") return {'premium' : True , 'validuntil' : validuntil , diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 58d3367c2..77facb308 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.Account import Account class MultishareCz(Account): __name__ = "MultishareCz" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -36,7 +36,7 @@ class MultishareCz(Account): html = self.load("http://www.multishare.cz/profil/") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = self.parse_traffic(m.group('S') + m.group('U')) if m else 0 + trafficleft = self.parse_traffic(m.group('S'), m.group('U')) if m else 0 self.premium = True if trafficleft else False html = self.load("http://www.multishare.cz/") diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py index 70804d4e9..af71b1321 100644 --- a/module/plugins/accounts/NitroflareCom.py +++ b/module/plugins/accounts/NitroflareCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.Account import Account class NitroflareCom(Account): __name__ = "NitroflareCom" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __status__ = "testing" __description__ = """Nitroflare.com account plugin""" @@ -56,7 +56,7 @@ class NitroflareCom(Account): m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m is not None: try: - trafficleft = self.parse_traffic(str(max(0, 50 - float(m.group(1)))) + " GB") + trafficleft = self.parse_traffic(str(max(0, 50 - float(m.group(1)))), "GB") except Exception, e: self.log_error(e) diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 2ad4cdceb..4ff3f15a8 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.Account import Account class RehostTo(Account): __name__ = "RehostTo" __type__ = "account" - __version__ = "0.20" + __version__ = "0.21" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -48,7 +48,7 @@ class RehostTo(Account): traffic, valid = html.split(",") premium = True - trafficleft = self.parse_traffic(traffic + "MB") + trafficleft = self.parse_traffic(traffic, "MB") validuntil = float(valid) finally: -- cgit v1.2.3