diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/Account.py | 14 | ||||
-rw-r--r-- | module/plugins/accounts/RapidshareCom.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/ShareonlineBiz.py | 23 | ||||
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 4 | ||||
-rw-r--r-- | module/plugins/hooks/UpdateManager.py | 2 |
5 files changed, 26 insertions, 19 deletions
diff --git a/module/plugins/Account.py b/module/plugins/Account.py index 9295b78f1..96e750db6 100644 --- a/module/plugins/Account.py +++ b/module/plugins/Account.py @@ -17,8 +17,12 @@ @author: mkaay """ -from random import choice import re +from random import choice +from traceback import print_exc + +class WrongPassword(Exception): + pass class Account(): __name__ = "Account" @@ -41,11 +45,14 @@ class Account(): def _login(self, user, data): try: self.login(user, data) + except WrongPassword: + self.core.log.warning(_("Could not login with account %s | %s") % (user, _("Wrong Password"))) + data["valid"] = False + except Exception, e: self.core.log.warning(_("Could not login with account %s | %s") % (user, e)) data["valid"] = False if self.core.debug: - from traceback import print_exc print_exc() def setAccounts(self, accounts): @@ -143,3 +150,6 @@ class Account(): elif unit == "mb" or unit == "megabyte" or unit == "mbyte" or unit == "mib": traffic *= 1024 return traffic + + def wrongPassword(self): + raise WrongPassword diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py index ccc0d0fb2..683237674 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -55,7 +55,7 @@ class RapidshareCom(Account): api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1} src = req.load(api_url_base, cookies=False, get=api_param_prem) if src.startswith("ERROR"): - raise Exception(src) + raise Exception(src+"### Note you have to use your account number for login, instead of name.") fields = src.split("\n") info = {} for t in fields: diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index a85dbbe71..e6eaf6f27 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -29,22 +29,17 @@ class ShareonlineBiz(Account): __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - def getAccountInfo(self, user): - try: - req = self.core.requestFactory.getRequest(self.__name__, user) - src = req.load("http://www.share-online.biz/members.php?setlang=en") - validuntil = re.search(r'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+</td>', src).group(1) - validuntil = int(mktime(strptime(validuntil, "%m/%d/%Y"))) - - out = Account.getAccountInfo(self, user) - tmp = {"validuntil":validuntil, "trafficleft":-1} - out.update(tmp) - return out - except: - return Account.getAccountInfo(self, user) + def loadAccountInfo(self, user): + req = self.getAccountRequest(user) + src = req.load("http://www.share-online.biz/members.php?setlang=en") + validuntil = re.search(r'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+)</td>', src).group(1) + validuntil = int(mktime(strptime(validuntil, "%m/%d/%Y"))) + + tmp = {"validuntil":validuntil, "trafficleft":-1} + return tmp def login(self, user, data): - req = self.core.requestFactory.getRequest(self.__name__, user) + req = self.getAccountRequest(user) post_vars = { "act": "login", "location": "index.php", diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index a783d9154..9b51f5aad 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -42,4 +42,6 @@ class UploadedTo(Account): def login(self, user, data): req = self.getAccountRequest() - req.load("http://uploaded.to/login", post={ "email" : user, "password" : data["password"]}, cookies=True) + page = req.load("http://uploaded.to/login", post={ "email" : user, "password" : data["password"]}, cookies=True) + if "Login failed!" in page: + self.wrongPassword() diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 6a1a31ade..b0fc766cb 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -57,7 +57,7 @@ class UpdateManager(Hook): self.log.info(_("*** Get it here: http://pyload.org/download ***")) return True except: - self.log.error(_("Not able to connect server for updates")) + self.log.warning(_("Not able to connect server for updates")) return False |