diff options
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r-- | module/plugins/accounts/EasybytezCom.py | 10 | ||||
-rw-r--r-- | module/plugins/accounts/FreeWayMe.py | 67 | ||||
-rw-r--r-- | module/plugins/accounts/OverLoadMe.py | 31 | ||||
-rw-r--r-- | module/plugins/accounts/ShareFilesCo.py | 13 |
4 files changed, 103 insertions, 18 deletions
diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index 72f37b699..ffd132ba3 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -18,7 +18,7 @@ """ import re -from time import mktime, strptime +from time import mktime, strptime, gmtime from module.plugins.Account import Account from module.plugins.internal.SimpleHoster import parseHtmlForm @@ -27,7 +27,7 @@ from module.utils import parseFileSize class EasybytezCom(Account): __name__ = "EasybytezCom" - __version__ = "0.03" + __version__ = "0.04" __type__ = "account" __description__ = """EasyBytez.com account plugin""" __author_name__ = ("zoidberg") @@ -44,19 +44,19 @@ class EasybytezCom(Account): found = re.search(self.VALID_UNTIL_PATTERN, html) if found: - premium = True - trafficleft = -1 try: self.logDebug("Expire date: " + found.group(1)) validuntil = mktime(strptime(found.group(1), "%d %B %Y")) except Exception, e: self.logError(e) + if validuntil > mktime(gmtime()): + premium = True + trafficleft = -1 else: found = re.search(self.TRAFFIC_LEFT_PATTERN, html) if found: trafficleft = found.group(1) if "Unlimited" in trafficleft: - premium = True trafficleft = -1 else: trafficleft = parseFileSize(trafficleft) / 1024 diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py new file mode 100644 index 000000000..0222ad65f --- /dev/null +++ b/module/plugins/accounts/FreeWayMe.py @@ -0,0 +1,67 @@ +# -*- 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 <http://www.gnu.org/licenses/>. + + @author: Nicolas Giese +""" + +from module.plugins.Account import Account +from module.common.json_layer import json_loads + + +class FreeWayMe(Account): + __name__ = "FreeWayMe" + __version__ = "0.11" + __type__ = "account" + __description__ = """FreeWayMe account plugin""" + __author_name__ = ("Nicolas Giese") + __author_mail__ = ("james@free-way.me") + + def loadAccountInfo(self, user, req): + status = self.getAccountStatus(user, req) + if not status: + return False + self.logDebug(status) + + account_info = {"validuntil": -1, "premium": False} + if status["premium"] == "Free": + account_info["trafficleft"] = int(status["guthaben"]) * 1024 + elif status["premium"] == "Spender": + account_info["trafficleft"] = -1 + elif status["premium"] == "Flatrate": + account_info = {"validuntil": int(status["Flatrate"]), + "trafficleft": -1, + "premium": True} + + return account_info + + def getpw(self, user): + return self.accounts[user]["password"] + + def login(self, user, data, req): + status = self.getAccountStatus(user, req) + + # Check if user and password are valid + if not status: + self.wrongPassword() + + def getAccountStatus(self, user, req): + answer = req.load("https://www.free-way.me/ajax/jd.php", + get={"id": 4, "user": user, "pass": self.accounts[user]["password"]}) + self.logDebug("login: %s" % answer) + if answer == "Invalid login": + self.wrongPassword() + return False + return json_loads(answer) diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py new file mode 100644 index 000000000..e288181eb --- /dev/null +++ b/module/plugins/accounts/OverLoadMe.py @@ -0,0 +1,31 @@ +from module.plugins.Account import Account +from module.common.json_layer import json_loads + + +class OverLoadMe(Account): + __name__ = "OverLoadMe" + __version__ = "0.01" + __type__ = "account" + __description__ = """Over-Load.me account plugin""" + __author_name__ = ("marley") + __author_mail__ = ("marley@over-load.me") + + def loadAccountInfo(self, user, req): + data = self.getAccountData(user) + page = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data["password"]}).strip() + data = json_loads(page) + + # Check for premium + if data["membership"] == "Free": + return {"premium": False} + + account_info = {"validuntil": data["expirationunix"], "trafficleft": -1} + return account_info + + def login(self, user, data, req): + jsondata = req.load("https://api.over-load.me/account.php", + get={"user": user, "auth": data["password"]}).strip() + data = json_loads(jsondata) + + if data["err"] == 1: + self.wrongPassword() diff --git a/module/plugins/accounts/ShareFilesCo.py b/module/plugins/accounts/ShareFilesCo.py deleted file mode 100644 index cff52d570..000000000 --- a/module/plugins/accounts/ShareFilesCo.py +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -from module.plugins.internal.XFSPAccount import XFSPAccount - - -class ShareFilesCo(XFSPAccount): - __name__ = "ShareFilesCo" - __version__ = "0.01" - __type__ = "account" - __description__ = """ShareFilesCo account plugin""" - __author_name__ = ("stickell") - __author_mail__ = ("l.stickell@yahoo.it") - - MAIN_PAGE = "http://sharefiles.co/" |