summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-25 09:34:18 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-25 09:34:18 +0200
commita95c217627a1cb651b24e69f20640df40797aff9 (patch)
tree63fcbffd55b704b461446c1724022e76373dac12 /module
parentAccount rewritten (diff)
downloadpyload-a95c217627a1cb651b24e69f20640df40797aff9.tar.xz
Account rewritten (2)
Diffstat (limited to 'module')
-rw-r--r--module/plugins/accounts/AlldebridCom.py2
-rw-r--r--module/plugins/accounts/BitshareCom.py2
-rw-r--r--module/plugins/accounts/CatShareNet.py2
-rw-r--r--module/plugins/accounts/CloudzillaTo.py2
-rw-r--r--module/plugins/accounts/CzshareCom.py2
-rw-r--r--module/plugins/accounts/DebridItaliaCom.py2
-rw-r--r--module/plugins/accounts/DepositfilesCom.py2
-rw-r--r--module/plugins/accounts/EuroshareEu.py2
-rw-r--r--module/plugins/accounts/FastixRu.py2
-rw-r--r--module/plugins/accounts/FastshareCz.py2
-rw-r--r--module/plugins/accounts/FilecloudIo.py4
-rw-r--r--module/plugins/accounts/FilefactoryCom.py2
-rw-r--r--module/plugins/accounts/FilejungleCom.py2
-rw-r--r--module/plugins/accounts/FilerNet.py2
-rw-r--r--module/plugins/accounts/FilesMailRu.py2
-rw-r--r--module/plugins/accounts/FileserveCom.py2
-rw-r--r--module/plugins/accounts/FourSharedCom.py2
-rw-r--r--module/plugins/accounts/FreakshareCom.py2
-rw-r--r--module/plugins/accounts/FreeWayMe.py12
-rw-r--r--module/plugins/accounts/FshareVn.py2
-rw-r--r--module/plugins/accounts/HellshareCz.py2
-rw-r--r--module/plugins/accounts/HighWayMe.py2
-rw-r--r--module/plugins/accounts/Keep2ShareCc.py2
-rw-r--r--module/plugins/accounts/LetitbitNet.py3
-rw-r--r--module/plugins/accounts/LinksnappyCom.py2
-rw-r--r--module/plugins/accounts/MegaDebridEu.py2
-rw-r--r--module/plugins/accounts/MegaRapidoNet.py4
-rw-r--r--module/plugins/accounts/MegasharesCom.py2
-rw-r--r--module/plugins/accounts/MultishareCz.py2
-rw-r--r--module/plugins/accounts/MyfastfileCom.py2
-rw-r--r--module/plugins/accounts/NitroflareCom.py2
-rw-r--r--module/plugins/accounts/NoPremiumPl.py4
-rw-r--r--module/plugins/accounts/NowVideoSx.py2
-rw-r--r--module/plugins/accounts/OboomCom.py4
-rw-r--r--module/plugins/accounts/OneFichierCom.py2
-rw-r--r--module/plugins/accounts/OverLoadMe.py2
-rw-r--r--module/plugins/accounts/PremiumTo.py2
-rw-r--r--module/plugins/accounts/PremiumizeMe.py10
-rw-r--r--module/plugins/accounts/QuickshareCz.py2
-rw-r--r--module/plugins/accounts/RPNetBiz.py10
-rw-r--r--module/plugins/accounts/RapideoPl.py4
-rw-r--r--module/plugins/accounts/RapidgatorNet.py2
-rw-r--r--module/plugins/accounts/RapiduNet.py2
-rw-r--r--module/plugins/accounts/RealdebridCom.py2
-rw-r--r--module/plugins/accounts/RehostTo.py7
-rw-r--r--module/plugins/accounts/ShareonlineBiz.py10
-rw-r--r--module/plugins/accounts/SimplyPremiumCom.py2
-rw-r--r--module/plugins/accounts/SimplydebridCom.py17
-rw-r--r--module/plugins/accounts/SmoozedCom.py10
-rw-r--r--module/plugins/accounts/TurbobitNet.py2
-rw-r--r--module/plugins/accounts/UlozTo.py2
-rw-r--r--module/plugins/accounts/UploadableCh.py2
-rw-r--r--module/plugins/accounts/UploadedTo.py2
-rw-r--r--module/plugins/accounts/UploadheroCom.py2
-rw-r--r--module/plugins/accounts/WebshareCz.py4
-rw-r--r--module/plugins/accounts/YibaishiwuCom.py2
-rw-r--r--module/plugins/accounts/ZeveraCom.py2
-rw-r--r--module/plugins/captcha/ReCaptcha.py2
-rw-r--r--module/plugins/captcha/SolveMedia.py4
-rw-r--r--module/plugins/hoster/BasePlugin.py2
-rw-r--r--module/plugins/hoster/FileserveCom.py2
-rw-r--r--module/plugins/hoster/FreeWayMe.py2
-rw-r--r--module/plugins/hoster/Ftp.py2
-rw-r--r--module/plugins/hoster/LetitbitNet.py2
-rw-r--r--module/plugins/hoster/LinksnappyCom.py2
-rw-r--r--module/plugins/hoster/MyfastfileCom.py2
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py2
-rw-r--r--module/plugins/internal/Account.py95
-rw-r--r--module/plugins/internal/Addon.py2
-rw-r--r--module/plugins/internal/Captcha.py5
-rw-r--r--module/plugins/internal/CaptchaService.py8
-rw-r--r--module/plugins/internal/Container.py3
-rw-r--r--module/plugins/internal/Hoster.py36
-rw-r--r--module/plugins/internal/Plugin.py15
-rw-r--r--module/plugins/internal/SimpleHoster.py4
75 files changed, 208 insertions, 171 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py
index 0647892b0..6a2f09c9c 100644
--- a/module/plugins/accounts/AlldebridCom.py
+++ b/module/plugins/accounts/AlldebridCom.py
@@ -63,4 +63,4 @@ class AlldebridCom(Account):
if "This login doesn't exist" in html \
or "The password is not valid" in html \
or "Invalid captcha" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py
index 426468ee6..280f008b2 100644
--- a/module/plugins/accounts/BitshareCom.py
+++ b/module/plugins/accounts/BitshareCom.py
@@ -33,4 +33,4 @@ class BitshareCom(Account):
'submit' : "Login"})
if "login" in req.lastEffectiveURL:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py
index f198561f5..92f1cb27e 100644
--- a/module/plugins/accounts/CatShareNet.py
+++ b/module/plugins/accounts/CatShareNet.py
@@ -58,4 +58,4 @@ class CatShareNet(Account):
'user[submit]' : "Login"})
if not '<a href="/logout">Wyloguj</a>' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py
index b6c65fc8c..0d473eb7d 100644
--- a/module/plugins/accounts/CloudzillaTo.py
+++ b/module/plugins/accounts/CloudzillaTo.py
@@ -34,4 +34,4 @@ class CloudzillaTo(Account):
'w' : "dologin"})
if "ERROR" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py
index 4077b5909..e9a34cb83 100644
--- a/module/plugins/accounts/CzshareCom.py
+++ b/module/plugins/accounts/CzshareCom.py
@@ -51,4 +51,4 @@ class CzshareCom(Account):
"login-name" : user})
if '<div class="login' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py
index cb9771769..9c0956668 100644
--- a/module/plugins/accounts/DebridItaliaCom.py
+++ b/module/plugins/accounts/DebridItaliaCom.py
@@ -42,4 +42,4 @@ class DebridItaliaCom(Account):
'p': password})
if 'NO' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py
index 398a2ac85..848529bc3 100644
--- a/module/plugins/accounts/DepositfilesCom.py
+++ b/module/plugins/accounts/DepositfilesCom.py
@@ -35,4 +35,4 @@ class DepositfilesCom(Account):
'password': password})
if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py
index e61b8e853..bc8618250 100644
--- a/module/plugins/accounts/EuroshareEu.py
+++ b/module/plugins/accounts/EuroshareEu.py
@@ -39,4 +39,4 @@ class EuroshareEu(Account):
'password': password})
if u">Nesprávne prihlasovacie meno alebo heslo" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py
index 91608c2ae..13edbbb44 100644
--- a/module/plugins/accounts/FastixRu.py
+++ b/module/plugins/accounts/FastixRu.py
@@ -43,4 +43,4 @@ class FastixRu(Account):
data['api'] = api
if "error_code" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py
index 119e26579..90b746624 100644
--- a/module/plugins/accounts/FastshareCz.py
+++ b/module/plugins/accounts/FastshareCz.py
@@ -48,4 +48,4 @@ class FastshareCz(Account):
'heslo': password})
if ">Wrong username or password" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py
index fb61e507c..56d84e2e4 100644
--- a/module/plugins/accounts/FilecloudIo.py
+++ b/module/plugins/accounts/FilecloudIo.py
@@ -20,7 +20,7 @@ class FilecloudIo(Account):
#: It looks like the first API request always fails, so we retry 5 times, it should work on the second try
for _i in xrange(5):
rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api",
- post={'username': user, 'password': self.get_data(user)['password']})
+ post={'username': user, 'password': password})
rep = json_loads(rep)
if rep['status'] == "ok":
break
@@ -56,4 +56,4 @@ class FilecloudIo(Account):
post=self.form_data)
if "you have successfully logged in" not in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py
index ee90cfbdf..e3d0c8491 100644
--- a/module/plugins/accounts/FilefactoryCom.py
+++ b/module/plugins/accounts/FilefactoryCom.py
@@ -46,4 +46,4 @@ class FilefactoryCom(Account):
'Submit' : "Sign In"})
if req.lastEffectiveURL != "http://www.filefactory.com/account/":
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py
index 5c91c3822..fb251ac5f 100644
--- a/module/plugins/accounts/FilejungleCom.py
+++ b/module/plugins/accounts/FilejungleCom.py
@@ -48,4 +48,4 @@ class FilejungleCom(Account):
'recaptcha_shortencode_field': ""})
if re.search(self.LOGIN_FAILED_PATTERN, html):
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py
index c4d06690b..674c7a5dd 100644
--- a/module/plugins/accounts/FilerNet.py
+++ b/module/plugins/accounts/FilerNet.py
@@ -56,4 +56,4 @@ class FilerNet(Account):
'_target_path': "https://filer.net/"})
if 'Logout' not in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py
index a01de48fd..7ed09e731 100644
--- a/module/plugins/accounts/FilesMailRu.py
+++ b/module/plugins/accounts/FilesMailRu.py
@@ -28,4 +28,4 @@ class FilesMailRu(Account):
'Page' : "http://files.mail.ru/"})
if "Неверное имя пользователя или пароль" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py
index 528bf7e58..dabfc1932 100644
--- a/module/plugins/accounts/FileserveCom.py
+++ b/module/plugins/accounts/FileserveCom.py
@@ -41,7 +41,7 @@ class FileserveCom(Account):
res = json_loads(html)
if not res['type']:
- self.fail()
+ self.login_fail()
#: Login at fileserv html
self.load("http://www.fileserve.com/login.php",
diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py
index 448f0e185..ef2140359 100644
--- a/module/plugins/accounts/FourSharedCom.py
+++ b/module/plugins/accounts/FourSharedCom.py
@@ -31,4 +31,4 @@ class FourSharedCom(Account):
'returnTo' : "http://www.4shared.com/account/home.jsp"})
if 'Please log in to access your 4shared account' in res:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py
index 404e60ee1..a2f66f3b3 100644
--- a/module/plugins/accounts/FreakshareCom.py
+++ b/module/plugins/accounts/FreakshareCom.py
@@ -50,4 +50,4 @@ class FreakshareCom(Account):
'pass' : password})
if ">Wrong Username or Password" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py
index bfb2747cb..0c315873f 100644
--- a/module/plugins/accounts/FreeWayMe.py
+++ b/module/plugins/accounts/FreeWayMe.py
@@ -16,7 +16,7 @@ class FreeWayMe(Account):
def parse_info(self, user, password, data, req):
- status = self.get_account_status(user, req)
+ status = self.get_account_status(user, password, req)
self.log_debug(status)
@@ -34,20 +34,20 @@ class FreeWayMe(Account):
def login(self, user, password, data, req):
- status = self.get_account_status(user, req)
+ status = self.get_account_status(user, password, req)
#: Check if user and password are valid
if not status:
- self.fail()
+ self.login_fail()
- def get_account_status(self, user, req):
+ def get_account_status(self, user, password, req):
answer = self.load("http://www.free-way.bz/ajax/jd.php", #@TODO: Revert to `https` in 0.4.10
- get={'id': 4, 'user': user, 'pass': self.get_data(user)['password']})
+ get={'id': 4, 'user': user, 'pass': password})
self.log_debug("Login: %s" % answer)
if answer == "Invalid login":
- self.fail()
+ self.login_fail()
return json_loads(answer)
diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py
index 7d7359fd0..bc8ced5e2 100644
--- a/module/plugins/accounts/FshareVn.py
+++ b/module/plugins/accounts/FshareVn.py
@@ -53,7 +53,7 @@ class FshareVn(Account):
'yt0' : "Login"})
if not re.search(r'<img\s+alt="VIP"', html):
- self.fail()
+ self.login_fail()
def get_traffic_left(self):
diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py
index 7d65d0176..55daa8c2d 100644
--- a/module/plugins/accounts/HellshareCz.py
+++ b/module/plugins/accounts/HellshareCz.py
@@ -77,4 +77,4 @@ class HellshareCz(Account):
'perm_login': "on"})
if "<p>You input a wrong user name or wrong password</p>" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py
index f546c2fe1..ff90ec2d2 100644
--- a/module/plugins/accounts/HighWayMe.py
+++ b/module/plugins/accounts/HighWayMe.py
@@ -47,4 +47,4 @@ class HighWayMe(Account):
'pass': password})
if 'UserOrPassInvalid' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py
index 3a6100bb3..a7f8564d9 100644
--- a/module/plugins/accounts/Keep2ShareCc.py
+++ b/module/plugins/accounts/Keep2ShareCc.py
@@ -70,4 +70,4 @@ class Keep2ShareCc(Account):
'yt0' : ""})
if re.search(self.LOGIN_FAIL_PATTERN, html):
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py
index 2d0e1b236..1fc9b76ba 100644
--- a/module/plugins/accounts/LetitbitNet.py
+++ b/module/plugins/accounts/LetitbitNet.py
@@ -17,8 +17,7 @@ class LetitbitNet(Account):
def parse_info(self, user, password, data, req):
## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ##
- # api_key = self.get_data(user)['password']
- # json_data = [api_key, ['key/info']]
+ # json_data = [password, ['key/info']]
# api_rep = self.load("http://api.letitbit.net/json",
# post={'r': json_dumps(json_data)})
# self.log_debug("API Key Info: " + api_rep)
diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py
index 9a90cd79d..00ae64b44 100644
--- a/module/plugins/accounts/LinksnappyCom.py
+++ b/module/plugins/accounts/LinksnappyCom.py
@@ -59,4 +59,4 @@ class LinksnappyCom(Account):
'password': hashlib.md5(password).hexdigest()})
if "Invalid Account Details" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py
index 682de4db1..d7a04491d 100644
--- a/module/plugins/accounts/MegaDebridEu.py
+++ b/module/plugins/accounts/MegaDebridEu.py
@@ -41,4 +41,4 @@ class MegaDebridEu(Account):
'password': password})
res = json_loads(jsonResponse)
if res['response_code'] != "ok":
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py
index d07df500c..08cf1f535 100644
--- a/module/plugins/accounts/MegaRapidoNet.py
+++ b/module/plugins/accounts/MegaRapidoNet.py
@@ -49,10 +49,10 @@ class MegaRapidoNet(Account):
html = self.load("http://megarapido.net/gerador")
if "sair" not in html.lower():
- self.fail()
+ self.login_fail()
else:
m = re.search(self.USER_ID_PATTERN, html)
if m:
data['uid'] = m.group(1)
else:
- self.fail("Couldn't find the user ID")
+ self.login_fail("Couldn't find the user ID")
diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py
index ef6724512..ec43b7fc0 100644
--- a/module/plugins/accounts/MegasharesCom.py
+++ b/module/plugins/accounts/MegasharesCom.py
@@ -45,4 +45,4 @@ class MegasharesCom(Account):
'mymspassword' : password})
if not '<span class="b ml">%s</span>' % user in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py
index 2bcbae8f8..c9e30a93f 100644
--- a/module/plugins/accounts/MultishareCz.py
+++ b/module/plugins/accounts/MultishareCz.py
@@ -41,4 +41,4 @@ class MultishareCz(Account):
'jmeno': user})
if '<div class="akce-chyba akce">' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py
index d049b13e6..008b62cc6 100644
--- a/module/plugins/accounts/MyfastfileCom.py
+++ b/module/plugins/accounts/MyfastfileCom.py
@@ -36,4 +36,4 @@ class MyfastfileCom(Account):
self.json_data = json_loads(html)
if self.json_data['status'] != 'ok':
self.log_error(_('Invalid login. The password to use is the API-Password you find in your "My Account" page'))
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py
index f4e9d402a..b7edcca32 100644
--- a/module/plugins/accounts/NitroflareCom.py
+++ b/module/plugins/accounts/NitroflareCom.py
@@ -79,4 +79,4 @@ class NitroflareCom(Account):
'token' : token})
if re.search(self.LOGIN_FAIL_PATTERN, html):
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py
index dfd10c6f7..e9dad7647 100644
--- a/module/plugins/accounts/NoPremiumPl.py
+++ b/module/plugins/accounts/NoPremiumPl.py
@@ -62,10 +62,10 @@ class NoPremiumPl(Account):
try:
response = json_loads(self.run_auth_query())
except Exception:
- self.fail()
+ self.login_fail()
if "errno" in response.keys():
- self.fail()
+ self.login_fail()
data['usr'] = self._usr
data['pwd'] = self._pwd
diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py
index 8d4add5f6..73bb383be 100644
--- a/module/plugins/accounts/NowVideoSx.py
+++ b/module/plugins/accounts/NowVideoSx.py
@@ -54,4 +54,4 @@ class NowVideoSx(Account):
'pass': password})
if re.search(r'>Log In<', html):
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py
index 5dc1fcae2..fcb309132 100644
--- a/module/plugins/accounts/OboomCom.py
+++ b/module/plugins/accounts/OboomCom.py
@@ -32,7 +32,7 @@ class OboomCom(Account):
def load_account_data(self, user, req):
- passwd = self.get_data(user)['password']
+ passwd = self.get_info(user)['login']['password']
salt = passwd[::-1]
pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16)
@@ -42,7 +42,7 @@ class OboomCom(Account):
if not result[0] == 200:
self.log_warning(_("Failed to log in: %s") % result[1])
- self.fail()
+ self.login_fail()
return result[1]
diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py
index 2553462ca..3a0131a3f 100644
--- a/module/plugins/accounts/OneFichierCom.py
+++ b/module/plugins/accounts/OneFichierCom.py
@@ -55,4 +55,4 @@ class OneFichierCom(Account):
'valider': "Send"})
if '>Invalid email address' in html or '>Invalid password' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py
index 5e7625244..6741b674f 100644
--- a/module/plugins/accounts/OverLoadMe.py
+++ b/module/plugins/accounts/OverLoadMe.py
@@ -39,4 +39,4 @@ class OverLoadMe(Account):
data = json_loads(jsondata)
if data['err'] == 1:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py
index e25b3b33e..ba8f24c6d 100644
--- a/module/plugins/accounts/PremiumTo.py
+++ b/module/plugins/accounts/PremiumTo.py
@@ -36,4 +36,4 @@ class PremiumTo(Account):
'password': self.password})
if "wrong username" in authcode:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py
index 11a2c648f..19fce0e77 100644
--- a/module/plugins/accounts/PremiumizeMe.py
+++ b/module/plugins/accounts/PremiumizeMe.py
@@ -17,7 +17,7 @@ class PremiumizeMe(Account):
def parse_info(self, user, password, data, req):
#: Get user data from premiumize.me
- status = self.get_account_status(user, req)
+ status = self.get_account_status(user, password, req)
self.log_debug(status)
#: Parse account info
@@ -32,18 +32,18 @@ class PremiumizeMe(Account):
def login(self, user, password, data, req):
#: Get user data from premiumize.me
- status = self.get_account_status(user, req)
+ status = self.get_account_status(user, password, req)
#: Check if user and password are valid
if status['status'] != 200:
- self.fail()
+ self.login_fail()
- def get_account_status(self, user, req):
+ def get_account_status(self, user, password, req):
#: Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api)
#: To retrieve account info and return the parsed json answer
answer = self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10
get={'method' : "accountstatus",
'params[login]': user,
- 'params[pass]' : self.get_data(user)['password']})
+ 'params[pass]' : password})
return json_loads(answer)
diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py
index b1416d967..42022ec82 100644
--- a/module/plugins/accounts/QuickshareCz.py
+++ b/module/plugins/accounts/QuickshareCz.py
@@ -40,4 +40,4 @@ class QuickshareCz(Account):
'jmeno': user})
if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py
index cd1523a92..5fd7e5878 100644
--- a/module/plugins/accounts/RPNetBiz.py
+++ b/module/plugins/accounts/RPNetBiz.py
@@ -17,7 +17,7 @@ class RPNetBiz(Account):
def parse_info(self, user, password, data, req):
#: Get account information from rpnet.biz
- res = self.get_account_status(user, req)
+ res = self.get_account_status(user, password, req)
try:
if res['accountInfo']['isPremium']:
#: Parse account info. Change the trafficleft later to support per host info.
@@ -35,17 +35,17 @@ class RPNetBiz(Account):
def login(self, user, password, data, req):
#: Get account information from rpnet.biz
- res = self.get_account_status(user, req)
+ res = self.get_account_status(user, password, req)
#: If we have an error in the res, we have wrong login information
if 'error' in res:
- self.fail()
+ self.login_fail()
- def get_account_status(self, user, req):
+ def get_account_status(self, user, password req):
#: Using the rpnet API, check if valid premium account
res = self.load("https://premium.rpnet.biz/client_api.php",
- get={'username': user, 'password': self.get_data(user)['password'],
+ get={'username': user, 'password': password,
'action': "showAccountInformation"})
self.log_debug("JSON data: %s" % res)
diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py
index 6e2c0a134..42d084bdb 100644
--- a/module/plugins/accounts/RapideoPl.py
+++ b/module/plugins/accounts/RapideoPl.py
@@ -62,10 +62,10 @@ class RapideoPl(Account):
try:
response = json_loads(self.run_auth_query())
except Exception:
- self.fail()
+ self.login_fail()
if "errno" in response.keys():
- self.fail()
+ self.login_fail()
data['usr'] = self._usr
data['pwd'] = self._pwd
diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py
index 56f3aa866..5ce51a1ec 100644
--- a/module/plugins/accounts/RapidgatorNet.py
+++ b/module/plugins/accounts/RapidgatorNet.py
@@ -75,4 +75,4 @@ class RapidgatorNet(Account):
except Exception, e:
self.log_error(e)
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py
index 29c939602..1ec29bd77 100644
--- a/module/plugins/accounts/RapiduNet.py
+++ b/module/plugins/accounts/RapiduNet.py
@@ -63,4 +63,4 @@ class RapiduNet(Account):
self.log_debug(json)
if not json['message'] == "success":
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py
index c39293ce6..718850c1a 100644
--- a/module/plugins/accounts/RealdebridCom.py
+++ b/module/plugins/accounts/RealdebridCom.py
@@ -38,7 +38,7 @@ class RealdebridCom(Account):
'pass': password})
if "Your login informations are incorrect" in html:
- self.fail()
+ self.login_fail()
elif "PIN Code required" in html:
self.log_warning(_("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com"))
diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py
index 1bfd79088..36e5e33eb 100644
--- a/module/plugins/accounts/RehostTo.py
+++ b/module/plugins/accounts/RehostTo.py
@@ -21,8 +21,9 @@ class RehostTo(Account):
session = ""
html = self.load("https://rehost.to/api.php",
- get={'cmd' : "login", 'user': user,
- 'pass': self.get_data(user)['password']})
+ get={'cmd' : "login",
+ 'user': user,
+ 'pass': password})
try:
session = html.split(",")[1].split("=")[1]
@@ -54,4 +55,4 @@ class RehostTo(Account):
if "ERROR" in html:
self.log_debug(html)
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py
index 85cdfecd9..31a1a24c6 100644
--- a/module/plugins/accounts/ShareonlineBiz.py
+++ b/module/plugins/accounts/ShareonlineBiz.py
@@ -16,12 +16,12 @@ class ShareonlineBiz(Account):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- def api_response(self, user, req):
+ def api_response(self, user, password, req):
return self.load("http://api.share-online.biz/cgi-bin",
get={'q' : "userdetails",
'aux' : "traffic",
'username': user,
- 'password': self.get_data(user)['password']})
+ 'password': password})
def parse_info(self, user, password, data, req):
@@ -31,7 +31,7 @@ class ShareonlineBiz(Account):
maxtraffic = 100 * 1024 * 1024 * 1024 #: 100 GB
api = {}
- for line in self.api_response(user, req).splitlines():
+ for line in self.api_response(user, password, req).splitlines():
if "=" in line:
key, value = line.split("=")
api[key] = value
@@ -62,8 +62,8 @@ class ShareonlineBiz(Account):
def login(self, user, password, data, req):
- html = self.api_response(user, req)
+ html = self.api_response(user, password, req)
err = re.search(r'\*\*(.+?)\*\*', html)
if err:
self.log_error(err.group(1).strip())
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py
index 534a75be8..f8b5ff50b 100644
--- a/module/plugins/accounts/SimplyPremiumCom.py
+++ b/module/plugins/accounts/SimplyPremiumCom.py
@@ -45,4 +45,4 @@ class SimplyPremiumCom(Account):
post={'key': user} if not password else {'login_name': user, 'login_pass': password})
if 'logout' not in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py
index b123021dd..84c38227e 100644
--- a/module/plugins/accounts/SimplydebridCom.py
+++ b/module/plugins/accounts/SimplydebridCom.py
@@ -17,8 +17,10 @@ class SimplydebridCom(Account):
def parse_info(self, user, password, data, req):
- get_data = {'login': 2, 'u': self.loginname, 'p': self.password}
- res = self.load("http://simply-debrid.com/api.php", get=get_data)
+ res = self.load("http://simply-debrid.com/api.php",
+ get={'login': 2,
+ 'u' : user,
+ 'p' : password})
data = [x.strip() for x in res.split(";")]
if str(data[0]) != "1":
return {'premium': False}
@@ -27,10 +29,9 @@ class SimplydebridCom(Account):
def login(self, user, password, data, req):
- self.loginname = user
- self.password = password
- get_data = {'login': 1, 'u': self.loginname, 'p': self.password}
-
- res = self.load("https://simply-debrid.com/api.php", get=get_data)
+ res = self.load("https://simply-debrid.com/api.php",
+ get={'login': 1,
+ 'u' : user,
+ 'p' : password})
if res != "02: loggin success":
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py
index 2201e4294..9c2451794 100644
--- a/module/plugins/accounts/SmoozedCom.py
+++ b/module/plugins/accounts/SmoozedCom.py
@@ -35,7 +35,7 @@ class SmoozedCom(Account):
def parse_info(self, user, password, data, req):
- status = self.get_account_status(user, req)
+ status = self.get_account_status(user, password, req)
self.log_debug(status)
@@ -63,15 +63,15 @@ class SmoozedCom(Account):
def login(self, user, password, data, req):
#: Get user data from premiumize.me
- status = self.get_account_status(user, req)
+ status = self.get_account_status(user, password, req)
#: Check if user and password are valid
if status['state'] != 'ok':
- self.fail()
+ self.login_fail()
- def get_account_status(self, user, req):
- password = self.get_data(user)['password']
+ def get_account_status(self, user, password, req):
+ password = password
salt = hashlib.sha256(password).hexdigest()
encrypted = PBKDF2(password, salt, iterations=1000).hexread(32)
diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py
index afed6efbc..9dd3e4d3c 100644
--- a/module/plugins/accounts/TurbobitNet.py
+++ b/module/plugins/accounts/TurbobitNet.py
@@ -40,4 +40,4 @@ class TurbobitNet(Account):
"user[submit]": "Login"})
if not '<div class="menu-item user-name">' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py
index ed4c11a23..00e125dbc 100644
--- a/module/plugins/accounts/UlozTo.py
+++ b/module/plugins/accounts/UlozTo.py
@@ -46,4 +46,4 @@ class UlozTo(Account):
'remember': "on"})
if '<div class="flash error">' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py
index e1865bb52..9c2649e51 100644
--- a/module/plugins/accounts/UploadableCh.py
+++ b/module/plugins/accounts/UploadableCh.py
@@ -31,4 +31,4 @@ class UploadableCh(Account):
'action__login': "normalLogin"})
if "Login failed" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py
index 407658354..3b733ae23 100644
--- a/module/plugins/accounts/UploadedTo.py
+++ b/module/plugins/accounts/UploadedTo.py
@@ -70,4 +70,4 @@ class UploadedTo(Account):
'_': ""})
if '"err"' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py
index 0b82f0e5a..f31b01d03 100644
--- a/module/plugins/accounts/UploadheroCom.py
+++ b/module/plugins/accounts/UploadheroCom.py
@@ -40,4 +40,4 @@ class UploadheroCom(Account):
'password_login': password})
if "mot de passe invalide" in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py
index 1f2adb7f5..bbfb90a92 100644
--- a/module/plugins/accounts/WebshareCz.py
+++ b/module/plugins/accounts/WebshareCz.py
@@ -47,7 +47,7 @@ class WebshareCz(Account):
'wst' : ""})
if "<status>OK</status>" not in salt:
- self.fail()
+ self.login_fail()
salt = re.search('<salt>(.+)</salt>', salt).group(1)
password = hashlib.sha1(md5_crypt.encrypt(password, salt=salt)).hexdigest()
@@ -61,6 +61,6 @@ class WebshareCz(Account):
'wst' : ""})
if "<status>OK</status>" not in login:
- self.fail()
+ self.login_fail()
data['wst'] = re.search('<token>(.+)</token>', login).group(1)
diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py
index a1886c945..c5dda0921 100644
--- a/module/plugins/accounts/YibaishiwuCom.py
+++ b/module/plugins/accounts/YibaishiwuCom.py
@@ -37,4 +37,4 @@ class YibaishiwuCom(Account):
"login[passwd]" : password})
if not 'var USER_PERMISSION = {' in html:
- self.fail()
+ self.login_fail()
diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py
index c7c958834..4138ba3cc 100644
--- a/module/plugins/accounts/ZeveraCom.py
+++ b/module/plugins/accounts/ZeveraCom.py
@@ -53,7 +53,7 @@ class ZeveraCom(Account):
self.password = password
if self.api_response(req) == "No trafic":
- self.fail()
+ self.login_fail()
def api_response(self, req, just_header=False, **kwargs):
diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py
index 8eea606a8..6ec5e89c8 100644
--- a/module/plugins/captcha/ReCaptcha.py
+++ b/module/plugins/captcha/ReCaptcha.py
@@ -48,7 +48,7 @@ class ReCaptcha(CaptchaService):
else:
return self.challenge(key,
- version=2 if re.search(self.KEY_V2_PATTERN, html or self.retrieve_data()) else 1)
+ version=2 if re.search(self.KEY_V2_PATTERN, data or self.retrieve_data()) else 1)
def _challenge_v1(self, key):
diff --git a/module/plugins/captcha/SolveMedia.py b/module/plugins/captcha/SolveMedia.py
index ae6751a70..870b5fc10 100644
--- a/module/plugins/captcha/SolveMedia.py
+++ b/module/plugins/captcha/SolveMedia.py
@@ -29,7 +29,7 @@ class SolveMedia(CaptchaService):
self.log_debug("Key: %s" % self.key)
return self.key
else:
- self.log_warning(_("Key pattern not found")
+ self.log_warning(_("Key pattern not found"))
return None
@@ -44,7 +44,7 @@ class SolveMedia(CaptchaService):
magic = re.search(r'name="magic" value="(.+?)"', html).group(1)
except AttributeError:
- self.log_warning(_("Magic pattern not found")
+ self.log_warning(_("Magic pattern not found"))
magic = None
try:
diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py
index c8fb1f3db..eb583b105 100644
--- a/module/plugins/hoster/BasePlugin.py
+++ b/module/plugins/hoster/BasePlugin.py
@@ -72,7 +72,7 @@ class BasePlugin(Hoster):
if server in servers:
self.log_debug("Logging on to %s" % server)
- self.req.addAuth(account.get_data(server)['password'])
+ self.req.addAuth(account.get_info(server)['login']['password'])
else:
pwd = self.get_password()
if ':' in pwd:
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 6cc42cb4b..ba6e253b0 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -187,7 +187,7 @@ class FileserveCom(Hoster):
#: Try api download
res = self.load("http://app.fileserve.com/api/download/premium/",
post={'username': self.user,
- 'password': self.account.get_data(self.user)['password'],
+ 'password': self.account.get_info(self.user)['login']['password'],
'shorten': self.file_id})
if res:
res = json_loads(res)
diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py
index 430562ce9..ed7c4bf7f 100644
--- a/module/plugins/hoster/FreeWayMe.py
+++ b/module/plugins/hoster/FreeWayMe.py
@@ -33,7 +33,7 @@ class FreeWayMe(MultiHoster):
get={'multiget': 7,
'url' : pyfile.url,
'user' : user,
- 'pw' : self.account.get_data(user)['password'],
+ 'pw' : self.account.get_info(self.user)['login']['password'],
'json' : ""},
just_header=True)
diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py
index 99185338f..25eb44604 100644
--- a/module/plugins/hoster/Ftp.py
+++ b/module/plugins/hoster/Ftp.py
@@ -43,7 +43,7 @@ class Ftp(Hoster):
if netloc in servers:
self.log_debug("Logging on to %s" % netloc)
- self.req.addAuth(self.account.get_data(netloc)['password'])
+ self.req.addAuth(self.account.get_info(netloc)['login']['password'])
else:
pwd = self.get_password()
if ':' in pwd:
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index b3aaa892e..e93b60460 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -124,7 +124,7 @@ class LetitbitNet(SimpleHoster):
def handle_premium(self, pyfile):
api_key = self.user
- premium_key = self.account.get_data(self.user)['password']
+ premium_key = self.account.get_info(self.user)['login']['password']
json_data = [api_key, ["download/direct_links", {'pass': premium_key, 'link': pyfile.url}]]
api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)})
diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py
index 817978542..9e5211148 100644
--- a/module/plugins/hoster/LinksnappyCom.py
+++ b/module/plugins/hoster/LinksnappyCom.py
@@ -30,7 +30,7 @@ class LinksnappyCom(MultiHoster):
json_params = json_dumps({'link' : pyfile.url,
'type' : host,
'username': self.user,
- 'password': self.account.get_data(self.user)['password']})
+ 'password': self.account.get_info(self.user)['login']['password']})
r = self.load("http://gen.linksnappy.com/genAPI.php",
post={'genLinks': json_params})
diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py
index f855cd5bf..bbd678ba0 100644
--- a/module/plugins/hoster/MyfastfileCom.py
+++ b/module/plugins/hoster/MyfastfileCom.py
@@ -27,7 +27,7 @@ class MyfastfileCom(MultiHoster):
def handle_premium(self, pyfile):
self.html = self.load('http://myfastfile.com/api.php',
- get={'user': self.user, 'pass': self.account.get_data(self.user)['password'],
+ get={'user': self.user, 'pass': self.account.get_info(self.user)['login']['password'],
'link': pyfile.url})
self.log_debug("JSON data: " + self.html)
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index c26b893bf..5b634806f 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -124,7 +124,7 @@ class ShareonlineBiz(SimpleHoster):
def handle_premium(self, pyfile): #: Should be working better loading (account) api internally
html = self.load("http://api.share-online.biz/account.php",
get={'username': self.user,
- 'password': self.account.get_data(self.user)['password'],
+ 'password': self.account.get_info(self.user)['login']['password'],
'act' : "download",
'lid' : self.info['fileid']})
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 3a3fd4768..f33d44179 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -4,6 +4,7 @@ from __future__ import with_statement
import random
import time
+import threading
import traceback
from module.plugins.internal.Plugin import Plugin
@@ -29,6 +30,7 @@ class Account(Plugin):
def __init__(self, manager, accounts):
self.pyload = manager.core
self.info = {} #: Provide information in dict here
+ self.lock = threading.RLock()
self.init()
self.init_accounts(accounts)
@@ -58,9 +60,7 @@ class Account(Plugin):
self.login(user, info['login']['password'], info['data'], self.req)
except Exception, e:
- self.log_warning(
- _("Could not login with account %(user)s | %(msg)s") % {'user': user,
- 'msg' : e})
+ self.log_warning(_("Could not login with username ") + user, e)
res = info['login']['valid'] = False
if self.pyload.debug:
traceback.print_exc()
@@ -86,13 +86,15 @@ class Account(Plugin):
return self._login(user)
+ #@TODO: Rewrite in 0.4.10
def init_accounts(self, accounts):
for user, data in accounts.iteritems():
self.add(user, data['password'], data['options'])
self._login(user)
- def add(self, user, password=None, options):
+ @lock
+ def add(self, user, password=None, options={}):
if user not in self.info:
self.info[user] = {'login': {'valid': True, 'password': password or "", 'timestamp': 0}, #@NOTE: Do not remove `'valid': True` in 0.4.9 or accounts will not login
'data' : {'options': options, 'timestamp': 0}}
@@ -102,7 +104,8 @@ class Account(Plugin):
self.log_error(_("Error adding account"), _("User already exists"))
- def update(self, user, password=None, options):
+ @lock
+ def update(self, user, password=None, options={}):
"""
Updates account and return true if anything changed
"""
@@ -131,7 +134,7 @@ class Account(Plugin):
self.info.clear()
elif user in self.info:
- del self.info[user]
+ self.info.pop(user, None)
#: Deprecated method, use `remove` instead (Remove in 0.4.10)
@@ -140,64 +143,88 @@ class Account(Plugin):
def get_data(self, user, reload=False):
- return self.get_info(user, reload)['data']
+ if not user:
+ return
+
+ info = self.get_info(user, reload)
+ if info and 'data' in info:
+ return info['data']
+
+ #: Deprecated method, use `get_data` instead (Remove in 0.4.10)
+ def getAccountData(self, *args, **kwargs):
+ if 'force' in kwargs:
+ kwargs['reload'] = kwargs['force']
+ kwargs.pop('force', None)
+ data = self.get_data(*args, **kwargs) or {}
+ if 'options' not in data:
+ data['options'] = {'limitdl': ['0']}
+ return data
@lock
def get_info(self, user, reload=False):
"""
Retrieve account infos for an user, do **not** overwrite this method!\\
- just use it to retrieve infos in hoster plugins. see `load_info`
+ just use it to retrieve infos in hoster plugins. see `parse_info`
:param user: username
:param reload: reloads cached account information
:return: dictionary with information
"""
- if not reload and user in self.info:
- info = self.info[user]
+ traceback.print_exc() ######################
- if info['data']['timestamp'] + self.INFO_THRESHOLD * 60 < time.time():
- self.log_debug("Reached timeout for account data")
- self.schedule_refresh(user)
+ if user not in self.info:
+ self.log_error(_("User %s not found while retrieving account info") % user)
+ return
- else:
+ elif reload:
self.log_debug("Get Account Info for: %s" % user)
- info = self.load_info(user)
+ info = self._parse_info(user)
- self.log_debug("Account Info: %s" % info)
+ else:
+ info = self.info[user]
+
+ if self.INFO_THRESHOLD > 0 and info['data']['timestamp'] + self.INFO_THRESHOLD * 60 < time.time():
+ self.log_debug("Reached data timeout for %s" % user)
+ self.schedule_refresh(user)
+
+ safe_info = info.copy()
+ safe_info['login']['password'] = "**********"
+ self.log_debug("Account info: %s" % safe_info)
return info
def is_premium(self, user):
- return self.get_info(user)['premium']
+ if not user:
+ return False
+ info = self.get_info(user, reload)
+ return info['premium'] if info and 'premium' in info else False
- def load_info(self, user):
- self.log_critical(user in self.info) #############################
+ def _parse_info(self, user):
info = self.info[user]
data = info['data']
#@TODO: Remove in 0.4.10
data.update({'login': user,
- 'type' : self.__name__},
- 'valid': self.info[user]['login']['valid'])
+ 'type' : self.__name__,
+ 'valid': self.info[user]['login']['valid']})
try:
+ data['timestamp'] = time.time() #: Set timestamp for login
+
self.req = self.get_request(user)
- extra_info = self.parse_info(user, info['login']['password'], info, req)
+ extra_info = self.parse_info(user, info['login']['password'], info, self.req)
if extra_info and isinstance(extra_info, dict):
data.update(extra_info)
- data['timestamp'] = time.time()
except Exception, e:
- self.log_warning(_("Error loading info for account %(user)s | %(err)s") %
- {'user': user, 'err': e})
- data['error'] = str(e)
+ self.log_warning(_("Error loading info for ") + user, e)
if self.pyload.debug:
- traceback.print_exc():
+ traceback.print_exc()
else:
for key in ('premium', 'validuntil', 'trafficleft', 'maxtraffic'):
@@ -227,7 +254,11 @@ class Account(Plugin):
#: Remove in 0.4.10
def getAllAccounts(self, *args, **kwargs):
- return [self.get_data(user, reload) for user, info in self.info.iteritems()]
+ return [self.getAccountData(user, *args, **kwargs) for user, info in self.info.iteritems()]
+
+
+ def login_fail(self, reason=_("Login handshake has failed")):
+ return self.fail(reason)
def get_request(self, user=None):
@@ -240,7 +271,6 @@ class Account(Plugin):
def get_cookies(self, user=None):
if not user:
user, info = self.select()
- return None
return self.pyload.requestFactory.getCookieJar(self.__name__, user)
@@ -316,17 +346,20 @@ class Account(Plugin):
"""
Add task to refresh account info to sheduler
"""
- self.log_debug("Scheduled Account refresh for %s in %s seconds." % (user, time))
+ self.log_debug("Scheduled refresh for %s in %s seconds" % (user, time))
self.pyload.scheduler.addJob(time, self.get_info, [user, reload])
#: Deprecated method, use `schedule_refresh` instead (Remove in 0.4.10)
def scheduleRefresh(self, *args, **kwargs):
+ if 'force' in kwargs:
+ kwargs['reload'] = kwargs['force']
+ kwargs.pop('force', None)
return self.schedule_refresh(*args, **kwargs)
@lock
- def check_login(self, user):
+ def is_logged(self, user):
"""
Checks if user is still logged in
"""
diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py
index 16aab6188..248518128 100644
--- a/module/plugins/internal/Addon.py
+++ b/module/plugins/internal/Addon.py
@@ -71,7 +71,7 @@ class Addon(Plugin):
self.event_map = None
if self.event_list:
- self.log_debug("Deprecated method `event_list`, use `event_map` instead") (Remove in 0.4.10)
+ self.log_debug("Deprecated method `event_list`, use `event_map` instead")
for f in self.event_list:
self.manager.addEvent(f, getattr(self, f))
diff --git a/module/plugins/internal/Captcha.py b/module/plugins/internal/Captcha.py
index 89cace612..ec618e353 100644
--- a/module/plugins/internal/Captcha.py
+++ b/module/plugins/internal/Captcha.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
+import os
import time
import traceback
@@ -27,10 +28,6 @@ class Captcha(Plugin):
self.init()
- def _log(self, level, args):
- return self.plugin._log(level, (self.__name__,) + args)
-
-
def init(self):
"""
Initialize additional data structures
diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py
index d3eef43c8..1a73ce5d1 100644
--- a/module/plugins/internal/CaptchaService.py
+++ b/module/plugins/internal/CaptchaService.py
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
-from module.plugins.internal.Plugin import Plugin
+from module.plugins.internal.Captcha import Captcha
-class CaptchaService(Plugin):
+class CaptchaService(Captcha):
__name__ = "CaptchaService"
__type__ = "captcha"
__version__ = "0.31"
@@ -18,6 +18,10 @@ class CaptchaService(Plugin):
self.key = None #: Last key detected
+ def _log(self, level, args):
+ return self.plugin._log(level, (self.__name__,) + args)
+
+
#@TODO: Recheck in 0.4.10
def retrieve_key(self, data):
if self.detect_key(data):
diff --git a/module/plugins/internal/Container.py b/module/plugins/internal/Container.py
index c0135fb1f..c7a6828c7 100644
--- a/module/plugins/internal/Container.py
+++ b/module/plugins/internal/Container.py
@@ -56,8 +56,9 @@ class Container(Crypter):
try:
with open(self.pyfile.url, "wb") as f:
f.write(content)
+
except IOError, e:
- self.fail(str(e))
+ self.fail(str(e)) #@TODO: Remove `str` in 0.4.10
else:
self.pyfile.name = os.path.basename(self.pyfile.url)
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 1d2728bd3..840d73847 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -171,7 +171,7 @@ class Hoster(Plugin):
self.req.renewHTTPRequest()
if self.account:
- self.account.check_login(self.user)
+ self.account.is_logged(self.user)
else:
self.req.clearCookies()
@@ -206,7 +206,10 @@ class Hoster(Plugin):
def set_reconnect(self, reconnect):
reconnect = bool(reconnect)
- self.log_debug("Set wantReconnect to: %s (previous: %s)" % (reconnect, self.wantReconnect))
+
+ self.log_info(_("Reconnect: %s") % reconnect)
+ self.log_debug("Previous wantReconnect: %s" % self.wantReconnect)
+
self.wantReconnect = reconnect
@@ -220,8 +223,8 @@ class Hoster(Plugin):
wait_time = max(int(seconds), 1)
wait_until = time.time() + wait_time + 1
- self.log_debug("Set waitUntil to: %f (previous: %f)" % (wait_until, self.pyfile.waitUntil),
- "Wait: %d (+1) seconds" % wait_time)
+ self.log_info(_("Wait: %d seconds") % wait_time)
+ self.log_debug("Previous waitUntil: %f" % self.pyfile.waitUntil)
self.pyfile.waitUntil = wait_until
@@ -229,13 +232,13 @@ class Hoster(Plugin):
self.set_reconnect(reconnect)
- def wait(self, seconds=0, reconnect=None):
+ def wait(self, seconds=None, reconnect=None):
"""
Waits the time previously set
"""
pyfile = self.pyfile
- if seconds > 0:
+ if seconds is not None:
self.set_wait(seconds)
if reconnect is not None:
@@ -243,12 +246,9 @@ class Hoster(Plugin):
self.waiting = True
- status = pyfile.status
+ status = pyfile.status #@NOTE: Remove in 0.4.10
pyfile.setStatus("waiting")
- self.log_info(_("Wait: %d seconds") % (pyfile.waitUntil - time.time()),
- _("Reconnect: %s") % self.wantReconnect)
-
if self.account:
self.log_debug("Ignore reconnection due account logged")
@@ -256,11 +256,9 @@ class Hoster(Plugin):
if pyfile.abort:
self.abort()
- time.sleep(1)
+ time.sleep(3)
else:
while pyfile.waitUntil > time.time():
- self.thread.m.reconnecting.wait(1)
-
if pyfile.abort:
self.abort()
@@ -268,12 +266,12 @@ class Hoster(Plugin):
self.waiting = False
self.wantReconnect = False
raise Reconnect
-
- time.sleep(1)
+
+ self.thread.m.reconnecting.wait(3)
+ time.sleep(3)
self.waiting = False
-
- pyfile.status = status
+ pyfile.status = status #@NOTE: Remove in 0.4.10
def skip(self, reason=""):
@@ -388,7 +386,7 @@ class Hoster(Plugin):
os.chown(location, uid, gid)
except Exception, e:
- self.fail(e)
+ self.fail(str(e)) #@TODO: Remove `str` in 0.4.10
#: Convert back to unicode
location = fs_decode(location)
@@ -508,7 +506,7 @@ class Hoster(Plugin):
redirect = max(follow_location, 1)
else:
- redirect = self.get_config("maxredirs", plugin="UserAgentSwitcher")
+ redirect = self.get_config("maxredirs", 10, "UserAgentSwitcher")
for i in xrange(redirect):
try:
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 9ac89501c..02ef326d6 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -5,6 +5,7 @@ from __future__ import with_statement
import inspect
import os
import re
+import traceback
import urllib
from module.plugins.Plugin import Abort, Fail, Reconnect, Retry, SkipDownload as Skip #@TODO: Remove in 0.4.10
@@ -80,12 +81,12 @@ def parse_html_form(attr_str, html, input_names={}):
for form in re.finditer(r"(?P<TAG><form[^>]*%s[^>]*>)(?P<CONTENT>.*?)</?(form|body|html)[^>]*>" % attr_str,
html, re.S | re.I):
inputs = {}
- action = parseHtmlTagAttrValue("action", form.group('TAG'))
+ action = parse_html_tag_attr_value("action", form.group('TAG'))
for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('CONTENT'), re.S | re.I):
- name = parseHtmlTagAttrValue("name", inputtag.group(1))
+ name = parse_html_tag_attr_value("name", inputtag.group(1))
if name:
- value = parseHtmlTagAttrValue("value", inputtag.group(1))
+ value = parse_html_tag_attr_value("value", inputtag.group(1))
if not value:
inputs[name] = inputtag.group(3) or ""
else:
@@ -155,9 +156,10 @@ class Plugin(object):
def _log(self, level, args):
log = getattr(self.pyload.log, level)
msg = encode(" | ".join((a if isinstance(a, basestring) else str(a)).strip() for a in args if a)) #@NOTE: `fs_encode` -> `encode` in 0.4.10
- log("%(plugin)s%(id)s: %(msg)s" % {'plugin': self.__name__,
- 'id' : ("[%s]" % self.pyfile.id) if hasattr(self, 'pyfile') else "",
- 'msg' : msg or _(level.upper() + " MARK")})
+ log("%(type)s %(plugin)s%(id)s: %(msg)s" % {'type': self.__type__.upper(),
+ 'plugin': self.__name__,
+ 'id' : ("[%s]" % self.pyfile.id) if hasattr(self, 'pyfile') else "",
+ 'msg' : msg or _(level.upper() + " MARK")})
def log_debug(self, *args):
@@ -204,6 +206,7 @@ class Plugin(object):
except KeyError:
self.log_warning(_("Config option or plugin not found"))
+ traceback.print_exc()
return default
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index 4a293b703..8eea9dd5a 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -13,7 +13,7 @@ from module.PyFile import statusMap as _statusMap
from module.network.HTTPRequest import BadHeader
from module.network.RequestFactory import getURL as get_url
from module.plugins.internal.Hoster import Hoster, create_getInfo, parse_fileInfo
-from module.plugins.internal.Plugin import Fail, Retry, fixurl, replace_patterns, set_cookies
+from module.plugins.internal.Plugin import Fail, Retry, fixurl, replace_patterns, seconds_to_midnight, set_cookies
from module.utils import fixup, fs_encode, parseFileSize as parse_size
@@ -115,7 +115,7 @@ class SimpleHoster(Hoster):
@classmethod
def api_info(cls, url):
- return super(SimpleHoster, self).get_info(url)
+ return super(SimpleHoster, cls).get_info(url)
@classmethod