diff options
Diffstat (limited to 'module/plugins')
100 files changed, 334 insertions, 326 deletions
diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index c47ec9d77..61ba4f0b0 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -17,19 +17,19 @@ class BitshareCom(Account): html = self.load("http://bitshare.com/mysettings.html") if "\"http://bitshare.com/myupgrade.html\">Free" in html: - return {"validuntil": -1, "trafficleft": -1, "premium": False} + return {'validuntil': -1, 'trafficleft': -1, 'premium': False} if not '<input type="checkbox" name="directdownload" checked="checked" />' in html: self.log_warning(_("Activate direct Download in your Bitshare Account")) - return {"validuntil": -1, "trafficleft": -1, "premium": True} + return {'validuntil': -1, 'trafficleft': -1, 'premium': True} def login(self, user, data, req): html = self.load("https://bitshare.com/login.html", - post={"user" : user, - "password": data['password'], - "submit" : "Login"}) + post={'user' : user, + 'password': data['password'], + 'submit' : "Login"}) if "login" in req.lastEffectiveURL: self.wrong_password() diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 4b1bb14cb..bce984d67 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -45,7 +45,7 @@ class CzshareCom(Account): def login(self, user, data, req): html = self.load('https://sdilej.cz/index.php', - post={"Prihlasit" : "Prihlasit", + post={'Prihlasit' : "Prihlasit", "login-password": data['password'], "login-name" : user}) diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 4b4b498b7..07d7a2332 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -21,14 +21,14 @@ class DebridItaliaCom(Account): def load_account_info(self, user, req): - info = {"premium": False, "validuntil": None, "trafficleft": None} + info = {'premium': False, 'validuntil': None, 'trafficleft': None} html = self.load("http://debriditalia.com/") if 'Account premium not activated' not in html: m = re.search(self.WALID_UNTIL_PATTERN, html) if m: validuntil = time.mktime(time.strptime(m.group(1), "%d/%m/%Y %H:%M")) - info = {"premium": True, "validuntil": validuntil, "trafficleft": -1} + info = {'premium': True, 'validuntil': validuntil, 'trafficleft': -1} else: self.log_error(_("Unable to retrieve account information")) diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 7c60682c0..8340a26d3 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -24,14 +24,14 @@ class DepositfilesCom(Account): validuntil = time.mktime(time.strptime(validuntil, "%Y-%m-%d %H:%M:%S")) - return {"validuntil": validuntil, "trafficleft": -1} + return {'validuntil': validuntil, 'trafficleft': -1} 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']}) + get={'return': "/de/gold/payment.php"}, + post={'login' : user, + 'password': data['password']}) 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 6317ea1b2..f39577fbd 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -28,14 +28,14 @@ class EuroshareEu(Account): premium = True validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y %H:%M")) - return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} def login(self, user, data, req): html = self.load('http://euroshare.eu/customer-zone/login/', - post={"trvale" : "1", - "login" : user, - "password": data['password']}) + post={'trvale' : "1", + 'login' : user, + 'password': data['password']}) 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 1fe93fb14..789fa9e04 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -24,9 +24,9 @@ class FastixRu(Account): kb = float(points) * 1024 ** 2 / 1000 if points > 0: - account_info = {"validuntil": -1, "trafficleft": kb} + account_info = {'validuntil': -1, 'trafficleft': kb} else: - account_info = {"validuntil": None, "trafficleft": None, "premium": False} + account_info = {'validuntil': None, 'trafficleft': None, 'premium': False} return account_info diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index d8b60ccbc..5e31988b7 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -19,26 +19,26 @@ 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_account_data(user)['password']}) + post={'username': user, 'password': self.get_account_data(user)['password']}) rep = json_loads(rep) if rep['status'] == 'ok': break elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password': self.log_error(_("Wrong username or password")) - return {"valid": False, "premium": False} + return {'valid': False, 'premium': False} else: - return {"premium": False} + return {'premium': False} 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}) + post={'akey': akey}) rep = json_loads(rep) if rep['is_premium'] == 1: - return {"validuntil": float(rep['premium_until']), "trafficleft": -1} + return {'validuntil': float(rep['premium_until']), 'trafficleft': -1} else: - return {"premium": False} + return {'premium': False} def login(self, user, data, req): diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index e402c8aaa..eee356bf1 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -33,16 +33,16 @@ class FilefactoryCom(Account): premium = False validuntil = -1 - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} def login(self, user, data, req): 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"}) + post={'loginEmail' : user, + 'loginPassword': data['password'], + 'Submit' : "Sign In"}) 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 f0ff77ad8..3909addd5 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -34,17 +34,17 @@ class FilejungleCom(Account): premium = False validuntil = -1 - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} def login(self, user, data, 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": ""}) + post={'loginUserName' : user, + 'loginUserPassword' : data['password'], + 'loginFormSubmit' : "Login", + 'recaptcha_challenge_field' : "", + 'recaptcha_response_field' : "", + 'recaptcha_shortencode_field': ""}) 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 ac90c2993..807c938f4 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -27,7 +27,7 @@ class FilerNet(Account): #: Free user if re.search(self.FREE_PATTERN, html): - return {"premium": False, "validuntil": None, "trafficleft": None} + return {'premium': False, 'validuntil': None, 'trafficleft': None} until = re.search(self.WALID_UNTIL_PATTERN, html) traffic = re.search(self.TRAFFIC_PATTERN, html) @@ -35,11 +35,11 @@ class FilerNet(Account): if until and traffic: validuntil = time.mktime(time.strptime(until.group(1), "%d.%m.%Y %H:%M:%S")) trafficleft = self.parse_traffic(traffic.group(1)) - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + return {'premium': True, 'validuntil': validuntil, 'trafficleft': trafficleft} else: self.log_error(_("Unable to retrieve account information")) - return {"premium": False, "validuntil": None, "trafficleft": None} + return {'premium': False, 'validuntil': None, 'trafficleft': None} def login(self, user, data, req): @@ -48,11 +48,11 @@ 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/"}) + post={'_username' : user, + '_password' : data['password'], + '_remember_me': "on", + '_csrf_token' : token, + '_target_path': "https://filer.net/"}) if 'Logout' not in html: self.wrong_password() diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index b1ec45c42..8335b92e3 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -14,17 +14,17 @@ class FilesMailRu(Account): def load_account_info(self, user, req): - return {"validuntil": None, "trafficleft": None} + return {'validuntil': None, 'trafficleft': None} def login(self, user, data, req): 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/"}) + post={'Domain' : domain, + 'Login' : user, + 'Password': data['password'], + 'Page' : "http://files.mail.ru/"}) if "Неверное имя пользователя или пароль" in html: self.wrong_password() diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index edbf4a1cf..8a77325d4 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -20,23 +20,23 @@ class FileserveCom(Account): data = self.get_account_data(user) html = self.load("http://app.fileserve.com/api/login/", - post={"username": user, - "password": data['password'], - "submit": "Submit+Query"}) + post={'username': user, + 'password': data['password'], + 'submit': "Submit+Query"}) res = json_loads(html) if res['type'] == "premium": validuntil = time.mktime(time.strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) - return {"trafficleft": res['traffic'], "validuntil": validuntil} + return {'trafficleft': res['traffic'], 'validuntil': validuntil} else: - return {"premium": False, "trafficleft": None, "validuntil": None} + return {'premium': False, 'trafficleft': None, 'validuntil': None} def login(self, user, data, req): html = self.load("http://app.fileserve.com/api/login/", - post={"username": user, - "password": data['password'], - "submit" : "Submit+Query"}) + post={'username': user, + 'password': data['password'], + 'submit' : "Submit+Query"}) res = json_loads(html) if not res['type']: @@ -44,7 +44,7 @@ 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"}) + post={'loginUserName' : user, + 'loginUserPassword': data['password'], + 'autoLogin' : "checked", + 'loginFormSubmit' : "Login"}) diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index 3d84a84e4..faeb0bf94 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -16,7 +16,7 @@ class FourSharedCom(Account): def load_account_info(self, user, req): #: Free mode only for now - return {"premium": False} + return {'premium': False} def login(self, user, data, req): diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index a06176a55..5209fa630 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -37,16 +37,16 @@ class FreakshareCom(Account): except Exception: pass - return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} + return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft} def login(self, user, data, req): self.load("http://freakshare.com/index.php?language=EN") html = self.load("https://freakshare.com/login.html", - post={"submit": "Login", - "user" : user, - "pass" : data['password']}) + post={'submit': "Login", + 'user' : user, + 'pass' : data['password']}) if ">Wrong Username or Password" in html: self.wrong_password() diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 95977bd0f..2b54a850a 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -19,15 +19,15 @@ class FreeWayMe(Account): self.log_debug(status) - account_info = {"validuntil": -1, "premium": False} + account_info = {'validuntil': -1, 'premium': False} if status['premium'] == "Free": account_info['trafficleft'] = self.parse_traffic(status['guthaben'] + "MB") elif status['premium'] == "Spender": account_info['trafficleft'] = -1 elif status['premium'] == "Flatrate": - account_info = {"validuntil": float(status['Flatrate']), - "trafficleft": -1, - "premium": True} + account_info = {'validuntil' : float(status['Flatrate']), + 'trafficleft': -1, + 'premium' : True} return account_info @@ -42,7 +42,7 @@ class FreeWayMe(Account): def get_account_status(self, user, 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_account_data(user)['password']}) + get={'id': 4, 'user': user, 'pass': self.get_account_data(user)['password']}) self.log_debug("Login: %s" % answer) diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index aefc76e41..809807fdb 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -29,7 +29,7 @@ class FshareVn(Account): if re.search(self.LIFETIME_PATTERN, html): self.log_debug("Lifetime membership detected") trafficleft = self.get_traffic_left() - return {"validuntil": -1, "trafficleft": trafficleft, "premium": True} + return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': True} m = re.search(self.VALID_UNTIL_PATTERN, html) if m: @@ -41,7 +41,7 @@ class FshareVn(Account): validuntil = None trafficleft = None - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} def login(self, user, data, req): diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 9556f2bda..b4a3b71e9 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -48,7 +48,7 @@ class HellshareCz(Account): validuntil = -1 trafficleft = -1 - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} def login(self, user, data, req): diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index 45295d379..2424496f9 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -27,7 +27,7 @@ class LetitbitNet(Account): # self.log_warning(api_rep['data']) # return {'valid': False, 'premium': False} - return {"premium": True} + return {'premium': True} def login(self, user, data, req): diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index 4f055ff37..791049bac 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -27,10 +27,10 @@ class MegaDebridEu(Account): res = json_loads(jsonResponse) if res['response_code'] == "ok": - return {"premium": True, "validuntil": float(res['vip_end']), "status": True} + return {'premium': True, 'validuntil': float(res['vip_end']), 'status': True} else: self.log_error(res) - return {"status": False, "premium": False} + return {'status': False, 'premium': False} def login(self, user, data, req): diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index b95a832e6..0bc91148a 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -35,14 +35,14 @@ class MegaRapidCz(Account): m = re.search(self.VALID_UNTIL_PATTERN, htmll) if m: validuntil = time.mktime(time.strptime(m.group(1), "%d.%m.%Y - %H:%M")) - return {"premium": True, "trafficleft": -1, "validuntil": validuntil} + return {'premium': True, 'trafficleft': -1, 'validuntil': validuntil} m = re.search(self.TRAFFIC_LEFT_PATTERN, htmll) if m: trafficleft = float(m.group(1)) * (1 << 20) - return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} + return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1} - return {"premium": False, "trafficleft": None, "validuntil": None} + return {'premium': False, 'trafficleft': None, 'validuntil': None} def login(self, user, data, req): @@ -53,8 +53,8 @@ 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": 1, - "sbmt" : u"Přihlásit"}) + post={'hash' : hashes, + 'login' : user, + 'pass1' : data['password'], + 'remember': 1, + 'sbmt' : u"Přihlásit"}) diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index c91782a5f..62bf71877 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -33,15 +33,15 @@ class MegasharesCom(Account): except Exception, e: self.log_error(e) - return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} 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']}) + post={'httpref' : "", + 'myms_login' : "Login", + 'mymslogin_name': user, + 'mymspassword' : data['password']}) 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 0c78a6707..cbb607c87 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -30,14 +30,14 @@ class MultishareCz(Account): html = self.load("http://www.multishare.cz/") mms_info = dict(re.findall(self.ACCOUNT_INFO_PATTERN, html)) - return dict(mms_info, **{"validuntil": -1, "trafficleft": trafficleft}) + return dict(mms_info, **{'validuntil': -1, 'trafficleft': trafficleft}) 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}) + post={'akce' : "Přihlásit", + 'heslo': data['password'], + 'jmeno': user}) 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 8303c1b52..160a354d0 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -19,7 +19,7 @@ class MyfastfileCom(Account): def load_account_info(self, user, req): if 'days_left' in self.json_data: validuntil = time.time() + self.json_data['days_left'] * 24 * 60 * 60 - return {"premium": True, "validuntil": validuntil, "trafficleft": -1} + return {'premium': True, 'validuntil': validuntil, 'trafficleft': -1} else: self.log_error(_("Unable to get account information")) @@ -27,8 +27,8 @@ 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']}) + get={'user': user, + 'pass': data['password']}) self.log_debug("JSON data: " + html) diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index 47fedb044..c4c930508 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -44,7 +44,7 @@ class NowVideoSx(Account): premium = False validuntil = -1 - return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} def login(self, user, data, req): diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 5557be206..c33d5f4ef 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -36,8 +36,8 @@ class OboomCom(Account): pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) result = json_loads(self.load("https://www.oboom.com/1/login", - get={"auth": user, - "pass": pbkdf2})) + get={'auth': user, + 'pass': pbkdf2})) if not result[0] == 200: self.log_warning(_("Failed to log in: %s") % result[1]) diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index 869000f04..a6ebec39d 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -20,8 +20,8 @@ class PremiumizeMe(Account): self.log_debug(status) #: Parse account info - account_info = {"validuntil": float(status['result']['expires']), - "trafficleft": max(0, status['result']['trafficleft_bytes'] / 1024)} #@TODO: Remove `/ 1024` in 0.4.10 + account_info = {'validuntil': float(status['result']['expires']), + 'trafficleft': max(0, status['result']['trafficleft_bytes'] / 1024)} #@TODO: Remove `/ 1024` in 0.4.10 if status['result']['type'] != 'free': account_info['premium'] = True diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 4054ba180..3a9a79ad9 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -29,14 +29,14 @@ class QuickshareCz(Account): trafficleft = None premium = False - return {"validuntil": -1, "trafficleft": trafficleft, "premium": premium} + return {'validuntil': -1, 'trafficleft': trafficleft, 'premium': premium} 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}) + post={'akce' : u'Přihlásit', + 'heslo': data['password'], + 'jmeno': user}) if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html: self.wrong_password() diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index db5dbbb24..66557cbc8 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -20,14 +20,14 @@ class RPNetBiz(Account): try: if res['accountInfo']['isPremium']: #: Parse account info. Change the trafficleft later to support per host info. - account_info = {"validuntil": float(res['accountInfo']['premiumExpiry']), - "trafficleft": -1, "premium": True} + account_info = {'validuntil': float(res['accountInfo']['premiumExpiry']), + 'trafficleft': -1, 'premium': True} else: - account_info = {"validuntil": None, "trafficleft": None, "premium": False} + account_info = {'validuntil': None, 'trafficleft': None, 'premium': False} except KeyError: #: Handle wrong password exception - account_info = {"validuntil": None, "trafficleft": None, "premium": False} + account_info = {'validuntil': None, 'trafficleft': None, 'premium': False} return account_info @@ -44,8 +44,8 @@ class RPNetBiz(Account): def get_account_status(self, user, 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_account_data(user)['password'], - "action": "showAccountInformation"}) + get={'username': user, 'password': self.get_account_data(user)['password'], + 'action': "showAccountInformation"}) self.log_debug("JSON data: %s" % res) return json_loads(res) diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 7732925b7..dfbe338ff 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -58,8 +58,8 @@ class RapidgatorNet(Account): def login(self, user, data, req): try: html = self.load(urlparse.urljoin(self.API_URL, "login"), - post={"username": user, - "password": data['password']}) + post={'username': user, + 'password': data['password']}) self.log_debug("API:LOGIN", html) diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 6ec13e93f..951953257 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -33,8 +33,8 @@ class RealdebridCom(Account): self.pin_code = False html = self.load("https://real-debrid.com/ajax/login.php", - get={"user": user, - "pass": data['password']}) + get={'user': user, + 'pass': data['password']}) if "Your login informations are incorrect" in html: self.wrong_password() diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 84b704f63..858a8b525 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -34,7 +34,7 @@ class SimplyPremiumCom(Account): if 'remain_traffic' in json_data['result'] and json_data['result']['remain_traffic']: trafficleft = float(json_data['result']['remain_traffic']) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 - return {"premium": premium, "validuntil": validuntil, "trafficleft": trafficleft} + return {'premium': premium, 'validuntil': validuntil, 'trafficleft': trafficleft} def login(self, user, data, req): diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index e0044930f..d773c63ec 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -20,9 +20,9 @@ class SimplydebridCom(Account): res = self.load("http://simply-debrid.com/api.php", get=get_data) data = [x.strip() for x in res.split(";")] if str(data[0]) != "1": - return {"premium": False} + return {'premium': False} else: - return {"trafficleft": -1, "validuntil": time.mktime(time.strptime(str(data[2]), "%d/%m/%Y"))} + return {'trafficleft': -1, 'validuntil': time.mktime(time.strptime(str(data[2]), "%d/%m/%Y"))} def login(self, user, data, req): diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index c6cd8d22f..19e8a133b 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -27,7 +27,7 @@ class TurbobitNet(Account): premium = False validuntil = -1 - return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + return {'premium': premium, 'trafficleft': -1, 'validuntil': validuntil} def login(self, user, data, req): diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index bb5eaa6c1..df323d71c 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -26,17 +26,17 @@ class UploadheroCom(Account): if premium_pattern.search(html): end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(html).group(1))) end_date = time.mktime(future.timetuple()) - account_info = {"validuntil": end_date, "trafficleft": -1, "premium": True} + account_info = {'validuntil': end_date, 'trafficleft': -1, 'premium': True} else: - account_info = {"validuntil": -1, "trafficleft": -1, "premium": False} + account_info = {'validuntil': -1, 'trafficleft': -1, 'premium': False} return account_info def login(self, user, data, req): html = self.load("http://uploadhero.co/lib/connexion.php", - post={"pseudo_login": user, - "password_login": data['password']}) + post={'pseudo_login': user, + 'password_login': data['password']}) if "mot de passe invalide" in html: self.wrong_password() diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index c2966f156..00cd91305 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -25,13 +25,13 @@ class YibaishiwuCom(Account): m = re.search(self.ACCOUNT_INFO_PATTERN, html, re.S) premium = True if m and 'is_vip: 1' in m.group(1) else False validuntil = trafficleft = (-1 if m else 0) - return dict({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) + return dict({'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium}) 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/", + post={'back' : "http://www.115.com/", + 'goto' : "http://115.com/", "login[account]": user, "login[passwd]" : data['password']}) diff --git a/module/plugins/captcha/LinksaveIn.py b/module/plugins/captcha/LinksaveIn.py index a9fe2d630..f263f4588 100644 --- a/module/plugins/captcha/LinksaveIn.py +++ b/module/plugins/captcha/LinksaveIn.py @@ -52,7 +52,7 @@ class LinksaveIn(OCR): new.save(self.data_dir+"unblacked.png") self.image = new.copy() self.pixels = self.image.load() - self.result_captcha = '' + self.result_captcha = "" def get_bg(self): diff --git a/module/plugins/crypter/DailymotionComFolder.py b/module/plugins/crypter/DailymotionComFolder.py index d3d68b7c7..688a880cb 100644 --- a/module/plugins/crypter/DailymotionComFolder.py +++ b/module/plugins/crypter/DailymotionComFolder.py @@ -30,7 +30,7 @@ class DailymotionComFolder(Crypter): def get_playlist_info(self, id): ref = "playlist/" + id - data = {"fields": "name,owner.screenname"} + data = {'fields': "name,owner.screenname"} playlist = self.api_response(ref, data) if "error" in playlist: @@ -43,7 +43,7 @@ class DailymotionComFolder(Crypter): def _get_playlists(self, user_id, page=1): ref = "user/%s/playlists" % user_id - data = {"fields": "id", "page": page, "limit": 100} + data = {'fields': "id", 'page': page, 'limit': 100} user = self.api_response(ref, data) if "error" in user: @@ -63,7 +63,7 @@ class DailymotionComFolder(Crypter): def _get_videos(self, id, page=1): ref = "playlist/%s/videos" % id - data = {"fields": "url", "page": page, "limit": 100} + data = {'fields': "url", 'page': page, 'limit': 100} playlist = self.api_response(ref, data) if "error" in playlist: diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index 7dc0fc6bc..e9249e64b 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -42,7 +42,7 @@ class DuckCryptInfo(Crypter): self.log_debug("Redirectet to " + str(m.group(0))) html = self.load(str(m.group(0))) soup = BeautifulSoup.BeautifulSoup(html) - cryptlinks = soup.findAll("div", attrs={"class": "folderbox"}) + cryptlinks = soup.findAll("div", attrs={'class': "folderbox"}) self.log_debug("Redirectet to " + str(cryptlinks)) if not cryptlinks: self.error(_("No link found")) diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py index 624dadb94..94356ed31 100644 --- a/module/plugins/crypter/FilecryptCc.py +++ b/module/plugins/crypter/FilecryptCc.py @@ -81,7 +81,7 @@ class FilecryptCc(Crypter): if not password: self.fail(_("Please enter the password in package section and try again")) - self.html = self.load(self.pyfile.url, post={"password": password}) + self.html = self.load(self.pyfile.url, post={'password': password}) def handle_captcha(self): diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index 1a897a3c1..34e98b28d 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -33,8 +33,8 @@ class HoerbuchIn(Crypter): html = self.load(pyfile.url) soup = BeautifulSoup.BeautifulSoup(html, convertEntities=BeautifulSoup.BeautifulStoneSoup.HTML_ENTITIES) - abookname = soup.find("a", attrs={"rel": "bookmark"}).text - for a in soup.findAll("a", attrs={"href": self.protection}): + abookname = soup.find("a", attrs={'rel': "bookmark"}).text + for a in soup.findAll("a", attrs={'href': self.protection}): package = "%s (%s)" % (abookname, a.previousSibling.previousSibling.text[:-1]) links = self.decrypt_folder(a['href']) @@ -50,7 +50,7 @@ class HoerbuchIn(Crypter): url = m.group(0) self.pyfile.url = url - html = self.load(url, post={"viewed": "adpg"}) + html = self.load(url, post={'viewed': "adpg"}) links = [] pattern = re.compile("http://www\.hoerbuch\.in/protection/(\w+)/(.*?)\"") diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py index 4fe2384da..f7eec388b 100644 --- a/module/plugins/crypter/LinkCryptWs.py +++ b/module/plugins/crypter/LinkCryptWs.py @@ -125,7 +125,7 @@ class LinkCryptWs(Crypter): if password: self.log_debug("Submitting password [%s] for protected links" % password) - self.html = self.load(self.pyfile.url, post={"password": password, 'x': "0", 'y': "0"}) + self.html = self.load(self.pyfile.url, post={'password': password, 'x': "0", 'y': "0"}) else: self.fail(_("Folder is password protected")) @@ -134,7 +134,7 @@ class LinkCryptWs(Crypter): captcha_url = re.search(r'<form.*?id\s*?=\s*?"captcha"[^>]*?>.*?<\s*?input.*?src="(.+?)"', self.html, re.I | re.S).group(1) captcha_code = self.decrypt_captcha(captcha_url, forceUser=True, imgtype="gif", result_type='positional') - self.html = self.load(self.pyfile.url, post={"x": captcha_code[0], "y": captcha_code[1]}) + self.html = self.load(self.pyfile.url, post={'x': captcha_code[0], 'y': captcha_code[1]}) def get_package_info(self): diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index b56a1dd57..676b1f7cc 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -34,7 +34,7 @@ class LinkdecrypterCom(Crypter): def decrypt(self, pyfile): retries = 5 - post_dict = {"link_cache": "on", "pro_links": pyfile.url, "modo_links": "text"} + post_dict = {'link_cache': "on", 'pro_links': pyfile.url, 'modo_links': "text"} self.html = self.load('http://linkdecrypter.com/', post=post_dict) while retries: @@ -54,7 +54,7 @@ class LinkdecrypterCom(Crypter): captcha = self.decrypt_captcha(captcha_url, result_type=result_type) if result_type == "positional": captcha = "%d|%d" % captcha - self.html = self.load('http://linkdecrypter.com/', post={"captcha": captcha}) + self.html = self.load('http://linkdecrypter.com/', post={'captcha': captcha}) retries -= 1 elif self.PASSWORD_PATTERN in self.html: diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index a86396a25..6744fd311 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -49,11 +49,11 @@ class LixIn(Crypter): self.log_debug("Trying captcha") captcharesult = self.decrypt_captcha(urlparse.urljoin("http://lix.in/", m.group(1))) self.html = self.load(url, - post={"capt": captcharesult, "submit": "submit", "tiny": id}) + post={'capt': captcharesult, 'submit': "submit", 'tiny': id}) else: self.log_debug("No captcha/captcha solved") else: - self.html = self.load(url, post={"submit": "submit", "tiny": id}) + self.html = self.load(url, post={'submit': "submit", 'tiny': id}) m = re.search(self.LINK_PATTERN, self.html) if m is None: diff --git a/module/plugins/crypter/ShSt.py b/module/plugins/crypter/ShSt.py index 05a5518d3..2c6681adf 100644 --- a/module/plugins/crypter/ShSt.py +++ b/module/plugins/crypter/ShSt.py @@ -26,5 +26,5 @@ class ShSt(Crypter): self.req.http.c.setopt(pycurl.USERAGENT, "curl/7.42.1") #: Fetch the target URL header = self.load(self.pyfile.url, just_header = True, decode = False) - target_url = header["location"] + target_url = header['location'] self.urls.append(target_url) diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py index 9b435e694..1a26080bc 100644 --- a/module/plugins/crypter/ShareLinksBiz.py +++ b/module/plugins/crypter/ShareLinksBiz.py @@ -80,7 +80,7 @@ class ShareLinksBiz(Crypter): def is_password_protected(self): - if re.search(r'''<form.*?id="passwordForm".*?>''', self.html): + if re.search(r'<form.*?id="passwordForm".*?>', self.html): self.log_debug("Links are protected") return True return False @@ -102,7 +102,7 @@ class ShareLinksBiz(Crypter): def unlock_password_protection(self): password = self.get_password() self.log_debug("Submitting password [%s] for protected links" % password) - post = {"password": password, 'login': 'Submit form'} + post = {'password': password, 'login': 'Submit form'} url = self.base_url + '/' + self.file_id self.html = self.load(url, post=post) @@ -248,11 +248,11 @@ class ShareLinksBiz(Crypter): #: Get jk strlist = list(params[1].decode('base64')) - jk = ''.join(strlist[::-1]) + jk = "".join(strlist[::-1]) #: Get crypted strlist = list(params[2].decode('base64')) - crypted = ''.join(strlist[::-1]) + crypted = "".join(strlist[::-1]) #: Log and return return crypted, jk diff --git a/module/plugins/crypter/TurbobitNetFolder.py b/module/plugins/crypter/TurbobitNetFolder.py index 4d07704fb..76489eebf 100644 --- a/module/plugins/crypter/TurbobitNetFolder.py +++ b/module/plugins/crypter/TurbobitNetFolder.py @@ -27,7 +27,7 @@ class TurbobitNetFolder(SimpleCrypter): def _get_links(self, id, page=1): gridFile = self.load("http://turbobit.net/downloadfolder/gridFile", - get={"rootId": id, "rows": 200, "page": page}) + get={'rootId': id, 'rows': 200, 'page': page}) grid = json_loads(gridFile) if grid['rows']: diff --git a/module/plugins/crypter/YoutubeComFolder.py b/module/plugins/crypter/YoutubeComFolder.py index b68630f44..4d941f2b9 100644 --- a/module/plugins/crypter/YoutubeComFolder.py +++ b/module/plugins/crypter/YoutubeComFolder.py @@ -29,36 +29,36 @@ class YoutubeComFolder(Crypter): def api_response(self, ref, req): - req.update({"key": self.API_KEY}) + req.update({'key': self.API_KEY}) url = urlparse.urljoin("https://www.googleapis.com/youtube/v3/", ref) html = self.load(url, get=req) return json_loads(html) def get_channel(self, user): - channels = self.api_response("channels", {"part": "id,snippet,contentDetails", "forUsername": user, "maxResults": "50"}) + channels = self.api_response("channels", {'part': "id,snippet,contentDetails", 'forUsername': user, 'maxResults': "50"}) if channels['items']: channel = channels['items'][0] - return {"id": channel['id'], - "title": channel['snippet']['title'], - "relatedPlaylists": channel['contentDetails']['relatedPlaylists'], - "user": user} #: One lone channel for user? + return {'id': channel['id'], + 'title': channel['snippet']['title'], + 'relatedPlaylists': channel['contentDetails']['relatedPlaylists'], + 'user': user} #: One lone channel for user? def get_playlist(self, p_id): - playlists = self.api_response("playlists", {"part": "snippet", "id": p_id}) + playlists = self.api_response("playlists", {'part': "snippet", 'id': p_id}) if playlists['items']: playlist = playlists['items'][0] - return {"id": p_id, - "title": playlist['snippet']['title'], - "channelId": playlist['snippet']['channelId'], - "channelTitle": playlist['snippet']['channelTitle']} + return {'id': p_id, + 'title': playlist['snippet']['title'], + 'channelId': playlist['snippet']['channelId'], + 'channelTitle': playlist['snippet']['channelTitle']} def _get_playlists(self, id, token=None): - req = {"part": "id", "maxResults": "50", "channelId": id} + req = {'part': "id", 'maxResults': "50", 'channelId': id} if token: - req.update({"pageToken": token}) + req.update({'pageToken': token}) playlists = self.api_response("playlists", req) @@ -75,9 +75,9 @@ class YoutubeComFolder(Crypter): def _get_videos_id(self, id, token=None): - req = {"part": "contentDetails", "maxResults": "50", "playlistId": id} + req = {'part': "contentDetails", 'maxResults': "50", 'playlistId': id} if token: - req.update({"pageToken": token}) + req.update({'pageToken': token}) playlist = self.api_response("playlistItems", req) diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 2607ac5ad..8a47da5bd 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -48,7 +48,7 @@ class BypassCaptcha(Hook): def get_credits(self): - res = self.load(self.GETCREDITS_URL, post={"key": self.get_config('passkey')}) + res = self.load(self.GETCREDITS_URL, post={'key': self.get_config('passkey')}) data = dict(x.split(' ', 1) for x in res.splitlines()) return int(data['Left']) @@ -83,8 +83,8 @@ class BypassCaptcha(Hook): def respond(self, ticket, success): try: - res = self.load(self.RESPOND_URL, post={"task_id": ticket, "key": self.get_config('passkey'), - "cv": 1 if success else 0}) + res = self.load(self.RESPOND_URL, post={'task_id': ticket, 'key': self.get_config('passkey'), + 'cv': 1 if success else 0}) except BadHeader, e: self.log_error(_("Could not send response"), e) diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 1265fc0ae..1660e2059 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -55,7 +55,7 @@ class CaptchaBrotherhood(Hook): def get_credits(self): res = self.load(self.API_URL + "askCredits.aspx", - get={"username": self.get_config('username'), "password": self.get_config('password')}) + get={'username': self.get_config('username'), 'password': self.get_config('password')}) if not res.startswith("OK"): raise CaptchaBrotherhoodException(res) else: @@ -118,9 +118,9 @@ class CaptchaBrotherhood(Hook): def api_response(self, api, ticket): res = self.load("%s%s.aspx" % (self.API_URL, api), - get={"username": self.get_config('username'), - "password": self.get_config('password'), - "captchaID": ticket}) + get={'username': self.get_config('username'), + 'password': self.get_config('password'), + 'captchaID': ticket}) if not res.startswith("OK"): raise CaptchaBrotherhoodException("Unknown response: %s" % res) diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 681816a0f..29263a180 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -80,8 +80,8 @@ class Checksum(Addon): """ Compute checksum for the downloaded file and compare it with the hash provided by the hoster. pyfile.plugin.check_data should be a dictionary which can contain: - a) if known, the exact filesize in bytes (e.g. "size": 123456789) - b) hexadecimal hash string with algorithm name as key (e.g. "md5": "d76505d0869f9f928a17d42d66326307") + a) if known, the exact filesize in bytes (e.g. 'size': 123456789) + b) hexadecimal hash string with algorithm name as key (e.g. 'md5': "d76505d0869f9f928a17d42d66326307") """ if hasattr(pyfile.plugin, "check_data") and isinstance(pyfile.plugin.check_data, dict): data = pyfile.plugin.check_data.copy() diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 6727107ca..699243ddc 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -73,8 +73,8 @@ class DeathByCaptcha(Hook): if post: if not isinstance(post, dict): post = {} - post.update({"username": self.get_config('username'), - "password": self.get_config('password')}) + post.update({'username': self.get_config('username'), + 'password': self.get_config('password')}) res = None try: @@ -138,7 +138,7 @@ class DeathByCaptcha(Hook): data = f.read() data = "base64:" + b64encode(data) - res = self.api_response("captcha", {"captchafile": data}, multipart) + res = self.api_response("captcha", {'captchafile': data}, multipart) if "captcha" not in res: raise DeathByCaptchaException(res) diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index baf880644..ac1b223df 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -30,7 +30,7 @@ class ExpertDecoders(Hook): def get_credits(self): - res = self.load(self.API_URL, post={"key": self.get_config('passkey'), "action": "balance"}) + res = self.load(self.API_URL, post={'key': self.get_config('passkey'), 'action': "balance"}) if res.isdigit(): self.log_info(_("%s credits left") % res) diff --git a/module/plugins/hooks/FreeWayMeHook.py b/module/plugins/hooks/FreeWayMeHook.py index 48af011d4..a55b6bb93 100644 --- a/module/plugins/hooks/FreeWayMeHook.py +++ b/module/plugins/hooks/FreeWayMeHook.py @@ -20,5 +20,5 @@ class FreeWayMeHook(MultiHook): def get_hosters(self): 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 + 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/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index e31435e96..732340e3e 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -62,7 +62,7 @@ class IRCInterface(Thread, Addon): try: if self.get_config('info_file'): self.response( - _("Download finished: %(name)s @ %(plugin)s ") % {"name": pyfile.name, "plugin": pyfile.pluginname}) + _("Download finished: %(name)s @ %(plugin)s ") % {'name': pyfile.name, 'plugin': pyfile.pluginname}) except Exception: pass @@ -73,7 +73,7 @@ class IRCInterface(Thread, Addon): task.setWaiting(60) html = self.load("http://www.freeimagehosting.net/upload.php", - post={"attached": (pycurl.FORM_FILE, task.captchaFile)}) + post={'attached': (pycurl.FORM_FILE, task.captchaFile)}) url = re.search(r"\[img\]([^\[]+)\[/img\]\[/url\]", html).group(1) self.response(_("New Captcha Request: %s") % url) @@ -136,10 +136,10 @@ class IRCInterface(Thread, Addon): continue msg = { - "origin": msg[0][1:], - "action": msg[1], - "target": msg[2], - "text": msg[3][1:] + 'origin': msg[0][1:], + 'action': msg[1], + 'target': msg[2], + 'text': msg[3][1:] } self.handle_events(msg) diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 2e4cae903..9687819a3 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -86,7 +86,7 @@ class ImageTyperz(Hook): res = self.load(self.SUBMIT_URL, post={'action': "UPLOADCAPTCHA", 'username': self.get_config('username'), - 'password': self.get_config('password'), "file": data}, + 'password': self.get_config('password'), 'file': data}, multipart=multipart, req=req) finally: diff --git a/module/plugins/hooks/SmoozedComHook.py b/module/plugins/hooks/SmoozedComHook.py index 2d4fb564e..733fd642a 100644 --- a/module/plugins/hooks/SmoozedComHook.py +++ b/module/plugins/hooks/SmoozedComHook.py @@ -20,4 +20,4 @@ class SmoozedComHook(MultiHook): def get_hosters(self): user, data = self.account.select_account() - return self.account.get_account_info(user)["hosters"] + return self.account.get_account_info(user)['hosters'] diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index 4262d3034..5eee3b872 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -77,7 +77,7 @@ class XMPPInterface(IRCInterface, JabberClient): try: if self.get_config('info_file'): self.announce( - _("Download finished: %(name)s @ %(plugin)s") % {"name": pyfile.name, "plugin": pyfile.pluginname}) + _("Download finished: %(name)s @ %(plugin)s") % {'name': pyfile.name, 'plugin': pyfile.pluginname}) except Exception: pass diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index d312cf277..13fa6fbec 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -74,7 +74,7 @@ class BitshareCom(SimpleHoster): #: This may either download our file or forward us to an error page self.link = self.get_download_url() - if self.check_download({"error": ">Error occured<"}): + if self.check_download({'error': ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") @@ -88,7 +88,7 @@ class BitshareCom(SimpleHoster): #: Get download info self.log_debug("Getting download info") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "generateID", "ajaxid": self.ajaxid}) + post={'request': "generateID", 'ajaxid': self.ajaxid}) self.handle_errors(res, ':') @@ -117,17 +117,17 @@ class BitshareCom(SimpleHoster): for i in xrange(3): response, challenge = recaptcha.challenge() res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request" : "validateCaptcha", - "ajaxid" : self.ajaxid, - "recaptcha_challenge_field": challenge, - "recaptcha_response_field" : response}) + post={'request' : "validateCaptcha", + 'ajaxid' : self.ajaxid, + 'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response}) if self.handle_captcha_errors(res): break #: Get download URL self.log_debug("Getting download url") res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html", - post={"request": "getDownloadURL", "ajaxid": self.ajaxid}) + post={'request': "getDownloadURL", 'ajaxid': self.ajaxid}) self.handle_errors(res, '#') diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index 5250af2c3..590dc1b38 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -57,7 +57,7 @@ class CrockoCom(SimpleHoster): inputs['recaptcha_response_field'], inputs['recaptcha_challenge_field'] = recaptcha.challenge() self.download(action, post=inputs) - if self.check_download({"captcha": recaptcha.KEY_AJAX_PATTERN}): + if self.check_download({'captcha': recaptcha.KEY_AJAX_PATTERN}): self.invalid_captcha() else: break diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 49857ed84..4a20c5f8e 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -138,9 +138,9 @@ class CzshareCom(SimpleHoster): #: Check download check = self.check_download({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), - "credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), + 'credit' : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi-dl" : re.compile(self.MULTIDL_PATTERN), - "captcha" : "<li>Zadaný ověřovací kód nesouhlasí!</li>" + 'captcha' : "<li>Zadaný ověřovací kód nesouhlasí!</li>" }) if check == "temp offline": diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index f549bbd79..925eeb265 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -12,7 +12,7 @@ def get_info(urls): result = [] regex = re.compile(DailymotionCom.__pattern__) apiurl = "https://api.dailymotion.com/video/%s" - request = {"fields": "access_error,status,title"} + request = {'fields': "access_error,status,title"} for url in urls: id = regex.match(url).group('ID') diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index d3b25d2ad..2c00a5d55 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -25,7 +25,7 @@ class DataportCz(SimpleHoster): def handle_free(self, pyfile): - captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} + captchas = {'1': "jkeG", '2': "hMJQ", '3': "vmEK", '4': "ePQM", '5': "blBd"} for _i in xrange(60): action, inputs = self.parse_html_form('free_download_form') @@ -40,8 +40,8 @@ class DataportCz(SimpleHoster): self.download("http://www.dataport.cz%s" % action, post=inputs) - check = self.check_download({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', - "slot" : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) + check = self.check_download({'captcha': 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', + 'slot' : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": self.error(_("invalid captcha")) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 7db72b383..ef64bed32 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -112,7 +112,7 @@ class DlFreeFr(SimpleHoster): def get_last_headers(self): #: Parse header - header = {"code": self.req.code} + header = {'code': self.req.code} for line in self.req.http.header.splitlines(): line = line.strip() if not line or ":" not in line: diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index 100c6d269..c29231a7b 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -45,7 +45,7 @@ class EdiskCz(SimpleHoster): self.html = self.load(re.sub("/en/download/", "/en/download-slow/", url)) url = self.load(re.sub("/en/download/", "/x-download/", url), post={ - "action": action + 'action': action }) if not re.match(self.LINK_FREE_PATTERN, url): diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 4401391a9..b17322e6a 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -36,8 +36,8 @@ class EuroshareEu(SimpleHoster): self.link = pyfile.url.rstrip('/') + "/download/" - check = self.check_download({"login": re.compile(self.ERROR_PATTERN), - "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + check = self.check_download({'login': re.compile(self.ERROR_PATTERN), + 'json' : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) if check == "login" or (check == "json" and self.last_check.group(1) == "Access token expired"): self.account.relogin(self.user) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index c2ae32099..5e282c7ac 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -50,7 +50,7 @@ class ExtabitCom(SimpleHoster): captcha_key = m.group(1) for _i in xrange(5): - get_data = {"type": "recaptcha"} + get_data = {'type': "recaptcha"} get_data['capture'], get_data['challenge'] = recaptcha.challenge(captcha_key) res = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) if "ok" in res: diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index f92d82269..2e5843d37 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -45,7 +45,7 @@ class FilecloudIo(SimpleHoster): def handle_free(self, pyfile): - data = {"ukey": self.info['pattern']['ID']} + data = {'ukey': self.info['pattern']['ID']} m = re.search(self.AB1_PATTERN, self.html) if m is None: @@ -61,8 +61,8 @@ class FilecloudIo(SimpleHoster): self.error(_("ReCaptcha key not found")) response, challenge = recaptcha.challenge(captcha_key) - self.account.form_data = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field" : response} + self.account.form_data = {'recaptcha_challenge_field': challenge, + 'recaptcha_response_field' : response} self.account.relogin(self.user) self.retry(2) @@ -102,7 +102,7 @@ class FilecloudIo(SimpleHoster): self.error(_("LINK_FREE_PATTERN not found")) if "size" in self.info and self.info['size']: - self.check_data = {"size": int(self.info['size'])} + self.check_data = {'size': int(self.info['size'])} self.link = m.group(1) else: @@ -114,7 +114,7 @@ class FilecloudIo(SimpleHoster): 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", - post={"akey": akey, "ukey": ukey}) + post={'akey': akey, 'ukey': ukey}) self.log_debug("FetchDownloadUrl: " + rep) rep = json_loads(rep) if rep['status'] == 'ok': diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 3731fad43..2ed75e7e4 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -48,7 +48,7 @@ class FilepostCom(SimpleHoster): if wait_time > 0: self.wait(wait_time) - post_dict = {"token": flp_token, "code": self.info['pattern']['ID'], "file_pass": ''} + post_dict = {'token': flp_token, 'code': self.info['pattern']['ID'], 'file_pass': ''} if 'var is_pass_exists = true;' in self.html: #: Solve password diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index dfd4372a5..76462d321 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -102,7 +102,7 @@ class FilesMailRu(Hoster): #: so i set it to check every download because sometimes there are downloads #: that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file #: (Loading 100MB in to ram is not an option) - check = self.check_download({"html": "<meta name="}, read_size=50000) + check = self.check_download({'html': "<meta name="}, read_size=50000) if check == "html": self.log_info(_( "There was HTML Code in the Downloaded File (%s)...redirect error? The Download will be restarted." % diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index fd50bd265..0b6b693b1 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize as parse_size def check_file(plugin, urls): - html = get_url(plugin.URLS[1], post={"urls": "\n".join(urls)}) + html = get_url(plugin.URLS[1], post={'urls': "\n".join(urls)}) file_info = [] for li in re.finditer(plugin.LINKCHECK_TR, html, re.S): @@ -81,13 +81,13 @@ class FileserveCom(Hoster): def handle_free(self): self.html = self.load(self.url) - action = self.load(self.url, post={"checkDownload": "check"}) + action = self.load(self.url, post={'checkDownload': "check"}) action = json_loads(action) self.log_debug(action) if "fail" in action: if action['fail'] == "timeLimit": - self.html = self.load(self.url, post={"checkDownload": "showError", "errorType": "timeLimit"}) + self.html = self.load(self.url, post={'checkDownload': "showError", 'errorType': "timeLimit"}) self.do_long_wait(re.search(self.LONG_WAIT_PATTERN, self.html)) @@ -109,18 +109,18 @@ class FileserveCom(Hoster): self.error(_("Unknown server response")) #: Show download link - res = self.load(self.url, post={"downloadLink": "show"}) + res = self.load(self.url, post={'downloadLink': "show"}) self.log_debug("Show downloadLink response: %s" % res) if "fail" in res: self.error(_("Couldn't retrieve download url")) #: This may either download our file or forward us to an error page - self.download(self.url, post={"download": "normal"}) + self.download(self.url, post={'download': "normal"}) self.log_debug(self.req.http.lastEffectiveURL) - check = self.check_download({"expired": self.LINK_EXPIRED_PATTERN, - "wait" : re.compile(self.LONG_WAIT_PATTERN), - "limit" : self.DL_LIMIT_PATTERN}) + check = self.check_download({'expired': self.LINK_EXPIRED_PATTERN, + 'wait' : re.compile(self.LONG_WAIT_PATTERN), + 'limit' : self.DL_LIMIT_PATTERN}) if check == "expired": self.log_debug("Download link was expired") @@ -138,7 +138,7 @@ class FileserveCom(Hoster): def do_timmer(self): - res = self.load(self.url, post={"downloadLink": "wait"}) + res = self.load(self.url, post={'downloadLink': "wait"}) self.log_debug("Wait response: %s" % res[:80]) if "fail" in res: @@ -185,9 +185,9 @@ class FileserveCom(Hoster): if self.__name__ == "FileserveCom": #: Try api download res = self.load("http://app.fileserve.com/api/download/premium/", - post={"username": self.user, - "password": self.account.get_account_data(self.user)['password'], - "shorten": self.file_id}) + post={'username': self.user, + 'password': self.account.get_account_data(self.user)['password'], + 'shorten': self.file_id}) if res: res = json_loads(res) if res['error_code'] == "302": @@ -203,7 +203,7 @@ class FileserveCom(Hoster): self.download(premium_url or self.pyfile.url) - if not premium_url and self.check_download({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}): + if not premium_url and self.check_download({'login': re.compile(self.NOT_LOGGED_IN_PATTERN)}): self.account.relogin(self.user) self.retry(reason=_("Not logged in")) diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py index ed46833a5..f756caa9c 100644 --- a/module/plugins/hoster/FlyFilesNet.py +++ b/module/plugins/hoster/FlyFilesNet.py @@ -31,7 +31,7 @@ class FlyFilesNet(SimpleHoster): url = "http://flyfiles.net" #: Get download URL - parsed_url = self.load(url, post={"getDownLink": session}) + parsed_url = self.load(url, post={'getDownLink': session}) self.log_debug("Parsed URL: %s" % parsed_url) if parsed_url == '#downlink|' or parsed_url == "#downlink|#": diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index f5092eceb..1a5b179b8 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -43,11 +43,11 @@ class FreakshareCom(Hoster): self.download(pyfile.url, post=self.req_opts) - check = self.check_download({"bad" : "bad try", - "paralell" : "> Sorry, you cant download more then 1 files at time. <", - "empty" : "Warning: Unknown: Filename cannot be empty", - "wrong_captcha" : "Wrong Captcha!", - "downloadserver": "No Downloadserver. Please try again later!"}) + check = self.check_download({'bad' : "bad try", + 'paralell' : "> Sorry, you cant download more then 1 files at time. <", + 'empty' : "Warning: Unknown: Filename cannot be empty", + 'wrong_captcha' : "Wrong Captcha!", + 'downloadserver': "No Downloadserver. Please try again later!"}) if check == "bad": self.fail(_("Bad Try")) @@ -86,7 +86,7 @@ class FreakshareCom(Hoster): def download_html(self): - self.load("http://freakshare.com/index.php", {"language": "EN"}) #: Set english language in server session + self.load("http://freakshare.com/index.php", {'language': "EN"}) #: Set english language in server session self.html = self.load(self.pyfile.url) diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index bfa30358e..78b0416b6 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -40,9 +40,9 @@ class GigapetaCom(SimpleHoster): captcha = self.decrypt_captcha(captcha_url) self.html = self.load(pyfile.url, post={ - "captcha_key": captcha_key, - "captcha": captcha, - "download": "Download"}) + 'captcha_key': captcha_key, + 'captcha': captcha, + 'download': "Download"}) m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I) if m: diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index 1da6d7d3c..ea3d4b161 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -29,7 +29,7 @@ class JumbofilesCom(SimpleHoster): def handle_free(self, pyfile): - post_data = {"id": self.info['pattern']['ID'], "op": "download3", "rand": ""} + post_data = {'id': self.info['pattern']['ID'], 'op': "download3", 'rand': ""} html = self.load(self.pyfile.url, post=post_data) self.link = re.search(self.LINK_FREE_PATTERN, html).group(1) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 061311bab..8e912bcb8 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -16,7 +16,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, seconds_to_midnig def api_response(url): - json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] + json_data = ["yw7XQy2v9", ["download/info", {'link': url}]] api_rep = get_url("http://api.letitbit.net/json", post={'r': json_dumps(json_data)}) return json_loads(api_rep) @@ -88,9 +88,9 @@ class LetitbitNet(SimpleHoster): recaptcha = ReCaptcha(self) response, challenge = recaptcha.challenge() - post_data = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field": response, - "recaptcha_control_field": recaptcha_control_field} + post_data = {'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response, + 'recaptcha_control_field': recaptcha_control_field} self.log_debug("Post data to send", post_data) @@ -125,7 +125,7 @@ class LetitbitNet(SimpleHoster): api_key = self.user premium_key = self.account.get_account_data(self.user)['password'] - json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] + 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)}) self.log_debug("API Data: " + api_rep) api_rep = json_loads(api_rep) diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index 9a2726448..66cceda5f 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -190,7 +190,7 @@ class MegaCoNz(Hoster): pattern = re.match(self.__pattern__, pyfile.url).groupdict() id = pattern['ID'] key = pattern['KEY'] - public = pattern['TYPE'] == '' + public = pattern['TYPE'] == "" self.log_debug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node")) diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 1f6ed4334..09bcd8200 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -37,7 +37,7 @@ class MultishareCz(SimpleHoster): def handle_multi(self, pyfile): - self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": pyfile.url}) + self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={'link': pyfile.url}) self.check_info() diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 3c3b0d124..53171c837 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -40,7 +40,7 @@ class NarodRu(SimpleHoster): if m is None: self.error(_("Captcha")) - post_data = {"action": "sendcapcha"} + post_data = {'action': "sendcapcha"} captcha_url, post_data['key'] = m.groups() post_data['rep'] = self.decrypt_captcha(captcha_url) diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 307f34d66..3756ef81f 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -42,7 +42,7 @@ class OboomCom(Hoster): if not self.premium: self.solve_captcha() self.get_download_ticket() - self.download("https://%s/1.0/dlh" % self.download_domain, get={"ticket": self.download_ticket, "http_errors": 0}) + self.download("https://%s/1.0/dlh" % self.download_domain, get={'ticket': self.download_ticket, 'http_errors': 0}) def load_url(self, url, get=None): @@ -77,10 +77,10 @@ class OboomCom(Hoster): for _i in xrange(5): response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) apiUrl = "https://www.oboom.com/1.0/download/ticket" - params = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field": response, - "download_id": self.file_id, - "token": self.session_token} + params = {'recaptcha_challenge_field': challenge, + 'recaptcha_response_field': response, + 'download_id': self.file_id, + 'token': self.session_token} result = self.load_url(apiUrl, params) if result[0] == 200: @@ -112,7 +112,7 @@ class OboomCom(Hoster): def getFileInfo(self, token, fileId): apiUrl = "https://api.oboom.com/1.0/info" - params = {"token": token, "items": fileId, "http_errors": 0} + params = {'token': token, 'items': fileId, 'http_errors': 0} result = self.load_url(apiUrl, params) if result[0] == 200: @@ -128,7 +128,7 @@ class OboomCom(Hoster): def get_download_ticket(self): apiUrl = "https://api.oboom.com/1/dl" - params = {"item": self.file_id, "http_errors": 0} + params = {'item': self.file_id, 'http_errors': 0} if self.premium: params['token'] = self.session_token else: diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index f16fde1e0..34c442443 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -40,7 +40,7 @@ class PremiumTo(MultiHoster): if self.check_download({'nopremium': "No premium account available"}): self.retry(60, 5 * 60, "No premium account available") - err = '' + err = "" if self.req.http.code == '420': #: Custom error code send - fail file = fs_encode(self.last_download) diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 2d36f45a9..3af8c42de 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -49,7 +49,7 @@ class QuickshareCz(SimpleHoster): else: self.handle_free(pyfile) - if self.check_download({"error": re.compile(r"\AChyba!")}, max_size=100): + if self.check_download({'error': re.compile(r"\AChyba!")}, max_size=100): self.fail(_("File not m or plugin defect")) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index b6e54a560..352d3147a 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -29,10 +29,10 @@ class RPNetBiz(MultiHoster): #: Get the download link res = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, - "password": data['password'], - "action" : "generate", - "links" : pyfile.url}) + get={'username': user, + 'password': data['password'], + 'action' : "generate", + 'links' : pyfile.url}) self.log_debug("JSON data: %s" % res) link_status = json_loads(res)['links'][0] #: Get the first link... since we only queried one @@ -48,10 +48,10 @@ class RPNetBiz(MultiHoster): while (my_try <= max_tries): self.log_debug("Try: %d ; Max Tries: %d" % (my_try, max_tries)) res = self.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, - "password": data['password'], - "action": "downloadInformation", - "id": link_status['id']}) + get={'username': user, + 'password': data['password'], + 'action' : "downloadInformation", + 'id' : link_status['id']}) self.log_debug("JSON data hdd query: %s" % res) download_status = json_loads(res)['download'] diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index 9301f1e93..b0ae534a7 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -41,7 +41,7 @@ class SimplydebridCom(MultiHoster): def check_file(self): - if self.check_download({"error": "No address associated with hostname"}): + if self.check_download({'error': "No address associated with hostname"}): self.retry(24, 3 * 60, _("Bad file downloaded")) return super(SimplydebridCom, self).checkFile() diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 3841a78fe..48d7fbcd2 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -97,7 +97,7 @@ class UlozTo(SimpleHoster): self.html = self.load(pyfile.url, get={'do': "askAgeForm-submit"}, - post={"agree": "Confirm", "_token_": m.group(1)}) + post={'agree': "Confirm", '_token_': m.group(1)}) if self.PASSWD_PATTERN in self.html: password = self.get_password() @@ -106,7 +106,7 @@ class UlozTo(SimpleHoster): self.log_info(_("Password protected link, trying ") + password) self.html = self.load(pyfile.url, get={'do': "passwordProtectedForm-submit"}, - post={"password": password, "password_send": 'Send'}) + post={'password': password, 'password_send': 'Send'}) if self.PASSWD_PATTERN in self.html: self.fail(_("Incorrect password")) @@ -121,11 +121,11 @@ class UlozTo(SimpleHoster): def check_file(self): check = self.check_download({ - "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), - "offline" : re.compile(self.OFFLINE_PATTERN), - "passwd" : self.PASSWD_PATTERN, - "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: Paralell dl, server overload etc. - "not_found" : "<title>Ulož.to</title>" + 'wrong_captcha': re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), + 'offline' : re.compile(self.OFFLINE_PATTERN), + 'passwd' : self.PASSWD_PATTERN, + 'server_error' : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: Paralell dl, server overload etc. + 'not_found' : "<title>Ulož.to</title>" }) if check == "wrong_captcha": diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index c49db225b..ad6283433 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -63,10 +63,10 @@ class UloziskoSk(SimpleHoster): self.log_debug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) self.download(parsed_url, - post={"antispam": captcha, - "id" : id, - "name" : pyfile.name, - "but" : "++++STIAHNI+S%DABOR++++"}) + post={'antispam': captcha, + 'id' : id, + 'name' : pyfile.name, + 'but' : "++++STIAHNI+S%DABOR++++"}) getInfo = create_getInfo(UloziskoSk) diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index 6f589efa3..fa16aa194 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -41,7 +41,7 @@ class UploadableCh(SimpleHoster): #: Make the recaptcha appear and show it the pyload interface b = self.load(pyfile.url, post={'checkDownload': "check"}) - self.log_debug(b) #: Expected output: {"success":"showCaptcha"} + self.log_debug(b) #: Expected output: {'success': "showCaptcha"} recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index d04664a8f..be139f354 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -45,7 +45,7 @@ class UploadedTo(SimpleHoster): for _i in xrange(5): html = get_url("http://uploaded.net/api/filemultiple", - get={"apikey": cls.API_KEY, 'id_0': re.match(cls.__pattern__, url).group('ID')}) + get={'apikey': cls.API_KEY, 'id_0': re.match(cls.__pattern__, url).group('ID')}) if html != "can't find request": api = html.split(",", 4) diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index de83b42fc..e586cbb53 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -46,7 +46,7 @@ class UploadheroCom(SimpleHoster): captcha = self.decrypt_captcha(urlparse.urljoin("http://uploadhero.co", m.group(1))) self.html = self.load(pyfile.url, - get={"code": captcha}) + get={'code': captcha}) m = re.search(self.LINK_FREE_PATTERN, self.html) if m: diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 8a32832a0..e73120383 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -36,10 +36,10 @@ class WrzucTo(SimpleHoster): self.req.http.c.setopt(pycurl.HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) self.req.http.lastURL = pyfile.url - self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']}) + self.load("http://www.wrzuc.to/ajax/server/prepair", post={'md5': data['md5']}) self.req.http.lastURL = pyfile.url - self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']}) + self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={'file': data['file']}) data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html)) if len(data) != 4: diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index 1e3bcc215..4a947da1b 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -143,10 +143,10 @@ class Xdcc(Hoster): continue msg = { - "origin": msg[0][1:], - "action": msg[1], - "target": msg[2], - "text": msg[3][1:] + 'origin': msg[0][1:], + 'action': msg[1], + 'target': msg[2], + 'text': msg[3][1:] } if nick == msg['target'][0:len(nick)] and "PRIVMSG" == msg['action']: @@ -195,7 +195,7 @@ class Xdcc(Hoster): self.pyfile.setStatus("downloading") newname = self.req.download(ip, port, filename, sock, self.pyfile.setProgress) if newname and newname != filename: - self.log_info(_("%(name)s saved as %(newname)s") % {"name": self.pyfile.name, "newname": newname}) + self.log_info(_("%(name)s saved as %(newname)s") % {'name': self.pyfile.name, 'newname': newname}) filename = newname #: kill IRC socket diff --git a/module/plugins/hoster/YoupornCom.py b/module/plugins/hoster/YoupornCom.py index 959ee83a5..af113f658 100644 --- a/module/plugins/hoster/YoupornCom.py +++ b/module/plugins/hoster/YoupornCom.py @@ -29,7 +29,7 @@ class YoupornCom(Hoster): def download_html(self): url = self.pyfile.url - self.html = self.load(url, post={"user_choice": "Enter"}, cookies=False) + self.html = self.load(url, post={'user_choice': "Enter"}, cookies=False) def get_file_url(self): diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 330fe8063..cbd44de21 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -98,11 +98,11 @@ class YoutubeCom(Hoster): use3d = self.get_config('3d') if use3d: - quality = {"sd": 82, "hd": 84, "fullhd": 85, "240p": 83, "360p": 82, - "480p": 82, "720p": 84, "1080p": 85, "3072p": 85} + quality = {'sd': 82, 'hd': 84, 'fullhd': 85, '240p': 83, '360p': 82, + '480p': 82, '720p': 84, '1080p': 85, '3072p': 85} else: - quality = {"sd": 18, "hd": 22, "fullhd": 37, "240p": 5, "360p": 18, - "480p": 35, "720p": 22, "1080p": 37, "3072p": 38} + quality = {'sd': 18, 'hd': 22, 'fullhd': 37, '240p': 5, '360p': 18, + '480p': 35, '720p': 22, '1080p': 37, '3072p': 38} desired_fmt = self.get_config('fmt') diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py index 7bf8964ad..db0002d09 100644 --- a/module/plugins/internal/Account.py +++ b/module/plugins/internal/Account.py @@ -69,14 +69,14 @@ class Account(Plugin): except WrongPassword: self.log_warning( - _("Could not login with account %(user)s | %(msg)s") % {"user": user, - "msg": _("Wrong Password")}) + _("Could not login with account %(user)s | %(msg)s") % {'user': user, + 'msg': _("Wrong Password")}) success = data['valid'] = False except Exception, e: self.log_warning( - _("Could not login with account %(user)s | %(msg)s") % {"user": user, - "msg": e}) + _("Could not login with account %(user)s | %(msg)s") % {'user': user, + 'msg': e}) success = data['valid'] = False if self.core.debug: traceback.print_exc() @@ -126,7 +126,7 @@ class Account(Plugin): self.accounts[user]['options'].update(options) return self.accounts[user]['options'] != before else: - self.accounts[user] = {"password": password, "options": options, "valid": True} + self.accounts[user] = {'password': password, 'options': options, 'valid': True} self._login(user, self.accounts[user]) return True @@ -211,16 +211,16 @@ class Account(Plugin): :param req: `Request` instance :return: """ - return {"validuntil" : None, #: -1 for unlimited - "login" : name, - # "password" : self.accounts[name]['password'], #: Commented due security reason - "options" : self.accounts[name]['options'], - "valid" : self.accounts[name]['valid'], - "trafficleft": None, #: In bytes, -1 for unlimited - "maxtraffic" : None, - "premium" : None, - "timestamp" : 0, #: Time this info was retrieved - "type" : self.__name__} + return {'validuntil' : None, #: -1 for unlimited + 'login' : name, + # 'password' : self.accounts[name]['password'], #: Commented due security reason + 'options' : self.accounts[name]['options'], + 'valid' : self.accounts[name]['valid'], + 'trafficleft': None, #: In bytes, -1 for unlimited + 'maxtraffic' : None, + 'premium' : None, + 'timestamp' : 0, #: Time this info was retrieved + 'type' : self.__name__} def get_all_accounts(self, force=False): @@ -306,7 +306,7 @@ class Account(Plugin): if user in self.infos: self.log_warning(_("Account %s has not enough traffic, checking again in 30min") % user) - self.infos[user].update({"trafficleft": 0}) + self.infos[user].update({'trafficleft': 0}) self.schedule_refresh(user, 30 * 60) @@ -314,7 +314,7 @@ class Account(Plugin): if user in self.infos: self.log_warning(_("Account %s is expired, checking again in 1h") % user) - self.infos[user].update({"validuntil": time.time() - 1}) + self.infos[user].update({'validuntil': time.time() - 1}) self.schedule_refresh(user, 60 * 60) diff --git a/module/plugins/internal/AdYouLike.py b/module/plugins/internal/AdYouLike.py index 64ce6e7fa..10f281494 100644 --- a/module/plugins/internal/AdYouLike.py +++ b/module/plugins/internal/AdYouLike.py @@ -37,8 +37,8 @@ class AdYouLike(Captcha): def challenge(self, key=None, html=None): ayl, callback = key or self.retrieve_key(html) - #: {"adyoulike":{"key":"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"}, - #: "all":{"element_id":"ayl_private_cap_92300","lang":"fr","env":"prod"}} + #: {'adyoulike':{'key':"P~zQ~O0zV0WTiAzC-iw0navWQpCLoYEP"}, + #: 'all':{'element_id':"ayl_private_cap_92300",'lang':"fr",'env':"prod"}} ayl = json_loads(ayl) html = self.plugin.load("http://api-ayl.appspot.com/challenge", @@ -58,14 +58,14 @@ class AdYouLike(Captcha): def result(self, server, challenge): #: Adyoulike.g._jsonp_5579316662423138 - #: ({"translations":{"fr":{"instructions_visual":"Recopiez « Soonnight » ci-dessous :"}}, - #: "site_under":true,"clickable":true,"pixels":{"VIDEO_050":[],"DISPLAY":[],"VIDEO_000":[],"VIDEO_100":[], - #: "VIDEO_025":[],"VIDEO_075":[]},"medium_type":"image/adyoulike", - #: "iframes":{"big":"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\" - #: height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},"shares":{},"id":256, - #: "token":"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1","formats":{"small":{"y":300,"x":0,"w":300,"h":60}, - #: "big":{"y":0,"x":0,"w":300,"h":250},"hover":{"y":440,"x":0,"w":300,"h":60}}, - #: "tid":"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"}) + #: ({'translations':{'fr':{'instructions_visual':"Recopiez « Soonnight » ci-dessous :"}}, + #: 'site_under':true,'clickable':true,'pixels':{'VIDEO_050':[],'DISPLAY':[],'VIDEO_000':[],'VIDEO_100':[], + #: 'VIDEO_025':[],'VIDEO_075':[]},'medium_type':"image/adyoulike", + #: 'iframes':{'big':"<iframe src=\"http://www.soonnight.com/campagn.html\" scrolling=\"no\" + #: height=\"250\" width=\"300\" frameborder=\"0\"></iframe>"},'shares':{},'id':256, + #: 'token':"e6QuI4aRSnbIZJg02IsV6cp4JQ9~MjA1",'formats':{'small':{'y':300,'x':0,'w':300,'h':60}, + #: 'big':{'y':0,'x':0,'w':300,'h':250},'hover':{'y':440,'x':0,'w':300,'h':60}}, + #: 'tid':"SqwuAdxT1EZoi4B5q0T63LN2AkiCJBg5"}) if isinstance(server, basestring): server = json_loads(server) diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py index dbecb0cf8..9ad16ece8 100644 --- a/module/plugins/internal/Crypter.py +++ b/module/plugins/internal/Crypter.py @@ -80,22 +80,22 @@ class Crypter(Hoster): pid = self.core.api.addPackage(name, self.fixurl(links), package_queue) if package_password: - self.core.api.setPackageData(pid, {"password": package_password}) + self.core.api.setPackageData(pid, {'password': package_password}) #: Workaround to do not break API addPackage method - setFolder = lambda x: self.core.api.setPackageData(pid, {"folder": x or ""}) + setFolder = lambda x: self.core.api.setPackageData(pid, {'folder': x or ""}) if use_subfolder: if not subfolder_per_package: setFolder(package_folder) - self.log_debug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder}) + self.log_debug("Set package %(name)s folder to: %(folder)s" % {'name': name, 'folder': folder}) elif not folder_per_package or name != folder: if not folder: folder = urlparse.urlparse(name).path.split("/")[-1] setFolder(safe_filename(folder)) - self.log_debug("Set package %(name)s folder to: %(folder)s" % {"name": name, "folder": folder}) + self.log_debug("Set package %(name)s folder to: %(folder)s" % {'name': name, 'folder': folder}) elif folder_per_package: setFolder(None) diff --git a/module/plugins/internal/Extractor.py b/module/plugins/internal/Extractor.py index 929ef5378..39220508e 100644 --- a/module/plugins/internal/Extractor.py +++ b/module/plugins/internal/Extractor.py @@ -67,7 +67,7 @@ class Extractor(Plugin): for fname, id, fout in files_ids: if cls.isArchive(fname): - pname = re.sub(cls.re_multipart, '', fname) if cls.isMultipart(fname) else os.path.splitext(fname)[0] + pname = re.sub(cls.re_multipart, "", fname) if cls.isMultipart(fname) else os.path.splitext(fname)[0] if pname not in processed: processed.append(pname) targets.append((fname, id, fout)) diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py index e7df336b6..497df00f3 100644 --- a/module/plugins/internal/Hoster.py +++ b/module/plugins/internal/Hoster.py @@ -488,7 +488,7 @@ class Hoster(Plugin): newname = urlparse.urlparse(newname).path.split('/')[-1] if disposition and newname != name: - self.log_info(_("%(name)s saved as %(newname)s") % {"name": name, "newname": newname}) + self.log_info(_("%(name)s saved as %(newname)s") % {'name': name, 'newname': newname}) self.pyfile.name = newname filename = os.path.join(location, newname) @@ -595,7 +595,7 @@ class Hoster(Plugin): req.close() - header = {"code": req.code} + header = {'code': req.code} for line in res.splitlines(): line = line.strip() if not line or ":" not in line: diff --git a/module/plugins/internal/OCR.py b/module/plugins/internal/OCR.py index 387db1d13..a00f53947 100644 --- a/module/plugins/internal/OCR.py +++ b/module/plugins/internal/OCR.py @@ -42,7 +42,7 @@ class OCR(Plugin): def load_image(self, image): self.image = Image.open(image) self.pixels = self.image.load() - self.result_captcha = '' + self.result_captcha = "" def deactivate(self): diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py index d0f75a8a3..7dec6344e 100644 --- a/module/plugins/internal/Plugin.py +++ b/module/plugins/internal/Plugin.py @@ -123,6 +123,14 @@ class Plugin(object): def __init__(self, core): self.core = core self.info = {} #: Provide information in dict here + self.init() + + + def init(self): + """ + Initialize the plugin (in addition to `__init__`) + """ + pass def _log(self, level, args): @@ -309,7 +317,7 @@ class Plugin(object): if just_header: #: Parse header - header = {"code": req.code} + header = {'code': req.code} for line in res.splitlines(): line = line.strip() if not line or ":" not in line: diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 911a7d411..40489d404 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -361,7 +361,7 @@ class SimpleHoster(Hoster): if re.search('da(il)?y|today', errmsg, re.I): wait_time = seconds_to_midnight(gmt=2) else: - wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in + wait_time = sum(int(v) * {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, "": 1}[u.lower()] for v, u in re.findall(r'(\d+)\s*(hr|hour|min|sec|)', errmsg, re.I)) self.want_reconnect = wait_time > 300 @@ -385,7 +385,7 @@ class SimpleHoster(Hoster): if re.search("da(il)?y|today", errmsg): wait_time = seconds_to_midnight(gmt=2) else: - wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in + wait_time = sum(int(v) * {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, "": 1}[u.lower()] for v, u in re.findall(r'(\d+)\s*(hr|hour|min|sec|)', errmsg, re.I)) self.want_reconnect = wait_time > 300 @@ -430,7 +430,7 @@ class SimpleHoster(Hoster): except Exception: waitmsg = m.group(0).strip() - wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in + wait_time = sum(int(v) * {'hr': 3600, 'hour': 3600, 'min': 60, 'sec': 1, "": 1}[u.lower()] for v, u in re.findall(r'(\d+)\s*(hr|hour|min|sec|)', waitmsg, re.I)) self.wait(wait_time, wait_time > 300) |