diff options
author | 2014-11-26 22:19:01 +0100 | |
---|---|---|
committer | 2014-11-26 22:19:01 +0100 | |
commit | 4a7f6177152d3c59c92291aa76fd7a36a1c8b044 (patch) | |
tree | 9796b6c6f4be98dd29dba0d9f92cc44756da8b3a /pyload/plugins/internal/XFSAccount.py | |
parent | Merge branch 'stable' into 0.4.10 (diff) | |
parent | [XFSHoster] Code improvements (diff) | |
download | pyload-4a7f6177152d3c59c92291aa76fd7a36a1c8b044.tar.xz |
Merge branch 'stable' into 0.4.10
Conflicts:
module/PluginThread.py
module/plugins/hoster/XFileSharingPro.py
module/plugins/internal/CaptchaService.py
pyload/api/__init__.py
pyload/manager/AccountManager.py
pyload/manager/AddonManager.py
pyload/manager/CaptchaManager.py
pyload/manager/PluginManager.py
pyload/network/HTTPRequest.py
pyload/network/XDCCRequest.py
pyload/plugins/Plugin.py
pyload/plugins/account/EasybytezCom.py
pyload/plugins/crypter/C1neonCom.py
pyload/plugins/crypter/CryptItCom.py
pyload/plugins/crypter/DuploadOrg.py
pyload/plugins/crypter/FilebeerInfo.py
pyload/plugins/crypter/FilesonicCom.py
pyload/plugins/crypter/FiredriveCom.py
pyload/plugins/crypter/HotfileCom.py
pyload/plugins/crypter/ILoadTo.py
pyload/plugins/crypter/LofCc.py
pyload/plugins/crypter/MBLinkInfo.py
pyload/plugins/crypter/MegauploadCom.py
pyload/plugins/crypter/Movie2kTo.py
pyload/plugins/crypter/MultiuploadCom.py
pyload/plugins/crypter/OronCom.py
pyload/plugins/crypter/RSLayerCom.py
pyload/plugins/crypter/SecuredIn.py
pyload/plugins/crypter/SharingmatrixCom.py
pyload/plugins/crypter/SpeedLoadOrg.py
pyload/plugins/crypter/StealthTo.py
pyload/plugins/crypter/TrailerzoneInfo.py
pyload/plugins/crypter/WiiReloadedOrg.py
pyload/plugins/crypter/WuploadCom.py
pyload/plugins/internal/Account.py
pyload/plugins/internal/Addon.py
pyload/plugins/internal/BasePlugin.py
pyload/plugins/internal/Container.py
pyload/plugins/internal/Crypter.py
pyload/plugins/internal/DeadCrypter.py
pyload/plugins/internal/DeadHoster.py
pyload/plugins/internal/Hoster.py
pyload/plugins/internal/SimpleCrypter.py
pyload/utils/__init__.py
Diffstat (limited to 'pyload/plugins/internal/XFSAccount.py')
-rw-r--r-- | pyload/plugins/internal/XFSAccount.py | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/pyload/plugins/internal/XFSAccount.py b/pyload/plugins/internal/XFSAccount.py index 1e18c09bd..168c4f903 100644 --- a/pyload/plugins/internal/XFSAccount.py +++ b/pyload/plugins/internal/XFSAccount.py @@ -12,7 +12,7 @@ from pyload.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies class XFSAccount(Account): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.26" + __version__ = "0.30" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -32,6 +32,9 @@ class XFSAccount(Account): 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 + LEECH_TRAFFIC_PATTERN = r'Leech Traffic left:<b>.*?(?P<S>[\d.,]+|[Uu]nlimited)\s*(?:(?P<U>[\w^_]+)\s*)?</b>' + LEECH_TRAFFIC_UNIT = "MB" #: used only if no group <U> was found + LOGIN_FAIL_PATTERN = r'>(Incorrect Login or Password|Error<)' @@ -44,9 +47,10 @@ class XFSAccount(Account): def loadAccountInfo(self, user, req): - validuntil = None - trafficleft = None - premium = None + validuntil = None + trafficleft = None + leechtraffic = None + premium = None html = req.load(self.HOSTER_URL, get={'op': "my_account"}, decode=True) @@ -64,17 +68,22 @@ class XFSAccount(Account): self.logError(e) else: + self.logDebug("Valid until: %s" % validuntil) + if validuntil > mktime(gmtime()): premium = True + trafficleft = -1 else: premium = False validuntil = None #: registered account type (not premium) + else: + self.logDebug("VALID_UNTIL_PATTERN not found") m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: try: traffic = m.groupdict() - size = traffic['S'] + size = traffic['S'] if "nlimited" in size: trafficleft = -1 @@ -93,10 +102,36 @@ class XFSAccount(Account): except Exception, e: self.logError(e) else: - if premium: - trafficleft = -1 + self.logDebug("TRAFFIC_LEFT_PATTERN not found") + + m = re.finditer(self.LEECH_TRAFFIC_PATTERN, html) + if m: + leechtraffic = 0 + try: + for leech in m: + size = leech['S'] + + if "nlimited" in size: + leechtraffic = -1 + if validuntil is None: + validuntil = -1 + break + else: + if 'U' in leech: + unit = leech['U'] + elif isinstance(self.LEECH_TRAFFIC_UNIT, basestring): + unit = self.LEECH_TRAFFIC_UNIT + else: + unit = "" + + leechtraffic += self.parseTraffic(size + unit) + + except Exception, e: + self.logError(e) + else: + self.logDebug("LEECH_TRAFFIC_PATTERN not found") - return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'leechtraffic': leechtraffic, 'premium': premium} def login(self, user, data, req): |