diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-07-17 03:03:26 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-07-17 03:03:26 +0200 |
commit | d2e2b127651a5a44b56337eb6d9ca246c97a208a (patch) | |
tree | 46f34e2102fd44ed2f719727eb07a445e7baa77d /module | |
parent | No camelCase style anymore (diff) | |
download | pyload-d2e2b127651a5a44b56337eb6d9ca246c97a208a.tar.xz |
Spare fixes and code cosmetics
Diffstat (limited to 'module')
105 files changed, 434 insertions, 260 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index eb58da928..f73c3e0fd 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -39,7 +39,10 @@ class AlldebridCom(Account): except Exception: data = self.get_account_data(user) html = self.load("https://www.alldebrid.com/api.php", - get={'action': "info_user", 'login': user, 'pw': data['password']}, req=req) + get={'action': "info_user", + 'login' : user, + 'pw' : data['password']}, + req=req) self.log_debug(html) @@ -53,9 +56,10 @@ class AlldebridCom(Account): def login(self, user, data, req): html = self.load("https://www.alldebrid.com/register/", - get={'action' : "login", - 'login_login' : user, - 'login_password': data['password']}, req=req) + get={'action' : "login", + 'login_login' : user, + 'login_password': data['password']}, + req=req) if "This login doesn't exist" in html \ or "The password is not valid" in html \ diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 912b58173..e71812891 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -27,7 +27,10 @@ class BitshareCom(Account): def login(self, user, data, req): html = self.load("https://bitshare.com/login.html", - post={"user": user, "password": data['password'], "submit": "Login"}, req=req) + post={"user" : user, + "password": data['password'], + "submit" : "Login"}, + req=req) if "login" in req.lastEffectiveURL: self.wrong_password() diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index 8eb422962..1a7355095 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -51,10 +51,11 @@ class CatShareNet(Account): def login(self, user, data, req): html = self.load("http://catshare.net/login", #@TODO: Revert to `https` in 0.4.10 - post={'user_email': user, - 'user_password': data['password'], - 'remindPassword': 0, - 'user[submit]': "Login"}, req=req) + post={'user_email' : user, + 'user_password' : data['password'], + 'remindPassword': 0, + 'user[submit]' : "Login"}, + req=req) if not '<a href="/logout">Wyloguj</a>' in html: self.wrong_password() diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py index 5716c8d94..2677a5b55 100644 --- a/module/plugins/accounts/CloudzillaTo.py +++ b/module/plugins/accounts/CloudzillaTo.py @@ -28,9 +28,10 @@ class CloudzillaTo(Account): def login(self, user, data, req): html = self.load("https://www.cloudzilla.to/", - post={'lusername': user, - 'lpassword': data['password'], - 'w' : "dologin"}, req=req) + post={'lusername': user, + 'lpassword': data['password'], + 'w' : "dologin"}, + req=req) if "ERROR" in html: self.wrong_password() diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index f86264cf5..6212ffafd 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -45,9 +45,10 @@ class CzshareCom(Account): def login(self, user, data, req): html = self.load('https://sdilej.cz/index.php', - post={"Prihlasit": "Prihlasit", - "login-password": data['password'], - "login-name": user}, req=req) + post={"Prihlasit" : "Prihlasit", + "login-password": data['password'], + "login-name" : user}, + req=req) if '<div class="login' in html: self.wrong_password() diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 16101d177..0fde5c6ca 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -37,7 +37,9 @@ class DebridItaliaCom(Account): def login(self, user, data, req): html = self.load("https://debriditalia.com/login.php", - get={'u': user, 'p': data['password']}, req=req) + get={'u': user, + 'p': data['password']}, + req=req) if 'NO' in html: self.wrong_password() diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 24cbad486..ce2dc1923 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -28,8 +28,11 @@ class DepositfilesCom(Account): def login(self, user, data, req): - html = self.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, - post={"login": user, "password": data['password']}, req=req) + html = self.load("https://dfiles.eu/de/login.php", + get={"return": "/de/gold/payment.php"}, + post={"login" : user, + "password": data['password']}, + req=req) if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in html: self.wrong_password() diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index ffe30d02f..5d909b789 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -33,9 +33,10 @@ class EuroshareEu(Account): def login(self, user, data, req): html = self.load('http://euroshare.eu/customer-zone/login/', - post={"trvale": "1", - "login": user, - "password": data['password']}, req=req) + post={"trvale" : "1", + "login" : user, + "password": data['password']}, + req=req) if u">Nesprávne prihlasovacie meno alebo heslo" in html: self.wrong_password() diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index eaf12619a..d8c992bb3 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -16,7 +16,10 @@ class FastixRu(Account): def load_account_info(self, user, req): data = self.get_account_data(user) - html = json_loads(self.load("http://fastix.ru/api_v2/", get={'apikey': data['api'], 'sub': "getaccountdetails"}), req=req) + html = json_loads(self.load("http://fastix.ru/api_v2/", + get={'apikey': data['api'], + 'sub' : "getaccountdetails"}), + req=req) points = html['points'] kb = float(points) * 1024 ** 2 / 1000 @@ -30,7 +33,10 @@ class FastixRu(Account): def login(self, user, data, req): html = self.load("https://fastix.ru/api_v2/", - get={'sub': "get_apikey", 'email': user, 'password': data['password']}, req=req) + get={'sub' : "get_apikey", + 'email' : user, + 'password': data['password']}, + req=req) api = json_loads(html) api = api['apikey'] diff --git a/module/plugins/accounts/FastshareCz.py b/module/plugins/accounts/FastshareCz.py index be3a91a16..e3c8235d6 100644 --- a/module/plugins/accounts/FastshareCz.py +++ b/module/plugins/accounts/FastshareCz.py @@ -40,10 +40,12 @@ class FastshareCz(Account): def login(self, user, data, req): req.cj.setCookie("fastshare.cz", "lang", "en") - self.load('http://www.fastshare.cz/login', req=req) #: Do not remove or it will not login + self.load('http://www.fastshare.cz/login', req=req) #@NOTE: Do not remove or it will not login html = self.load("https://www.fastshare.cz/sql.php", - post={'login': user, 'heslo': data['password']}, req=req) + post={'login': user, + 'heslo': data['password']}, + req=req) if ">Wrong username or password" in html: self.wrong_password() diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 3c3f79ed8..512a7b67d 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -32,7 +32,8 @@ class FilecloudIo(Account): akey = rep['akey'] self.accounts[user]['akey'] = akey #: Saved for hoster plugin rep = self.load("http://api.filecloud.io/api-fetch_account_details.api", - post={"akey": akey}, req=req) + post={"akey": akey}, + req=req) rep = json_loads(rep) if rep['is_premium'] == 1: diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index a950217f4..561e56915 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -40,9 +40,10 @@ class FilefactoryCom(Account): req.http.c.setopt(pycurl.REFERER, "http://www.filefactory.com/member/login.php") html = self.load("https://www.filefactory.com/member/signin.php", - post={"loginEmail" : user, - "loginPassword": data['password'], - "Submit" : "Sign In"}, req=req) + post={"loginEmail" : user, + "loginPassword": data['password'], + "Submit" : "Sign In"}, + req=req) if req.lastEffectiveURL != "http://www.filefactory.com/account/": self.wrong_password() diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index 5b4092681..f5ee5889a 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -2,6 +2,7 @@ import re import time +import urlparse from module.plugins.internal.Account import Account @@ -37,13 +38,14 @@ class FilejungleCom(Account): def login(self, user, data, req): - html = self.load(self.URL + "login.php", - post={"loginUserName": user, - "loginUserPassword": data['password'], - "loginFormSubmit": "Login", - "recaptcha_challenge_field": "", - "recaptcha_response_field": "", - "recaptcha_shortencode_field": ""}, req=req) + html = self.load(urlparse.urljoin(self.URL, "login.php"), + post={"loginUserName" : user, + "loginUserPassword" : data['password'], + "loginFormSubmit" : "Login", + "recaptcha_challenge_field" : "", + "recaptcha_response_field" : "", + "recaptcha_shortencode_field": ""}, + req=req) if re.search(self.LOGIN_FAILED_PATTERN, html): self.wrong_password() diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index acee71912..192905ebe 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -48,11 +48,12 @@ class FilerNet(Account): token = re.search(self.TOKEN_PATTERN, html).group(1) html = self.load("https://filer.net/login_check", - post={"_username" : user, - "_password" : data['password'], - "_remember_me": "on", - "_csrf_token" : token, - "_target_path": "https://filer.net/"}, req=req) + post={"_username" : user, + "_password" : data['password'], + "_remember_me": "on", + "_csrf_token" : token, + "_target_path": "https://filer.net/"}, + req=req) if 'Logout' not in html: self.wrong_password() diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index c8490bf2f..a8a2a3b46 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -21,10 +21,11 @@ class FilesMailRu(Account): user, domain = user.split("@") html = self.load("https://swa.mail.ru/cgi-bin/auth", - post={"Domain": domain, - "Login": user, - "Password": data['password'], - "Page": "http://files.mail.ru/"}, req=req) + post={"Domain" : domain, + "Login" : user, + "Password": data['password'], + "Page" : "http://files.mail.ru/"}, + req=req) if "ÐевеÑМПе ÐžÐŒÑ Ð¿ÐŸÐ»ÑзПваÑÐµÐ»Ñ ÐžÐ»Ðž паÑПлÑ" in html: self.wrong_password() diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 5c6c15167..a5c1b333b 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -19,8 +19,11 @@ class FileserveCom(Account): def load_account_info(self, user, req): data = self.get_account_data(user) - html = self.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], - "submit": "Submit+Query"}, req=req) + html = self.load("http://app.fileserve.com/api/login/", + post={"username": user, + "password": data['password'], + "submit": "Submit+Query"}, + req=req) res = json_loads(html) if res['type'] == "premium": @@ -31,8 +34,11 @@ class FileserveCom(Account): def login(self, user, data, req): - html = self.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], - "submit": "Submit+Query"}, req=req) + html = self.load("http://app.fileserve.com/api/login/", + post={"username": user, + "password": data['password'], + "submit" : "Submit+Query"}, + req=req) res = json_loads(html) if not res['type']: @@ -40,5 +46,8 @@ class FileserveCom(Account): # login at fileserv html self.load("http://www.fileserve.com/login.php", - post={"loginUserName": user, "loginUserPassword": data['password'], "autoLogin": "checked", - "loginFormSubmit": "Login"}, req=req) + post={"loginUserName": user, + "loginUserPassword": data['password'], + "autoLogin": "checked", + "loginFormSubmit": "Login"}, + req=req) diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index 9471e49ca..25a4b19b8 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -23,11 +23,12 @@ class FourSharedCom(Account): req.cj.setCookie("4shared.com", "4langcookie", "en") res = self.load("https://www.4shared.com/web/login", - post={'login' : user, - 'password' : data['password'], - 'remember' : "on", - '_remember': "on", - 'returnTo' : "http://www.4shared.com/account/home.jsp"}, req=req) + post={'login' : user, + 'password' : data['password'], + 'remember' : "on", + '_remember': "on", + 'returnTo' : "http://www.4shared.com/account/home.jsp"}, + req=req) if 'Please log in to access your 4shared account' in res: self.wrong_password() diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index 7548338f4..c19ea7177 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -44,7 +44,10 @@ class FreakshareCom(Account): self.load("http://freakshare.com/index.php?language=EN", req=req) html = self.load("https://freakshare.com/login.html", - post={"submit": "Login", "user": user, "pass": data['password']}, req=req) + post={"submit": "Login", + "user" : user, + "pass" : data['password']}, + req=req) if ">Wrong Username or Password" in html: self.wrong_password() diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 3149d6548..f0891af9e 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -46,11 +46,11 @@ class FshareVn(Account): def login(self, user, data, req): html = self.load("https://www.fshare.vn/login.php", - post={'LoginForm[email]' : user, - 'LoginForm[password]' : data['password'], - 'LoginForm[rememberMe]': 1, - 'yt0' : "Login"}, - referer=True, req=req) + post={'LoginForm[email]' : user, + 'LoginForm[password]' : data['password'], + 'LoginForm[rememberMe]': 1, + 'yt0' : "Login"}, + req=req) if not re.search(r'<img\s+alt="VIP"', html): self.wrong_password() diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 76a9597ee..3a30f4d5a 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -68,11 +68,13 @@ class HellshareCz(Account): self.log_debug("Already logged in") return - html = self.load('https://www.hellshare.com/login?do=loginForm-submit', - post={"login": "Log in", - "password": data['password'], - "username": user, - "perm_login": "on"}, req=req) + html = self.load("https://www.hellshare.com/login", + get={'do': "loginForm-submit"}, + post={'login' : "Log in", + 'password' : data['password'], + 'username' : user, + 'perm_login': "on"}, + req=req) if "<p>You input a wrong user name or wrong password</p>" in html: self.wrong_password() diff --git a/module/plugins/accounts/HighWayMe.py b/module/plugins/accounts/HighWayMe.py index f6baaa0a1..8be933c37 100644 --- a/module/plugins/accounts/HighWayMe.py +++ b/module/plugins/accounts/HighWayMe.py @@ -41,7 +41,10 @@ class HighWayMe(Account): def login(self, user, data, req): html = self.load("https://high-way.me/api.php?login", - post={'login': '1', 'user': user, 'pass': data['password']}, req=req) + post={'login': '1', + 'user': user, + 'pass': data['password']}, + req=req) if 'UserOrPassInvalid' in html: self.wrong_password() diff --git a/module/plugins/accounts/Keep2ShareCc.py b/module/plugins/accounts/Keep2ShareCc.py index 71c099bea..5c6b3cce8 100644 --- a/module/plugins/accounts/Keep2ShareCc.py +++ b/module/plugins/accounts/Keep2ShareCc.py @@ -63,10 +63,11 @@ class Keep2ShareCc(Account): req.cj.setCookie("keep2share.cc", "lang", "en") html = self.load("https://keep2share.cc/login.html", - post={'LoginForm[username]' : user, - 'LoginForm[password]' : data['password'], - 'LoginForm[rememberMe]': 1, - 'yt0' : ""}, req=req) + post={'LoginForm[username]' : user, + 'LoginForm[password]' : data['password'], + 'LoginForm[rememberMe]': 1, + 'yt0' : ""}, + req=req) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrong_password() diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index 6b8fcf960..a26e895c4 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -18,7 +18,9 @@ class LetitbitNet(Account): ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## # api_key = self.get_account_data(user)['password'] # json_data = [api_key, ['key/info']] - # api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}, req=req) + # api_rep = self.load("http://api.letitbit.net/json", + # post={'r': json_dumps(json_data)}, + # req=req) # self.log_debug("API Key Info: " + api_rep) # api_rep = json_loads(api_rep) # diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 466495ac0..aa7db79e0 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -19,7 +19,10 @@ class LinksnappyCom(Account): def load_account_info(self, user, req): data = self.get_account_data(user) r = self.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': hashlib.md5(data['password'], req=req).hexdigest()}) + get={'act' : 'USERDETAILS', + 'username': user, + 'password': hashlib.md5(data['password'], + req=req).hexdigest()}) self.log_debug("JSON data: " + r) @@ -51,9 +54,10 @@ class LinksnappyCom(Account): def login(self, user, data, req): html = self.load("https://gen.linksnappy.com/lseAPI.php", - get={'act' : 'USERDETAILS', - 'username': user, - 'password': hashlib.md5(data['password'], req=req).hexdigest()}) + get={'act' : 'USERDETAILS', + 'username': user, + 'password': hashlib.md5(data['password'], + req=req).hexdigest()}) if "Invalid Account Details" in html: self.wrong_password() diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index 7a6e36f05..817dd800f 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -21,7 +21,10 @@ class MegaDebridEu(Account): def load_account_info(self, user, req): data = self.get_account_data(user) jsonResponse = self.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data['password']}, req=req) + get={'action' : 'connectUser', + 'login' : user, + 'password': data['password']}, + req=req) res = json_loads(jsonResponse) if res['response_code'] == "ok": @@ -33,7 +36,10 @@ class MegaDebridEu(Account): def login(self, user, data, req): jsonResponse = self.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data['password']}, req=req) + get={'action' : 'connectUser', + 'login' : user, + 'password': data['password']}, + req=req) res = json_loads(jsonResponse) if res['response_code'] != "ok": self.wrong_password() diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index c8650ed8e..d2f6cfaf7 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -53,8 +53,9 @@ class MegaRapidCz(Account): html = html[start + 33:] hashes = html[0:32] html = self.load("https://megarapid.cz/prihlaseni/", - post={"hash": hashes, - "login": user, - "pass1": data['password'], - "remember": 0, - "sbmt": u"PÅihlásit"}, req=req) + post={"hash" : hashes, + "login" : user, + "pass1" : data['password'], + "remember": 1, + "sbmt" : u"PÅihlásit"}, + req=req) diff --git a/module/plugins/accounts/MegaRapidoNet.py b/module/plugins/accounts/MegaRapidoNet.py index ddb7e090a..aa92f957a 100644 --- a/module/plugins/accounts/MegaRapidoNet.py +++ b/module/plugins/accounts/MegaRapidoNet.py @@ -42,7 +42,9 @@ class MegaRapidoNet(Account): def login(self, user, data, req): self.load("http://megarapido.net/login", req=req) self.load("http://megarapido.net/painel_user/ajax/logar.php", - post={'login': user, 'senha': data['password']}, req=req) + post={'login': user, + 'senha': data['password']}, + req=req) html = self.load("http://megarapido.net/gerador", req=req) diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index 3aa26692c..d68002783 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -38,10 +38,11 @@ class MegasharesCom(Account): def login(self, user, data, req): html = self.load('http://d01.megashares.com/myms_login.php', - post={"httpref" : "", - "myms_login" : "Login", - "mymslogin_name": user, - "mymspassword" : data['password']}, req=req) + post={"httpref" : "", + "myms_login" : "Login", + "mymslogin_name": user, + "mymspassword" : data['password']}, + req=req) if not '<span class="b ml">%s</span>' % user in html: self.wrong_password() diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index ddb605ac7..7052f2d7a 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -35,9 +35,10 @@ class MultishareCz(Account): def login(self, user, data, req): html = self.load('https://www.multishare.cz/html/prihlaseni_process.php', - post={"akce" : "PÅihlásit", - "heslo": data['password'], - "jmeno": user}, req=req) + post={"akce" : "PÅihlásit", + "heslo": data['password'], + "jmeno": user}, + req=req) if '<div class="akce-chyba akce">' in html: self.wrong_password() diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index aa2dde191..4e644dace 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -27,7 +27,9 @@ class MyfastfileCom(Account): def login(self, user, data, req): #: Password to use is the API-Password written in http://myfastfile.com/myaccount html = self.load("https://myfastfile.com/api.php", - get={"user": user, "pass": data['password']}, req=req) + get={"user": user, + "pass": data['password']}, + req=req) self.log_debug("JSON data: " + html) diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py index c17f0b8b4..f5845a0dd 100644 --- a/module/plugins/accounts/NitroflareCom.py +++ b/module/plugins/accounts/NitroflareCom.py @@ -29,7 +29,8 @@ class NitroflareCom(Account): premium = False html = self.load("https://nitroflare.com/member", - get={'s': "premium"}, req=req) + get={'s': "premium"}, + req=req) m = re.search(self.VALID_UNTIL_PATTERN, html) if m: @@ -72,10 +73,11 @@ class NitroflareCom(Account): token = re.search(self.TOKEN_PATTERN, html).group(1) html = self.load("https://nitroflare.com/login", - post={'login' : "", - 'email' : user, - 'password': data['password'], - 'token' : token}, req=req) + post={'login' : "", + 'email' : user, + 'password': data['password'], + 'token' : token}, + req=req) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrong_password() diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 6f82f3c97..6b7ac6d81 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -78,4 +78,6 @@ class NoPremiumPl(Account): def run_auth_query(self): - return self._self.load(self.API_URL, post=self.create_auth_query(), req=req) + return self.load(self.API_URL, + post=self.create_auth_query(), + req=req) diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index e679367d6..6f6093dbb 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -49,7 +49,9 @@ class NowVideoSx(Account): def login(self, user, data, req): html = self.load("http://www.nowvideo.sx/login.php", - post={'user': user, 'pass': data['password']}, req=req) + post={'user': user, + 'pass': data['password']}, + req=req) if re.search(r'>Log In<', html): self.wrong_password() diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 958613e9e..2ec5ea53e 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -35,7 +35,10 @@ class OboomCom(Account): salt = passwd[::-1] pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) - result = json_loads(self.load("https://www.oboom.com/1/login", get={"auth": user, "pass": pbkdf2}), req=req) + result = json_loads(self.load("https://www.oboom.com/1/login", + get={"auth": user, + "pass": pbkdf2}), + req=req) if not result[0] == 200: self.log_warning(_("Failed to log in: %s") % result[1]) diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index 12be92c3e..62ff3e099 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -47,11 +47,12 @@ class OneFichierCom(Account): req.http.c.setopt(pycurl.REFERER, "https://1fichier.com/login.pl?lg=en") html = self.load("https://1fichier.com/login.pl?lg=en", - post={'mail' : user, - 'pass' : data['password'], - 'It' : "on", - 'purge' : "off", - 'valider': "Send"}, req=req) + post={'mail' : user, + 'pass' : data['password'], + 'It' : "on", + 'purge' : "off", + 'valider': "Send"}, + req=req) if '>Invalid email address' in html or '>Invalid password' in html: self.wrong_password() diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index d47a579f2..22f2f4d9f 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -17,8 +17,9 @@ class OverLoadMe(Account): def load_account_info(self, user, req): data = self.get_account_data(user) html = self.load("https://api.over-load.me/account.php", - get={'user': user, - 'auth': data['password']}, req=req).strip() + get={'user': user, + 'auth': data['password']}, + req=req).strip() data = json_loads(html) self.log_debug(data) @@ -32,8 +33,9 @@ class OverLoadMe(Account): def login(self, user, data, req): jsondata = self.load("https://api.over-load.me/account.php", - get={'user': user, - 'auth': data['password']}, req=req).strip() + get={'user': user, + 'auth': data['password']}, + req=req).strip() data = json_loads(jsondata) diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index 639ea1529..af51f8f16 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -17,7 +17,9 @@ class PremiumTo(Account): def load_account_info(self, user, req): traffic = self.load("http://premium.to/api/straffic.php", #@TODO: Revert to `https` in 0.4.10 - get={'username': self.username, 'password': self.password}, req=req) + get={'username': self.username, + 'password': self.password}, + req=req) if "wrong username" not in traffic: trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 @@ -30,7 +32,9 @@ class PremiumTo(Account): self.username = user self.password = data['password'] authcode = self.load("http://premium.to/api/getauthcode.php", #@TODO: Revert to `https` in 0.4.10 - get={'username': user, 'password': self.password}, req=req) + get={'username': user, + 'password': self.password}, + req=req) if "wrong username" in authcode: self.wrong_password() diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 17d3bfce8..07eae058f 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -34,9 +34,10 @@ class QuickshareCz(Account): def login(self, user, data, req): html = self.load('http://www.quickshare.cz/html/prihlaseni_process.php', - post={"akce": u'PÅihlásit', - "heslo": data['password'], - "jmeno": user}, req=req) + post={"akce" : u'PÅihlásit', + "heslo": data['password'], + "jmeno": user}, + req=req) if u'>TakovÃœ uÅŸivatel neexistuje.<' in html or u'>Å patné heslo.<' in html: self.wrong_password() diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 1f4140846..173b29308 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -78,4 +78,6 @@ class RapideoPl(Account): def run_auth_query(self): - return self._self.load(self.API_URL, post=self.create_auth_query(), req=req) + return self.load(self.API_URL, + post=self.create_auth_query(), + req=req) diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index c17765e12..098122aea 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +import urlparse + from module.plugins.internal.Account import Account from module.common.json_layer import json_loads @@ -27,7 +29,9 @@ class RapidgatorNet(Account): sid = self.get_account_data(user).get('sid', None) assert sid - html = self.load("%s/info" % self.API_URL, get={'sid': sid}, req=req) + html = self.load(urlparse.urljoin(self.API_URL, "info"), + get={'sid': sid}, + req=req) self.log_debug("API:USERINFO", html) @@ -54,7 +58,10 @@ class RapidgatorNet(Account): def login(self, user, data, req): try: - html = self.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}, req=req) + html = self.load(urlparse.urljoin(self.API_URL, "login"), + post={"username": user, + "password": data['password']}, + req=req) self.log_debug("API:LOGIN", html) diff --git a/module/plugins/accounts/RapiduNet.py b/module/plugins/accounts/RapiduNet.py index 256b612a1..6edd83592 100644 --- a/module/plugins/accounts/RapiduNet.py +++ b/module/plugins/accounts/RapiduNet.py @@ -48,16 +48,18 @@ class RapiduNet(Account): def login(self, user, data, req): self.load("https://rapidu.net/ajax.php", - get={'a': "getChangeLang"}, - post={'_go' : "", - 'lang': "en"}, req=req) + get={'a': "getChangeLang"}, + post={'_go' : "", + 'lang': "en"}, + req=req) json = json_loads(self.load("https://rapidu.net/ajax.php", - get={'a': "getUserLogin"}, - post={'_go' : "", - 'login' : user, - 'pass' : data['password'], - 'remember': "1"}, req=req)) + get={'a': "getUserLogin"}, + post={'_go' : "", + 'login' : user, + 'pass' : data['password'], + 'remember': "1"}, + req=req)) self.log_debug(json) diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index f16ebed27..1df84a7b0 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -33,7 +33,9 @@ class RealdebridCom(Account): self.pin_code = False html = self.load("https://real-debrid.com/ajax/login.php", - get={"user": user, "pass": data['password']}, req=req) + get={"user": user, + "pass": data['password']}, + req=req) if "Your login informations are incorrect" in html: self.wrong_password() diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 43c0cb029..deaf55340 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -26,7 +26,9 @@ class RehostTo(Account): session = html.split(",")[1].split("=")[1] html = self.load("http://rehost.to/api.php", - get={'cmd': "get_premium_credits", 'long_ses': session}, req=req) + get={'cmd' : "get_premium_credits", + 'long_ses': session}, + req=req) if html.strip() == "0,0" or "ERROR" in html: self.log_debug(html) @@ -46,7 +48,10 @@ class RehostTo(Account): def login(self, user, data, req): html = self.load("https://rehost.to/api.php", - get={'cmd': "login", 'user': user, 'pass': data['password']}, req=req) + get={'cmd': "login", + 'user': user, + 'pass': data['password']}, + req=req) if "ERROR" in html: self.log_debug(html) diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index e030a7dd8..c9c6e2227 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -41,7 +41,8 @@ class SimplyPremiumCom(Account): req.cj.setCookie("simply-premium.com", "lang", "EN") html = self.load("https://www.simply-premium.com/login.php", - post={'key': user} if not data['password'] else {'login_name': user, 'login_pass': data['password']}, req=req) + post={'key': user} if not data['password'] else {'login_name': user, 'login_pass': data['password']}, + req=req) if 'logout' not in html: self.wrong_password() diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 853963c4a..a13bd14a8 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -75,4 +75,6 @@ class SmoozedCom(Account): encrypted = PBKDF2(password, salt, iterations=1000).hexread(32) return json_loads(self.load("http://www2.smoozed.com/api/login", - get={'auth': user, 'password': encrypted}, req=req)) + get={'auth': user, + 'password': encrypted}, + req=req)) diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index 518ed66f8..18b6a658d 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -34,9 +34,10 @@ class TurbobitNet(Account): req.cj.setCookie("turbobit.net", "user_lang", "en") html = self.load("http://turbobit.net/user/login", - post={"user[login]": user, - "user[pass]": data['password'], - "user[submit]": "Login"}, req=req) + post={"user[login]" : user, + "user[pass]" : data['password'], + "user[submit]": "Login"}, + req=req) if not '<div class="menu-item user-name">' in html: self.wrong_password() diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index e83124b81..b18428887 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -36,13 +36,14 @@ class UlozTo(Account): action = re.findall('<form action="(.+?)"', login_page)[1].replace('&', '&') token = re.search('_token_" value="(.+?)"', login_page).group(1) - html = self.load(urlparse.urljoin("https://www.ulozto.net/", action, req=req), - post={'_token_' : token, - 'do' : "loginForm-submit", - 'login' : u"PÅihlásit", - 'password': data['password'], - 'username': user, - 'remember': "on"}) + html = self.load(urlparse.urljoin("https://www.ulozto.net/", action), + post={'_token_' : token, + 'do' : "loginForm-submit", + 'login' : u"PÅihlásit", + 'password': data['password'], + 'username': user, + 'remember': "on"}, + req=req) if '<div class="flash error">' in html: self.wrong_password() diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py index e196620af..0fce8eeac 100644 --- a/module/plugins/accounts/UploadableCh.py +++ b/module/plugins/accounts/UploadableCh.py @@ -24,10 +24,11 @@ class UploadableCh(Account): def login(self, user, data, req): html = self.load("http://www.uploadable.ch/login.php", - post={'userName' : user, - 'userPassword' : data['password'], - 'autoLogin' : "1", - 'action__login': "normalLogin"}, req=req) + post={'userName' : user, + 'userPassword' : data['password'], + 'autoLogin' : "1", + 'action__login': "normalLogin"}, + req=req) if "Login failed" in html: self.wrong_password() diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 6a9270153..956d43a72 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -64,7 +64,10 @@ class UploadedTo(Account): #: req.cj.setCookie("uploaded.net", "lang", "en") html = self.load("https://uploaded.net/io/login", - post={'id': user, 'pw': data['password'], '_': ""}, req=req) + post={'id': user, + 'pw': data['password'], + '_': ""}, + req=req) if '"err"' in html: self.wrong_password() diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index b72102300..ffae50ce1 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -35,7 +35,9 @@ class UploadheroCom(Account): def login(self, user, data, req): html = self.load("http://uploadhero.co/lib/connexion.php", - post={"pseudo_login": user, "password_login": data['password']}, req=req) + post={"pseudo_login": user, + "password_login": data['password']}, + req=req) if "mot de passe invalide" in html: self.wrong_password() diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 5052266a4..6f6e0eed5 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -61,5 +61,8 @@ class UploadingCom(Account): ("uploading.com", "_lang" , "en")]) self.load("http://uploading.com/", req=req) - self.load("https://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time.time() * 1000, req=req), - post={'email': user, 'password': data['password'], 'remember': "on"}) + self.load("https://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time.time() * 1000), + post={'email' : user, + 'password': data['password'], + 'remember': "on"}, + req=req) diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index c8711838f..9f392bdb0 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -42,8 +42,9 @@ class WebshareCz(Account): def login(self, user, data, req): salt = self.load("https://webshare.cz/api/salt/", - post={'username_or_email': user, - 'wst' : ""}, req=req) + post={'username_or_email': user, + 'wst' : ""}, + req=req) if "<status>OK</status>" not in salt: self.wrong_password() @@ -53,11 +54,12 @@ class WebshareCz(Account): digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() login = self.load("https://webshare.cz/api/login/", - post={'digest' : digest, - 'keep_logged_in' : 1, - 'password' : password, - 'username_or_email': user, - 'wst' : ""}, req=req) + post={'digest' : digest, + 'keep_logged_in' : 1, + 'password' : password, + 'username_or_email': user, + 'wst' : ""}, + req=req) if "<status>OK</status>" not in login: self.wrong_password() diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index fad22b4c6..dd4e33739 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -30,10 +30,11 @@ class YibaishiwuCom(Account): def login(self, user, data, req): html = self.load("https://passport.115.com/?ac=login", - post={"back": "http://www.115.com/", - "goto": "http://115.com/", - "login[account]": user, - "login[passwd]": data['password']}, req=req) + post={"back" : "http://www.115.com/", + "goto" : "http://115.com/", + "login[account]": user, + "login[passwd]" : data['password']}, + req=req) if not 'var USER_PERMISSION = {' in html: self.wrong_password() diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index bec59be46..5415575c5 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -63,8 +63,9 @@ class ZeveraCom(Account): get_data.update(kwargs) res = self.load(self.API_URL, - get=get_data, - just_header=just_header, req=req) + get=get_data, + just_header=just_header, + req=req) self.log_debug(res) diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 44ca502a9..a5d4d7e59 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -249,7 +249,7 @@ class LinkCryptWs(Crypter): package_name, folder_name = self.get_package_info() self.log_debug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1))) - self.core.api.uploadContainer( "%s.%s" %(package_name, type), self.load(clink.group(1))) + self.core.api.uploadContainer('.'.join([package_name, type]), self.load(clink.group(1))) return "Found it" return package_links diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index 4f3077771..01fb7bffc 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -187,9 +187,9 @@ class RelinkUs(Crypter): if source == 'cnl2': return self.handle_CNL2Links() elif source == 'dlc': - return self.handle_d_l_c_links() + return self.handle_DLC_links() elif source == 'web': - return self.handle_w_e_b_links() + return self.handle_WEB_links() else: self.error(_('Unknown source type "%s"') % source) @@ -209,7 +209,7 @@ class RelinkUs(Crypter): return package_links - def handle_d_l_c_links(self): + def handle_DLC_links(self): self.log_debug("Search for DLC links") package_links = [] m = re.search(self.DLC_LINK_REGEX, self.html) @@ -230,7 +230,7 @@ class RelinkUs(Crypter): return package_links - def handle_w_e_b_links(self): + def handle_WEB_links(self): self.log_debug("Search for WEB links") package_links = [] diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py index b9b1b4f23..a7af1f0b0 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -33,7 +33,7 @@ class XFileSharingProFolder(XFSCrypter): account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) - if account and account.canUse(): + if account and account.can_use(): self.account = account elif self.account: @@ -42,9 +42,9 @@ class XFileSharingProFolder(XFSCrypter): else: return - self.user, data = self.account.selectAccount() - self.req = self.account.getAccountRequest(self.user) - self.premium = self.account.isPremium(self.user) + self.user, data = self.account.select_account() + self.req = self.account.get_account_request(self.user) + self.premium = self.account.is_premium(self.user) getInfo = create_getInfo(XFileSharingProFolder) diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py index e4b09f049..ed43683fa 100644 --- a/module/plugins/hooks/DownloadScheduler.py +++ b/module/plugins/hooks/DownloadScheduler.py @@ -72,9 +72,9 @@ class DownloadScheduler(Hook): if speed > 0: self.log_info(_("Setting download speed to %d kB/s") % speed) - self.core.api.setConfigValue("download", "limit_speed", 1) - self.core.api.setConfigValue("download", "max_speed", speed) + self.core.config.set("download", "limit_speed", 1) + self.core.config.set("download", "max_speed", speed) else: self.log_info(_("Setting download speed to FULL")) - self.core.api.setConfigValue("download", "limit_speed", 0) - self.core.api.setConfigValue("download", "max_speed", -1) + self.core.config.set("download", "limit_speed", 0) + self.core.config.set("download", "max_speed", -1) diff --git a/module/plugins/hooks/EasybytezComHook.py b/module/plugins/hooks/EasybytezComHook.py index e4374d37c..69f3a2a34 100644 --- a/module/plugins/hooks/EasybytezComHook.py +++ b/module/plugins/hooks/EasybytezComHook.py @@ -21,9 +21,9 @@ class EasybytezComHook(MultiHook): def get_hosters(self): - user, data = self.account.selectAccount() + user, data = self.account.select_account() - req = self.account.getAccountRequest(user) + req = self.account.get_account_request(user) html = self.load("http://www.easybytez.com", req=req) return re.search(r'</textarea>\s*Supported sites:(.*)', html).group(1).split(',') diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 73782ed95..9ca7bf854 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -162,7 +162,7 @@ class ExtractArchive(Hook): try: module = self.core.pluginManager.loadModule("internal", p) klass = getattr(module, p) - if klass.isUsable(): + if klass.is_usable(): self.extractors.append(klass) if klass.REPAIR: self.repair = self.get_config('repair') @@ -210,6 +210,15 @@ class ExtractArchive(Hook): self.extracting = False + #: Deprecated method, use `extract_package` instead + @Expose + def extractPackage(self, *args, **kwargs): + """ + See `extract_package` + """ + return self.extract_package(*args, **kwargs) + + @Expose def extract_package(self, *ids): """ @@ -301,7 +310,7 @@ class ExtractArchive(Hook): if filter(lambda ext: fname.lower().endswith(ext), extensions)] for Extractor in self.extractors: - targets = Extractor.getTargets(files_ids) + targets = Extractor.get_targets(files_ids) if targets: self.log_debug("Targets for %s: %s" % (Extractor.__name__, targets)) matched = True @@ -513,6 +522,15 @@ class ExtractArchive(Hook): raise Exception(_("Extract failed")) + #: Deprecated method, use `get_passwords` instead + @Expose + def getPasswords(self, *args, **kwargs): + """ + See `get_passwords` + """ + return self.get_passwords(*args, **kwargs) + + @Expose def get_passwords(self, reload=True): """ @@ -540,6 +558,15 @@ class ExtractArchive(Hook): self.passwords = passwords + #: Deprecated method, use `add_password` instead + @Expose + def addPassword(self, *args, **kwargs): + """ + See `add_password` + """ + return self.add_password(*args, **kwargs) + + @Expose def add_password(self, password): """ diff --git a/module/plugins/hooks/FreeWayMeHook.py b/module/plugins/hooks/FreeWayMeHook.py index 093dd82d3..48af011d4 100644 --- a/module/plugins/hooks/FreeWayMeHook.py +++ b/module/plugins/hooks/FreeWayMeHook.py @@ -19,6 +19,6 @@ class FreeWayMeHook(MultiHook): def get_hosters(self): - user, data = self.account.selectAccount() + user, data = self.account.select_account() hostis = self.load("http://www.free-way.bz/ajax/jd.php", get={"id": 3, "user": user, "pass": data['password']}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10 return [x.strip() for x in hostis.split(",") if x.strip()] diff --git a/module/plugins/hooks/PremiumToHook.py b/module/plugins/hooks/PremiumToHook.py index dd85cb903..937064087 100644 --- a/module/plugins/hooks/PremiumToHook.py +++ b/module/plugins/hooks/PremiumToHook.py @@ -21,7 +21,7 @@ class PremiumToHook(MultiHook): def get_hosters(self): - user, data = self.account.selectAccount() + user, data = self.account.select_account() html = self.load("http://premium.to/api/hosters.php", get={'username': user, 'password': data['password']}) return [x.strip() for x in html.replace("\"", "").split(";")] diff --git a/module/plugins/hooks/PremiumizeMeHook.py b/module/plugins/hooks/PremiumizeMeHook.py index 24d091454..94fc1d59c 100644 --- a/module/plugins/hooks/PremiumizeMeHook.py +++ b/module/plugins/hooks/PremiumizeMeHook.py @@ -21,7 +21,7 @@ class PremiumizeMeHook(MultiHook): def get_hosters(self): #: Get account data - user, data = self.account.selectAccount() + user, data = self.account.select_account() #: Get supported hosters list from premiumize.me using the #: json API v1 (see https://secure.premiumize.me/?show=api) diff --git a/module/plugins/hooks/RPNetBizHook.py b/module/plugins/hooks/RPNetBizHook.py index be472af26..19975a0cd 100644 --- a/module/plugins/hooks/RPNetBizHook.py +++ b/module/plugins/hooks/RPNetBizHook.py @@ -21,7 +21,7 @@ class RPNetBizHook(MultiHook): def get_hosters(self): #: Get account data - user, data = self.account.selectAccount() + user, data = self.account.select_account() res = self.load("https://premium.rpnet.biz/client_api.php", get={'username': user, 'password': data['password'], 'action': "showHosterList"}) diff --git a/module/plugins/hooks/RehostToHook.py b/module/plugins/hooks/RehostToHook.py index 016377e15..67f3a6e8a 100644 --- a/module/plugins/hooks/RehostToHook.py +++ b/module/plugins/hooks/RehostToHook.py @@ -19,8 +19,8 @@ class RehostToHook(MultiHook): def get_hosters(self): - user, data = self.account.selectAccount() + user, data = self.account.select_account() html = self.load("http://rehost.to/api.php", get={'cmd' : "get_supported_och_dl", - 'long_ses': self.account.getAccountInfo(user)['session']}) + 'long_ses': self.account.get_account_info(user)['session']}) return [x.strip() for x in html.replace("\"", "").split(",")] diff --git a/module/plugins/hooks/SmoozedComHook.py b/module/plugins/hooks/SmoozedComHook.py index d1cbd8126..2d4fb564e 100644 --- a/module/plugins/hooks/SmoozedComHook.py +++ b/module/plugins/hooks/SmoozedComHook.py @@ -19,5 +19,5 @@ class SmoozedComHook(MultiHook): def get_hosters(self): - user, data = self.account.selectAccount() - return self.account.getAccountInfo(user)["hosters"] + user, data = self.account.select_account() + return self.account.get_account_info(user)["hosters"] diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 488b300b8..50e818c66 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -95,6 +95,15 @@ class UpdateManager(Hook): self.update() + #: Deprecated method, use `autoreload_plugins` instead + @Expose + def autoreloadPlugins(self, *args, **kwargs): + """ + See `autoreload_plugins` + """ + return self.autoreload_plugins(*args, **kwargs) + + @Expose def autoreload_plugins(self): """ @@ -292,6 +301,15 @@ class UpdateManager(Hook): return exitcode + #: Deprecated method, use `remove_plugins` instead + @Expose + def removePlugins(self, *args, **kwargs): + """ + See `remove_plugins` + """ + return self.remove_plugins(*args, **kwargs) + + @Expose def remove_plugins(self, type_plugins): """ diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 7fc0426ea..909b350c9 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -66,12 +66,12 @@ class BasePlugin(Hoster): self.log_debug("Auth required", "Received HTTP status code: %d" % e.code) account = self.core.accountManager.getAccountPlugin('Http') - servers = [x['login'] for x in account.getAllAccounts()] + servers = [x['login'] for x in account.get_all_accounts()] server = urlparse.urlparse(pyfile.url).netloc if server in servers: self.log_debug("Logging on to %s" % server) - self.req.addAuth(account.getAccountData(server)['password']) + self.req.addAuth(account.get_account_data(server)['password']) else: pwd = self.get_password() if ':' in pwd: diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index f0514b817..91d7e68b8 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -85,7 +85,7 @@ class BezvadataCz(SimpleHoster): elif '<div class="infobox' in self.html: self.temp_offline() else: - return super(BezvadataCz, self).checkErrors() + return super(BezvadataCz, self).check_errors() def loadcaptcha(self, data, *args, **kwargs): diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index f58a0aa61..f93fe0bc9 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -35,7 +35,7 @@ class CloudzillaTo(SimpleHoster): if re.search(self.PASSWORD_PATTERN, self.html): self.retry(reason="Wrong password") else: - return super(CloudzillaTo, self).checkErrors() + return super(CloudzillaTo, self).check_errors() def handle_free(self, pyfile): diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 4e6b2e236..f7971e3ac 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -26,7 +26,7 @@ class FastixRu(MultiHoster): def handle_premium(self, pyfile): - api_key = self.account.getAccountData(self.user) + api_key = self.account.get_account_data(self.user) api_key = api_key['api'] self.html = self.load("http://fastix.ru/api_v2/", diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index d9013630d..f92d82269 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -110,7 +110,7 @@ class FilecloudIo(SimpleHoster): def handle_premium(self, pyfile): - akey = self.account.getAccountData(self.user)['akey'] + akey = self.account.get_account_data(self.user)['akey'] ukey = self.info['pattern']['ID'] self.log_debug("Akey: %s | Ukey: %s" % (akey, ukey)) rep = self.load("http://api.filecloud.io/api-fetch_download_url.api", diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 8ba963588..5a792a425 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -189,7 +189,7 @@ class FileserveCom(Hoster): # try api download res = self.load("http://app.fileserve.com/api/download/premium/", post={"username": self.user, - "password": self.account.getAccountData(self.user)['password'], + "password": self.account.get_account_data(self.user)['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 3750e6069..0f264dd49 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -24,7 +24,7 @@ class FreeWayMe(MultiHoster): def handle_premium(self, pyfile): - user, data = self.account.selectAccount() + user, data = self.account.select_account() for _i in xrange(5): #: try it five times @@ -32,7 +32,7 @@ class FreeWayMe(MultiHoster): get={'multiget': 7, 'url' : pyfile.url, 'user' : user, - 'pw' : self.account.getAccountData(user)['password'], + 'pw' : self.account.get_account_data(user)['password'], 'json' : ""}, just_header=True) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index 8c269b255..2accf9883 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -38,11 +38,11 @@ class Ftp(Hoster): pass if not "@" in netloc: - servers = [x['login'] for x in self.account.getAllAccounts()] if self.account else [] + servers = [x['login'] for x in self.account.get_all_accounts()] if self.account else [] if netloc in servers: self.log_debug("Logging on to %s" % netloc) - self.req.addAuth(self.account.getAccountInfo(netloc)['password']) + self.req.addAuth(self.account.get_account_info(netloc)['password']) else: pwd = self.get_password() if ':' in pwd: diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 60634354b..15a46066a 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -123,7 +123,7 @@ class LetitbitNet(SimpleHoster): def handle_premium(self, pyfile): api_key = self.user - premium_key = self.account.getAccountData(self.user)['password'] + premium_key = self.account.get_account_data(self.user)['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 19cad7b97..0aec4c959 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -29,7 +29,7 @@ class LinksnappyCom(MultiHoster): json_params = json_dumps({'link' : pyfile.url, 'type' : host, 'username': self.user, - 'password': self.account.getAccountData(self.user)['password']}) + 'password': self.account.get_account_data(self.user)['password']}) r = self.load("http://gen.linksnappy.com/genAPI.php", post={'genLinks': json_params}) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 67c8f087b..79c289da5 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -29,7 +29,7 @@ class MegaDebridEu(MultiHoster): Connexion to the mega-debrid API Return True if succeed """ - user, data = self.account.selectAccount() + user, data = self.account.select_account() jsonResponse = self.load(self.API_URL, get={'action': 'connectUser', 'login': user, 'password': data['password']}) res = json_loads(jsonResponse) diff --git a/module/plugins/hoster/MegaRapidoNet.py b/module/plugins/hoster/MegaRapidoNet.py index cc5be0ea3..5fa38d05d 100644 --- a/module/plugins/hoster/MegaRapidoNet.py +++ b/module/plugins/hoster/MegaRapidoNet.py @@ -46,7 +46,7 @@ class MegaRapidoNet(MultiHoster): 'links' : pyfile.url, 'exibir' : "normal", 'usar' : "premium", - 'user' : self.account.getAccountInfo(self.user).get('sid', None), + 'user' : self.account.get_account_info(self.user).get('sid', None), 'autoreset': ""}) if "desloga e loga novamente para gerar seus links" in self.html.lower(): diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index f68bfab18..506042aee 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -26,7 +26,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.getAccountData(self.user)['password'], + get={'user': self.user, 'pass': self.account.get_account_data(self.user)['password'], 'link': pyfile.url}) self.log_debug("JSON data: " + self.html) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index 9e935cd08..65170ca10 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -38,7 +38,7 @@ class NoPremiumPl(MultiHoster): def prepare(self): super(NoPremiumPl, self).prepare() - data = self.account.getAccountData(self.user) + data = self.account.get_account_data(self.user) self.usr = data['usr'] self.pwd = data['pwd'] diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index fb42243c5..190b04814 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -57,7 +57,7 @@ class OboomCom(Hoster): def get_session_token(self): if self.premium: - accountInfo = self.account.getAccountInfo(self.user, True) + accountInfo = self.account.get_account_info(self.user, True) if "session" in accountInfo: self.session_token = accountInfo['session'] else: diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index ab0440a2e..1d2650887 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -27,7 +27,7 @@ class OverLoadMe(MultiHoster): def handle_premium(self, pyfile): - data = self.account.getAccountData(self.user) + data = self.account.get_account_data(self.user) page = self.load("https://api.over-load.me/getdownload.php", get={'auth': data['password'], 'link': pyfile.url}) diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index e87742839..f02cc4c66 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -30,7 +30,7 @@ class PremiumizeMe(MultiHoster): pyfile.name = ".".join(temp) #: Get account data - user, data = self.account.selectAccount() + user, data = self.account.select_account() #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api) data = json_loads(self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10 diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index a548e1670..d151ce5e7 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -25,7 +25,7 @@ class RPNetBiz(MultiHoster): def handle_premium(self, pyfile): - user, data = self.account.selectAccount() + user, data = self.account.select_account() #: Get the download link res = self.load("https://premium.rpnet.biz/client_api.php", diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index a9a0b354a..9b893f7a3 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -38,7 +38,7 @@ class RapideoPl(MultiHoster): def prepare(self): super(RapideoPl, self).prepare() - data = self.account.getAccountData(self.user) + data = self.account.get_account_data(self.user) self.usr = data['usr'] self.pwd = data['pwd'] diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index b2962af10..f8b319a54 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -50,7 +50,7 @@ class RapidgatorNet(SimpleHoster): def setup(self): if self.account: - self.sid = self.account.getAccountInfo(self.user).get('sid', None) + self.sid = self.account.get_account_info(self.user).get('sid', None) else: self.sid = None diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index f3a011067..a4830afe4 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -22,7 +22,7 @@ class RehostTo(MultiHoster): def handle_premium(self, pyfile): self.download("http://rehost.to/process_download.php", get={'user': "cookie", - 'pass': self.account.getAccountInfo(self.user)['session'], + 'pass': self.account.get_account_info(self.user)['session'], 'dl' : pyfile.url}, disposition=True) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 2134ec7e6..413c796bb 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -123,7 +123,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.getAccountData(self.user)['password'], + 'password': self.account.get_account_data(self.user)['password'], 'act' : "download", 'lid' : self.info['fileid']}) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py index 31b5dd4d7..c278881f8 100644 --- a/module/plugins/hoster/SmoozedCom.py +++ b/module/plugins/hoster/SmoozedCom.py @@ -35,7 +35,7 @@ class SmoozedCom(MultiHoster): pyfile.name = ".".join(temp) #: Check the link - get_data = {'session_key': self.account.getAccountInfo(self.user)['session'], + get_data = {'session_key': self.account.get_account_info(self.user)['session'], 'url' : pyfile.url} data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index f60549813..85f20d406 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -116,7 +116,7 @@ class UlozTo(SimpleHoster): if re.search(self.VIPLINK_PATTERN, self.html): self.html = self.load(pyfile.url, get={'disclaimer': "1"}) - return super(UlozTo, self).checkErrors() + return super(UlozTo, self).check_errors() def check_file(self): diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 2ae7356c5..de83b42fc 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -64,7 +64,7 @@ class UploadheroCom(SimpleHoster): self.wait(wait_time, True) self.retry() - return super(UploadheroCom, self).checkErrors() + return super(UploadheroCom, self).check_errors() getInfo = create_getInfo(UploadheroCom) diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index 2afe7421a..b650e9219 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -40,7 +40,7 @@ class WebshareCz(SimpleHoster): def handle_free(self, pyfile): - wst = self.account.getAccountData(self.user).get('wst', None) if self.account else None + wst = self.account.get_account_data(self.user).get('wst', None) if self.account else None api_data = getURL("https://webshare.cz/api/file_link/", post={'ident': self.info['pattern']['ID'], 'wst': wst}) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 860fd5309..2cbd42906 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -34,7 +34,7 @@ class XFileSharingPro(XFSHoster): account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) - if account and account.canUse(): + if account and account.can_use(): self.account = account elif self.account: @@ -43,9 +43,9 @@ class XFileSharingPro(XFSHoster): else: return - self.user, data = self.account.selectAccount() - self.req = self.account.getAccountRequest(self.user) - self.premium = self.account.isPremium(self.user) + self.user, data = self.account.select_account() + self.req = self.account.get_account_request(self.user) + self.premium = self.account.is_premium(self.user) def setup(self): diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index 9e0efaee6..8fd16bba9 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -60,9 +60,9 @@ class Account(Plugin): #: set timestamp for login self.timestamps[user] = time.time() - req = self.get_account_request(user) + self.req = self.get_account_request(user) try: - self.login(user, data, req) + self.login(user, data, self.req) except WrongPassword: self.log_warning( @@ -82,8 +82,10 @@ class Account(Plugin): success = True finally: - if req: - req.close() + if hasattr(self, "req"): + if self.req: + self.req.close() + del self.req return success @@ -158,26 +160,31 @@ class Account(Plugin): if force or name not in self.infos: self.log_debug("Get Account Info for %s" % name) - req = self.get_account_request(name) + self.req = self.get_account_request(name) try: - infos = self.load_account_info(name, req) + infos = self.load_account_info(name, self.req) if not type(infos) == dict: raise Exception("Wrong return format") + except Exception, e: - infos = super(self.__class__, self).load_account_info(name, req) + infos = super(self.__class__, self).load_account_info(name, self.req) infos['error'] = str(e) if self.core.debug: traceback.print_exc() - if req: - req.close() + finally: + if hasattr(self, "req"): + if self.req: + self.req.close() + del self.req self.log_debug("Account Info: %s" % infos) infos['timestamp'] = time.time() self.infos[name] = infos + elif "timestamp" in self.infos[name] and self.infos[name]['timestamp'] + self.info_threshold * 60 < time.time(): self.log_debug("Reached timeout for account data") self.schedule_refresh(name) diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index 09672f6f0..722fae2e0 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -12,7 +12,7 @@ if os.name != "nt": import grp import pwd -from module.plugins.internal.Plugin import Plugin, Abort, Fail, Reconnect, Retry, Skip, parseHtmlForm +from module.plugins.internal.Plugin import Plugin, Abort, Fail, Reconnect, Retry, Skip, parse_html_form from module.utils import fs_decode, fs_encode, save_join as fs_join @@ -67,21 +67,21 @@ class Hoster(Plugin): #: username/login self.user = None - if self.account and not self.account.canUse(): + if self.account and not self.account.can_use(): self.account = None if self.account: - self.user, data = self.account.selectAccount() + self.user, data = self.account.select_account() #: Browser instance, see `network.Browser` - self.req = self.account.getAccountRequest(self.user) + self.req = self.account.get_account_request(self.user) self.chunk_limit = -1 #: chunk limit, -1 for unlimited #: enables resume (will be ignored if server dont accept chunks) self.resume_download = True #: premium status - self.premium = self.account.isPremium(self.user) + self.premium = self.account.is_premium(self.user) else: self.req = pyfile.m.core.requestFactory.getRequest(self.__name__) @@ -132,7 +132,7 @@ class Hoster(Plugin): self.thread = thread if self.account: - self.account.checkLogin(self.user) + self.account.check_login(self.user) else: self.req.clearCookies() @@ -626,14 +626,14 @@ class Hoster(Plugin): def parse_html_form(self, attr_str="", input_names={}): - return parseHtmlForm(attr_str, self.html, input_names) + return parse_html_form(attr_str, self.html, input_names) def check_traffic_left(self): if not self.account: return True - traffic = self.account.getAccountInfo(self.user, True)['trafficleft'] + traffic = self.account.get_account_info(self.user, True)['trafficleft'] if traffic is None: return False diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index 623836cdc..2e99afa1c 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -83,7 +83,7 @@ class MultiHook(Hook): def load_account(self): self.account = self.core.accountManager.getAccountPlugin(self.pluginname) - if self.account and not self.account.canUse(): + if self.account and not self.account.can_use(): self.account = None if not self.account and hasattr(self.pluginclass, "LOGIN_ACCOUNT") and self.pluginclass.LOGIN_ACCOUNT: diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 8360d871e..363d46739 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -33,7 +33,7 @@ class MultiHoster(SimpleHoster): self.info = {} self.html = "" self.link = "" #@TODO: Move to Hoster in 0.4.10 - self.direct_d_l = False #@TODO: Move to Hoster in 0.4.10 + self.direct_dl = False #@TODO: Move to Hoster in 0.4.10 if not self.get_config('use_premium', True): self.retry_free() @@ -47,9 +47,9 @@ class MultiHoster(SimpleHoster): set_cookies(self.req.cj, self.COOKIES) if self.DIRECT_LINK is None: - self.direct_d_l = self.__pattern__ != r'^unmatchable$' and re.match(self.__pattern__, self.pyfile.url) + self.direct_dl = self.__pattern__ != r'^unmatchable$' and re.match(self.__pattern__, self.pyfile.url) else: - self.direct_d_l = self.DIRECT_LINK + self.direct_dl = self.DIRECT_LINK self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS) @@ -58,7 +58,7 @@ class MultiHoster(SimpleHoster): try: self.prepare() - if self.direct_d_l: + if self.direct_dl: self.check_info() self.log_debug("Looking for direct download link...") self.handle_direct(pyfile) diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index 0b08858f3..01294ea92 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -236,7 +236,7 @@ class Plugin(object): return html_unescape(urllib.unquote(url.decode('unicode-escape'))).strip() - def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=True, req=None): + def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=True, multipart=True, req=None): """ Load content at url and returns it @@ -266,7 +266,7 @@ class Plugin(object): else: req = self.core.requestFactory.getRequest(self.__name__) - res = req.load(url, get, post, ref, cookies, just_header, True, bool(decode)) + res = req.load(url, get, post, ref, cookies, just_header, multipart, bool(decode)) if decode: res = html_unescape(res).decode(decode if isinstance(decode, basestring) else 'utf8') diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py index 86ff5156e..d067468dd 100644 --- a/module/plugins/internal/SevenZip.py +++ b/module/plugins/internal/SevenZip.py @@ -147,7 +147,7 @@ class SevenZip(UnRar): #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) - self.manager.logDebug(" ".join(call)) + self.manager.log_debug(" ".join(call)) p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index fe47178e3..82f5ef332 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -55,10 +55,10 @@ class SimpleCrypter(Crypter, SimpleHoster): account_name = (self.__name__ + ".py").replace("Folder.py", "").replace(".py", "") account = self.core.accountManager.getAccountPlugin(account_name) - if account and account.canUse(): - self.user, data = account.selectAccount() - self.req = account.getAccountRequest(self.user) - self.premium = account.isPremium(self.user) + if account and account.can_use(): + self.user, data = account.select_account() + self.req = account.get_account_request(self.user) + self.premium = account.is_premium(self.user) self.account = account diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 2e31c1176..0e4b94534 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -266,7 +266,7 @@ class SimpleHoster(Hoster): self.info = {} self.html = "" #@TODO: Recheck in 0.4.10 self.link = "" #@TODO: Recheck in 0.4.10 - self.direct_d_l = False + self.direct_dl = False self.multihost = False if not self.get_config('use_premium', True): @@ -297,9 +297,9 @@ class SimpleHoster(Hoster): return if self.DIRECT_LINK is None: - self.direct_d_l = bool(self.account) + self.direct_dl = bool(self.account) else: - self.direct_d_l = self.DIRECT_LINK + self.direct_dl = self.DIRECT_LINK self.pyfile.url = replace_patterns(self.pyfile.url, self.URL_REPLACEMENTS) @@ -316,7 +316,7 @@ class SimpleHoster(Hoster): self.prepare() self.check_info() - if self.direct_d_l: + if self.direct_dl: self.log_debug("Looking for direct download link...") self.handle_direct(pyfile) @@ -364,7 +364,8 @@ class SimpleHoster(Hoster): self.invalid_captcha() self.retry(10, reason=_("Wrong captcha")) - elif self.check_download({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}, file_size=self.info['size']): + elif self.check_download({'Empty file': re.compile(r'\A((.|)(\2|\s)*)\Z')}, + file_size=self.info['size']): self.error(_("Empty file")) else: diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 4494b98c6..50c421e8d 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -191,7 +191,7 @@ class UnRar(Extractor): raise ArchiveError(_("Cannot open file")) if err.strip(): #: only log error at this point - self.manager.logError(err.strip()) + self.manager.log_error(err.strip()) result = set() if not self.fullpath and self.VERSION.startswith('5'): @@ -237,7 +237,7 @@ class UnRar(Extractor): #@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue call = [self.CMD, command] + args + list(xargs) - self.manager.logDebug(" ".join(call)) + self.manager.log_debug(" ".join(call)) p = subprocess.Popen(call, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return p diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index fb2302f4c..23759f6d3 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -5,7 +5,7 @@ import time import urlparse from module.plugins.internal.Account import Account -from module.plugins.internal.Plugin import parseHtmlForm, set_cookies +from module.plugins.internal.Plugin import parse_html_form, set_cookies class XFSAccount(Account): @@ -157,7 +157,7 @@ class XFSAccount(Account): self.LOGIN_URL = urlparse.urljoin(self.HOSTER_URL, "login.html") html = self.load(self.LOGIN_URL, req=req) - action, inputs = parseHtmlForm('name="FL"', html) + action, inputs = parse_html_form('name="FL"', html) if not inputs: inputs = {'op' : "login", 'redirect': self.HOSTER_URL} diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index 68cf25f14..9f8728512 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -47,7 +47,7 @@ class XFSHoster(SimpleHoster): SOLVEMEDIA_PATTERN = None FORM_PATTERN = None - FORM_INPUTS_MAP = None #: dict passed as input_names to parseHtmlForm + FORM_INPUTS_MAP = None #: dict passed as input_names to parse_html_form def setup(self): @@ -80,7 +80,7 @@ class XFSHoster(SimpleHoster): super(XFSHoster, self).prepare() if self.DIRECT_LINK is None: - self.direct_d_l = self.premium + self.direct_dl = self.premium def handle_free(self, pyfile): |