diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-11-04 03:25:05 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-11-04 03:25:05 +0100 |
commit | d429c97c55e06a8f2ee7de64e4add783e80e9956 (patch) | |
tree | ada4caf0e2c4d0e877da00f50f04b020c01fbec6 /module/plugins/internal/XFSAccount.py | |
parent | Code cosmetics (diff) | |
download | pyload-d429c97c55e06a8f2ee7de64e4add783e80e9956.tar.xz |
[XFSAccount] Better traffic fallback
Diffstat (limited to 'module/plugins/internal/XFSAccount.py')
-rw-r--r-- | module/plugins/internal/XFSAccount.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 597964d4c..aa8a8ace1 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies class XFSAccount(Account): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.23" + __version__ = "0.24" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -32,12 +32,12 @@ class XFSAccount(Account): HOSTER_DOMAIN = None - COOKIES = [(HOSTER_DOMAIN, "lang", "english")] #: or list of tuples [(domain, name, value)] + COOKIES = [(HOSTER_DOMAIN, "lang", "english")] VALID_UNTIL_PATTERN = r'>Premium.[Aa]ccount expire:.*?(\d{1,2} [\w^_]+ \d{4})' TRAFFIC_LEFT_PATTERN = r'>Traffic available today:.*?<b>\s*(?P<S>[\d.,]+|[Uu]nlimited)\s*(?:(?P<U>[\w^_]+)\s*)?</b>' - TRAFFIC_LEFT_UNIT = "MB" #: used only if no group <U> was found + TRAFFIC_LEFT_UNIT = "MB" #: used only if no group <U> was found LOGIN_FAIL_PATTERN = r'>(Incorrect Login or Password|Error<)' @@ -86,7 +86,9 @@ class XFSAccount(Account): if m: try: traffic = m.groupdict() - if "nlimited" in traffic['S']: + size = traffic['S'] + + if "nlimited" in size: trafficleft = -1 if premium is None: premium = True @@ -98,10 +100,10 @@ class XFSAccount(Account): else: unit = "" - trafficleft = self.parseTraffic(traffic['S'] + unit) + trafficleft = self.parseTraffic(size + unit) except Exception, e: - self.logDebug(str(e)) + self.logError(str(e)) return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium or False} |