From 16af85004c84d0d6c626b4f8424ce9647669a0c1 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 9 Jun 2013 18:10:22 +0200 Subject: moved everything from module to pyload --- module/plugins/accounts/X7To.py | 66 ----------------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 module/plugins/accounts/X7To.py (limited to 'module/plugins/accounts/X7To.py') diff --git a/module/plugins/accounts/X7To.py b/module/plugins/accounts/X7To.py deleted file mode 100644 index 8c2bf245a..000000000 --- a/module/plugins/accounts/X7To.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- - -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see . - - @author: ernieb -""" - -import re -from time import strptime, mktime - -from module.plugins.Account import Account - -class X7To(Account): - __name__ = "X7To" - __version__ = "0.1" - __type__ = "account" - __description__ = """X7.To account plugin""" - __author_name__ = ("ernieb") - __author_mail__ = ("ernieb") - - def loadAccountInfo(self, user, req): - page = req.load("http://www.x7.to/my") - - validCheck = re.search("Premium-Mitglied bis ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE) - if validCheck: - valid = validCheck.group(1) - valid = int(mktime(strptime(valid, "%Y-%m-%d"))) - else: - validCheck = re.search("Premium member until ([0-9]*-[0-9]*-[0-9]*)", page, re.IGNORECASE) - if validCheck: - valid = validCheck.group(1) - valid = int(mktime(strptime(valid, "%Y-%m-%d"))) - else: - valid = 0 - - trafficleft = re.search(r'([\d]*[,]?[\d]?[\d]?) (KB|MB|GB)', page, re.IGNORECASE) - if trafficleft: - units = float(trafficleft.group(1).replace(",", ".")) - pow = {'KB': 0, 'MB': 1, 'GB': 2}[trafficleft.group(2)] - trafficleft = int(units * 1024 ** pow) - else: - trafficleft = -1 - - return {"trafficleft": trafficleft, "validuntil": valid} - - - def login(self, user, data, req): - #req.cj.setCookie("share.cx", "lang", "english") - page = req.load("http://x7.to/lang/en", None, {}) - page = req.load("http://x7.to/james/login", None, - {"redirect": "http://www.x7.to/", "id": user, "pw": data['password'], "submit": "submit"}) - - if "Username and password are not matching." in page: - self.wrongPassword() -- cgit v1.2.3