diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-07-14 16:10:01 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-07-15 16:26:07 +0200 |
commit | 7b8c458cca7d21a029620f98e453f746fce69cd1 (patch) | |
tree | 9e97b0003a00ff8ac9ee6b777d94bb998c911d05 /module/plugins | |
parent | Fix code indentation, some bad whitespaces and missing authors + use 'not' in... (diff) | |
download | pyload-7b8c458cca7d21a029620f98e453f746fce69cd1.tar.xz |
Prefer single quote for dict key name
Diffstat (limited to 'module/plugins')
115 files changed, 436 insertions, 440 deletions
diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index 80441066f..39e613c1a 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -106,7 +106,7 @@ class AccountManager(): elif line.startswith("@"): try: option = line[1:].split() - self.accounts[plugin][name]["options"][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) + self.accounts[plugin][name]['options'][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) except: pass @@ -126,9 +126,9 @@ class AccountManager(): f.write(plugin+":\n") for name,data in accounts.iteritems(): - f.write("\n\t%s:%s\n" % (name,data["password"]) ) - if data["options"]: - for option, values in data["options"].iteritems(): + f.write("\n\t%s:%s\n" % (name,data['password']) ) + if data['options']: + for option, values in data['options'].iteritems(): f.write("\t@%s %s\n" % (option, " ".join(values))) f.close() diff --git a/module/plugins/Container.py b/module/plugins/Container.py index 8dc0581af..ed201e2e4 100644 --- a/module/plugins/Container.py +++ b/module/plugins/Container.py @@ -55,7 +55,7 @@ class Container(Crypter): if self.pyfile.url.startswith("http"): self.pyfile.name = re.findall("([^\/=]+)", self.pyfile.url)[-1] content = self.load(self.pyfile.url) - self.pyfile.url = join(self.config["general"]["download_folder"], self.pyfile.name) + self.pyfile.url = join(self.config['general']['download_folder'], self.pyfile.name) f = open(self.pyfile.url, "wb" ) f.write(content) f.close() diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 584fcce49..8722496b5 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -207,8 +207,8 @@ class Plugin(Base): def getChunkCount(self): if self.chunkLimit <= 0: - return self.config["download"]["chunks"] - return min(self.config["download"]["chunks"], self.chunkLimit) + return self.config['download']['chunks'] + return min(self.config['download']['chunks'], self.chunkLimit) def __call__(self): return self.__name__ @@ -478,12 +478,12 @@ class Plugin(Base): location = save_join(download_folder, self.pyfile.package().folder) if not exists(location): - makedirs(location, int(self.core.config["permission"]["folder"], 8)) + makedirs(location, int(self.core.config['permission']['folder'], 8)) - if self.core.config["permission"]["change_dl"] and os.name != "nt": + if self.core.config['permission']['change_dl'] and os.name != "nt": try: - uid = getpwnam(self.config["permission"]["user"])[2] - gid = getgrnam(self.config["permission"]["group"])[2] + uid = getpwnam(self.config['permission']['user'])[2] + gid = getgrnam(self.config['permission']['group'])[2] chown(location, uid, gid) except Exception, e: @@ -511,13 +511,13 @@ class Plugin(Base): fs_filename = fs_encode(filename) - if self.core.config["permission"]["change_file"]: - chmod(fs_filename, int(self.core.config["permission"]["file"], 8)) + if self.core.config['permission']['change_file']: + chmod(fs_filename, int(self.core.config['permission']['file'], 8)) - if self.core.config["permission"]["change_dl"] and os.name != "nt": + if self.core.config['permission']['change_dl'] and os.name != "nt": try: - uid = getpwnam(self.config["permission"]["user"])[2] - gid = getgrnam(self.config["permission"]["group"])[2] + uid = getpwnam(self.config['permission']['user'])[2] + gid = getgrnam(self.config['permission']['group'])[2] chown(fs_filename, uid, gid) except Exception, e: diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index acfb6874a..ee0a2ff28 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -33,7 +33,7 @@ class AlldebridCom(Account): except: data = self.getAccountData(user) page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, - data["password"])) + data['password'])) self.logDebug(page) xml = dom.parseString(page) exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 @@ -41,7 +41,7 @@ class AlldebridCom(Account): return account_info def login(self, user, data, req): - urlparams = urllib.urlencode({'action': 'login', 'login_login': user, 'login_password': data["password"]}) + urlparams = urllib.urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) if "This login doesn't exist" in page: diff --git a/module/plugins/accounts/BayfilesCom.py b/module/plugins/accounts/BayfilesCom.py index 3f3086347..8f11af2ef 100644 --- a/module/plugins/accounts/BayfilesCom.py +++ b/module/plugins/accounts/BayfilesCom.py @@ -33,17 +33,17 @@ class BayfilesCom(Account): for _ in xrange(2): response = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) self.logDebug(response) - if not response["error"]: + if not response['error']: break - self.logWarning(response["error"]) + self.logWarning(response['error']) self.relogin(user) return {"premium": bool(response['premium']), "trafficleft": -1, "validuntil": response['expires'] if response['expires'] >= int(time()) else -1} def login(self, user, data, req): - response = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data["password"]))) + response = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data['password']))) self.logDebug(response) - if response["error"]: - self.logError(response["error"]) + if response['error']: + self.logError(response['error']) self.wrongPassword() diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index e6999df03..09ff76efb 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -39,6 +39,6 @@ class BitshareCom(Account): def login(self, user, data, req): page = req.load("http://bitshare.com/login.html", - post={"user": user, "password": data["password"], "submit": "Login"}, cookies=True) + post={"user": user, "password": data['password'], "submit": "Login"}, cookies=True) if "login" in req.lastEffectiveURL: self.wrongPassword() diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 4a664b29e..3545baa7e 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -46,7 +46,7 @@ class CzshareCom(Account): def login(self, user, data, req): html = req.load('https://sdilej.cz/index.php', post={ "Prihlasit": "Prihlasit", - "login-password": data["password"], + "login-password": data['password'], "login-name": user }) diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index dd714102f..29aef4546 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -43,6 +43,6 @@ class DebridItaliaCom(Account): def login(self, user, data, req): self.html = req.load("http://debriditalia.com/login.php", - get={"u": user, "p": data["password"]}) + get={"u": user, "p": data['password']}) if 'NO' in self.html: self.wrongPassword() diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index 95a9cc852..2b46807e8 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -40,6 +40,6 @@ class DepositfilesCom(Account): def login(self, user, data, req): req.load("http://depositfiles.com/de/gold/payment.php") src = req.load("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"}, - post={"login": user, "password": data["password"]}) + post={"login": user, "password": data['password']}) if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in src: self.wrongPassword() diff --git a/module/plugins/accounts/EgoFilesCom.py b/module/plugins/accounts/EgoFilesCom.py index e5c781068..9cb157516 100644 --- a/module/plugins/accounts/EgoFilesCom.py +++ b/module/plugins/accounts/EgoFilesCom.py @@ -37,6 +37,6 @@ class EgoFilesCom(Account): html = req.load("http://egofiles.com/ajax/register.php", post={"log": 1, "loginV": user, - "passV": data["password"]}) + "passV": data['password']}) if 'Login successful' not in html: self.wrongPassword() diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index 93c193625..779e2227c 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -47,7 +47,7 @@ class EuroshareEu(Account): html = req.load('http://euroshare.eu/customer-zone/login/', post={ "trvale": "1", "login": user, - "password": data["password"] + "password": data['password'] }, decode=True) if u">Nesprávne prihlasovacie meno alebo heslo" in html: diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index dbfd1f33e..6aec55a84 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -14,7 +14,7 @@ class FastixRu(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://fastix.ru/api_v2/?apikey=%s&sub=getaccountdetails" % (data["api"])) + page = req.load("http://fastix.ru/api_v2/?apikey=%s&sub=getaccountdetails" % (data['api'])) page = json_loads(page) points = page['points'] kb = float(points) @@ -26,9 +26,9 @@ class FastixRu(Account): return account_info def login(self, user, data, req): - page = req.load("http://fastix.ru/api_v2/?sub=get_apikey&email=%s&password=%s" % (user, data["password"])) + page = req.load("http://fastix.ru/api_v2/?sub=get_apikey&email=%s&password=%s" % (user, data['password'])) api = json_loads(page) api = api['apikey'] - data["api"] = api + data['api'] = api if "error_code" in page: self.wrongPassword() diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index a45eb3288..17eda5ae3 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -48,7 +48,7 @@ class FilecloudIo(Account): rep = json_loads(rep) if rep['is_premium'] == 1: - return {"validuntil": int(rep["premium_until"]), "trafficleft": -1} + return {"validuntil": int(rep['premium_until']), "trafficleft": -1} else: return {"premium": False} @@ -59,8 +59,8 @@ class FilecloudIo(Account): if not hasattr(self, "form_data"): self.form_data = {} - self.form_data["username"] = user - self.form_data["password"] = data['password'] + self.form_data['username'] = user + self.form_data['password'] = data['password'] html = req.load('https://secure.filecloud.io/user-login_p.html', post=self.form_data, diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 0eded0edf..40626fe1e 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -51,7 +51,7 @@ class FilefactoryCom(Account): html = req.load("http://www.filefactory.com/member/signin.php", post={ "loginEmail": user, - "loginPassword": data["password"], + "loginPassword": data['password'], "Submit": "Sign In"}) if req.lastEffectiveURL != "http://www.filefactory.com/account/": diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index 127894dd7..9ca35537a 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -50,7 +50,7 @@ class FilejungleCom(Account): def login(self, user, data, req): html = req.load(self.URL + "login.php", post={ "loginUserName": user, - "loginUserPassword": data["password"], + "loginUserPassword": data['password'], "loginFormSubmit": "Login", "recaptcha_challenge_field": "", "recaptcha_response_field": "", diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index 28ddf2e3f..747051e94 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -55,7 +55,7 @@ class FilerNet(Account): self.html = req.load("https://filer.net/login") token = re.search(self.TOKEN_PATTERN, self.html).group(1) self.html = req.load("https://filer.net/login_check", - post={"_username": user, "_password": data["password"], + post={"_username": user, "_password": data['password'], "_remember_me": "on", "_csrf_token": token, "_target_path": "https://filer.net/"}) if 'Logout' not in self.html: self.wrongPassword() diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 8028083ec..a8b2b4529 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -32,25 +32,25 @@ class FileserveCom(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data["password"], + page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], "submit": "Submit+Query"}) res = json_loads(page) - if res["type"] == "premium": - validuntil = mktime(strptime(res["expireTime"], "%Y-%m-%d %H:%M:%S")) - return {"trafficleft": res["traffic"], "validuntil": validuntil} + if res['type'] == "premium": + validuntil = mktime(strptime(res['expireTime'], "%Y-%m-%d %H:%M:%S")) + return {"trafficleft": res['traffic'], "validuntil": validuntil} else: return {"premium": False, "trafficleft": None, "validuntil": None} def login(self, user, data, req): - page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data["password"], + page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data['password'], "submit": "Submit+Query"}) res = json_loads(page) - if not res["type"]: + if not res['type']: self.wrongPassword() #login at fileserv page req.load("http://www.fileserve.com/login.php", - post={"loginUserName": user, "loginUserPassword": data["password"], "autoLogin": "checked", + post={"loginUserName": user, "loginUserPassword": data['password'], "autoLogin": "checked", "loginFormSubmit": "Login"}) diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 61dee5dbc..58dfb93fd 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -34,19 +34,19 @@ class FreeWayMe(Account): self.logDebug(status) account_info = {"validuntil": -1, "premium": False} - if status["premium"] == "Free": - account_info["trafficleft"] = int(status["guthaben"]) * 1024 - elif status["premium"] == "Spender": - account_info["trafficleft"] = -1 - elif status["premium"] == "Flatrate": - account_info = {"validuntil": int(status["Flatrate"]), + if status['premium'] == "Free": + account_info['trafficleft'] = int(status['guthaben']) * 1024 + elif status['premium'] == "Spender": + account_info['trafficleft'] = -1 + elif status['premium'] == "Flatrate": + account_info = {"validuntil": int(status['Flatrate']), "trafficleft": -1, "premium": True} return account_info def getpw(self, user): - return self.accounts[user]["password"] + return self.accounts[user]['password'] def login(self, user, data, req): status = self.getAccountStatus(user, req) @@ -57,7 +57,7 @@ class FreeWayMe(Account): def getAccountStatus(self, user, req): answer = req.load("https://www.free-way.me/ajax/jd.php", - get={"id": 4, "user": user, "pass": self.accounts[user]["password"]}) + get={"id": 4, "user": user, "pass": self.accounts[user]['password']}) self.logDebug("login: %s" % answer) if answer == "Invalid login": self.wrongPassword() diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 9b16741fc..5823c09f0 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -78,7 +78,7 @@ class HellshareCz(Account): html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={ "login": "Log in", - "password": data["password"], + "password": data['password'], "username": user, "perm_login": "on" }) diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index f053b7720..fd675b7c6 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -40,12 +40,12 @@ class HotfileCom(Account): info[key] = value if info['is_premium'] == '1': - info["premium_until"] = info["premium_until"].replace("T", " ") - zone = info["premium_until"][19:] - info["premium_until"] = info["premium_until"][:19] + info['premium_until'] = info['premium_until'].replace("T", " ") + zone = info['premium_until'][19:] + info['premium_until'] = info['premium_until'][:19] zone = int(zone[:3]) - validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone * 60 * 60) + validuntil = int(mktime(strptime(info['premium_until'], "%Y-%m-%d %H:%M:%S"))) + (zone * 60 * 60) tmp = {"validuntil": validuntil, "trafficleft": -1, "premium": True} elif info['is_premium'] == '0': @@ -63,7 +63,7 @@ class HotfileCom(Account): digest = req.load("http://api.hotfile.com/", post={"action": "getdigest"}) h = hashlib.md5() - h.update(data["password"]) + h.update(data['password']) hp = h.hexdigest() h = hashlib.md5() h.update(hp) @@ -80,7 +80,7 @@ class HotfileCom(Account): cj = self.getAccountCookies(user) cj.setCookie("hotfile.com", "lang", "en") req.load("http://hotfile.com/", cookies=True) - page = req.load("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data["password"]}, + page = req.load("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data['password']}, cookies=True) if "Bad username/password" in page: diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index e37c860a6..e4601ccbb 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -29,7 +29,7 @@ class LetitbitNet(Account): def loadAccountInfo(self, user, req): ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## # api_key = self.accounts[user]['password'] - # json_data = [api_key, ["key/info"]] + # json_data = [api_key, ['key/info']] # api_rep = req.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) # self.logDebug('API Key Info: ' + api_rep) # api_rep = json_loads(api_rep) diff --git a/module/plugins/accounts/MegaDebridEu.py b/module/plugins/accounts/MegaDebridEu.py index 1fbe00ff7..e5d7deb3c 100644 --- a/module/plugins/accounts/MegaDebridEu.py +++ b/module/plugins/accounts/MegaDebridEu.py @@ -32,18 +32,18 @@ class MegaDebridEu(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) jsonResponse = req.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data["password"]}) + get={'action': 'connectUser', 'login': user, 'password': data['password']}) response = json_loads(jsonResponse) - if response["response_code"] == "ok": - return {"premium": True, "validuntil": float(response["vip_end"]), "status": True} + if response['response_code'] == "ok": + return {"premium": True, "validuntil": float(response['vip_end']), "status": True} else: self.logError(response) return {"status": False, "premium": False} def login(self, user, data, req): jsonResponse = req.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data["password"]}) + get={'action': 'connectUser', 'login': user, 'password': data['password']}) response = json_loads(jsonResponse) - if response["response_code"] != "ok": + if response['response_code'] != "ok": self.wrongPassword() diff --git a/module/plugins/accounts/MultiDebridCom.py b/module/plugins/accounts/MultiDebridCom.py index 704b4ac78..d38247051 100644 --- a/module/plugins/accounts/MultiDebridCom.py +++ b/module/plugins/accounts/MultiDebridCom.py @@ -38,7 +38,7 @@ class MultiDebridCom(Account): def login(self, user, data, req): # Password to use is the API-Password written in http://multi-debrid.com/myaccount self.html = req.load("http://multi-debrid.com/api.php", - get={"user": user, "pass": data["password"]}) + get={"user": user, "pass": data['password']}) self.logDebug('JSON data: ' + self.html) self.json_data = json_loads(self.html) if self.json_data['status'] != 'ok': diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 19fcea67a..b21e793fd 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -16,7 +16,7 @@ class OboomCom(Account): __author_mail__ = "stanley.foerster@gmail.com" def loadAccountData(self, user, req): - passwd = self.getAccountData(user)["password"] + passwd = self.getAccountData(user)['password'] salt = passwd[::-1] pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) result = json_loads(req.load("https://www.oboom.com/1.0/login", get={"auth": user, "pass": pbkdf2})) @@ -27,17 +27,17 @@ class OboomCom(Account): def loadAccountInfo(self, name, req): accountData = self.loadAccountData(name, req) - userData = accountData["user"] + userData = accountData['user'] if "premium_unix" in userData: - validUntilUtc = int(userData["premium_unix"]) + validUntilUtc = int(userData['premium_unix']) if validUntilUtc > int(time.time()): premium = True validUntil = validUntilUtc - traffic = userData["traffic"] - trafficLeft = traffic["current"] - maxTraffic = traffic["max"] - session = accountData["session"] + traffic = userData['traffic'] + trafficLeft = traffic['current'] + maxTraffic = traffic['max'] + session = accountData['session'] return {"premium": premium, "validuntil": validUntil, "trafficleft": trafficLeft / 1024, diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index 7c14f8191..22cbd51d3 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -40,7 +40,7 @@ class OneFichierCom(Account): html = req.load("http://1fichier.com/login.pl?lg=en", post={ "mail": user, - "pass": data["password"], + "pass": data['password'], "Login": "Login"}) if r'<div class="error_message">Invalid username or password.</div>' in html: diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index eab20480f..7c57fc88c 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -14,20 +14,20 @@ class OverLoadMe(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data["password"]}).strip() + page = req.load("https://api.over-load.me/account.php", get={"user": user, "auth": data['password']}).strip() data = json_loads(page) # Check for premium - if data["membership"] == "Free": + if data['membership'] == "Free": return {"premium": False} - account_info = {"validuntil": data["expirationunix"], "trafficleft": -1} + account_info = {"validuntil": data['expirationunix'], "trafficleft": -1} return account_info def login(self, user, data, req): jsondata = req.load("https://api.over-load.me/account.php", - get={"user": user, "auth": data["password"]}).strip() + get={"user": user, "auth": data['password']}).strip() data = json_loads(jsondata) - if data["err"] == 1: + if data['err'] == 1: self.wrongPassword() diff --git a/module/plugins/accounts/Premium4Me.py b/module/plugins/accounts/Premium4Me.py index c80f40f5c..0da442da6 100644 --- a/module/plugins/accounts/Premium4Me.py +++ b/module/plugins/accounts/Premium4Me.py @@ -21,7 +21,7 @@ class Premium4Me(Account): def login(self, user, data, req): self.authcode = req.load("http://premium.to/api/getauthcode.php?username=%s&password=%s" % ( - user, data["password"])).strip() + user, data['password'])).strip() if "wrong username" in self.authcode: self.wrongPassword() diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py index 0676a7d5b..d537a2f23 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -30,7 +30,7 @@ class RapidshareCom(Account): data = self.getAccountData(user) api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user, - "password": data["password"], "withcookie": 1} + "password": data['password'], "withcookie": 1} src = req.load(api_url_base, cookies=False, get=api_param_prem) if src.startswith("ERROR"): raise Exception(src) @@ -42,7 +42,7 @@ class RapidshareCom(Account): k, v = t.split("=") info[k] = v - validuntil = int(info["billeduntil"]) + validuntil = int(info['billeduntil']) premium = True if validuntil else False tmp = {"premium": premium, "validuntil": validuntil, "trafficleft": -1, "maxtraffic": -1} @@ -52,7 +52,7 @@ class RapidshareCom(Account): def login(self, user, data, req): api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" api_param_prem = {"sub": "getaccountdetails", "type": "prem", "login": user, - "password": data["password"], "withcookie": 1} + "password": data['password'], "withcookie": 1} src = req.load(api_url_base, cookies=False, get=api_param_prem) if src.startswith("ERROR"): raise Exception(src + "### Note you have to use your account number for login, instead of name.") @@ -64,4 +64,4 @@ class RapidshareCom(Account): k, v = t.split("=") info[k] = v cj = self.getAccountCookies(user) - cj.setCookie("rapidshare.com", "enc", info["cookie"]) + cj.setCookie("rapidshare.com", "enc", info['cookie']) diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 86ad18085..75666f2fd 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -25,7 +25,7 @@ class RealdebridCom(Account): def login(self, user, data, req): self.pin_code = False - page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data["password"]}) + page = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data['password']}) if "Your login informations are incorrect" in page: self.wrongPassword() elif "PIN Code required" in page: diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index c4aa85484..5578cab7b 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -13,7 +13,7 @@ class RehostTo(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data["password"])) + page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data['password'])) data = [x.split("=") for x in page.split(",")] ses = data[0][1] long_ses = data[1][1] @@ -29,7 +29,7 @@ class RehostTo(Account): return account_info def login(self, user, data, req): - page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data["password"])) + page = req.load("http://rehost.to/api.php?cmd=login&user=%s&pass=%s" % (user, data['password'])) if "Login failed." in page: self.wrongPassword() diff --git a/module/plugins/accounts/RyushareCom.py b/module/plugins/accounts/RyushareCom.py index 6a15c4c82..a57e5fcec 100644 --- a/module/plugins/accounts/RyushareCom.py +++ b/module/plugins/accounts/RyushareCom.py @@ -16,6 +16,6 @@ class RyushareCom(XFSPAccount): def login(self, user, data, req): req.lastURL = "http://ryushare.com/login.python" html = req.load("http://ryushare.com/login.python", - post={"login": user, "password": data["password"], "op": "login"}) + post={"login": user, "password": data['password'], "op": "login"}) if 'Incorrect Login or Password' in html or '>Error<' in html: self.wrongPassword() diff --git a/module/plugins/accounts/ShareRapidCom.py b/module/plugins/accounts/ShareRapidCom.py index 38150e5cf..11cef84e3 100644 --- a/module/plugins/accounts/ShareRapidCom.py +++ b/module/plugins/accounts/ShareRapidCom.py @@ -21,7 +21,7 @@ class ShareRapidCom(Account): found = re.search(ur'<td>Max. poÄet paralelnÃch stahovánÃ: </td><td>(\d+)', src) if found: data = self.getAccountData(user) - data["options"]["limitDL"] = [int(found.group(1))] + data['options']['limitDL'] = [int(found.group(1))] found = re.search(ur'<td>Paušálnà stahovánà aktivnÃ. VyprÅ¡Ã </td><td><strong>(.*?)</strong>', src) if found: @@ -44,6 +44,6 @@ class ShareRapidCom(Account): htm = req.load("http://sharerapid.cz/prihlaseni/", post={"hash": hashes, "login": user, - "pass1": data["password"], + "pass1": data['password'], "remember": 0, "sbmt": u"PÅihlásit"}, cookies=True) diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 37ca373e4..f8c9f4fe0 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -28,7 +28,7 @@ class ShareonlineBiz(Account): def getUserAPI(self, user, req): return req.load("http://api.share-online.biz/account.php", - {"username": user, "password": self.accounts[user]["password"], "act": "userDetails"}) + {"username": user, "password": self.accounts[user]['password'], "act": "userDetails"}) def loadAccountInfo(self, user, req): src = self.getUserAPI(user, req) @@ -40,14 +40,14 @@ class ShareonlineBiz(Account): info[key] = value self.logDebug(info) - if "dl" in info and info["dl"].lower() != "not_available": - req.cj.setCookie("share-online.biz", "dl", info["dl"]) - if "a" in info and info["a"].lower() != "not_available": - req.cj.setCookie("share-online.biz", "a", info["a"]) + if "dl" in info and info['dl'].lower() != "not_available": + req.cj.setCookie("share-online.biz", "dl", info['dl']) + if "a" in info and info['a'].lower() != "not_available": + req.cj.setCookie("share-online.biz", "a", info['a']) - return {"validuntil": int(info["expire_date"]) if "expire_date" in info else -1, + return {"validuntil": int(info['expire_date']) if "expire_date" in info else -1, "trafficleft": -1, - "premium": True if ("dl" in info or "a" in info) and (info["group"] != "Sammler") else False} + "premium": True if ("dl" in info or "a" in info) and (info['group'] != "Sammler") else False} def login(self, user, data, req): src = self.getUserAPI(user, req) diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 6ae8396db..5706bb5cd 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -49,7 +49,7 @@ class SimplyPremiumCom(Account): if data['password'] == '' or data['password'] == '0': post_data = {"key": user} else: - post_data = {"login_name": user, "login_pass": data["password"]} + post_data = {"login_name": user, "login_pass": data['password']} self.html = req.load("http://www.simply-premium.com/login.php", post=post_data) diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index c07702105..edd52b67e 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -24,7 +24,7 @@ class SimplydebridCom(Account): def login(self, user, data, req): self.loginname = user - self.password = data["password"] + self.password = data['password'] get_data = {'login': 1, 'u': self.loginname, 'p': self.password} response = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) if response != "02: loggin success": diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py index 9ea119502..c72745833 100644 --- a/module/plugins/accounts/StahnuTo.py +++ b/module/plugins/accounts/StahnuTo.py @@ -41,7 +41,7 @@ class StahnuTo(Account): def login(self, user, data, req): html = req.load("http://www.stahnu.to/login.php", post={ "username": user, - "password": data["password"], + "password": data['password'], "submit": "Login"}) if not '<a href="logout.php">' in html: diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index 9453b7fe0..956978cf3 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -48,7 +48,7 @@ class TurbobitNet(Account): html = req.load("http://turbobit.net/user/login", post={ "user[login]": user, - "user[pass]": data["password"], + "user[pass]": data['password'], "user[submit]": "Login"}) if not '<div class="menu-item user-name">' in html: diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py index 2b647a49c..afc2f2a18 100644 --- a/module/plugins/accounts/UnrestrictLi.py +++ b/module/plugins/accounts/UnrestrictLi.py @@ -47,7 +47,7 @@ class UnrestrictLi(Account): self.logError("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry") return - post_data = {"username": user, "password": data["password"], + post_data = {"username": user, "password": data['password'], "remember_me": "remember", "signin": "Sign in"} self.html = req.load("https://unrestrict.li/sign_in", post=post_data) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index d5c04564d..382b01052 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -60,7 +60,7 @@ class UploadedTo(Account): req.load("http://uploaded.net/language/en") req.cj.setCookie("uploaded.net", "lang", "en") - page = req.load("http://uploaded.net/io/login", post={"id": user, "pw": data["password"], "_": ""}) + page = req.load("http://uploaded.net/io/login", post={"id": user, "pw": data['password'], "_": ""}) if "User and password do not match!" in page: self.wrongPassword() diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index 8adcff4ac..0cec8ca6d 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -32,7 +32,7 @@ class UploadheroCom(Account): def login(self, user, data, req): page = req.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 page: self.wrongPassword() diff --git a/module/plugins/accounts/UploadingCom.py b/module/plugins/accounts/UploadingCom.py index 98a5fcbc5..c9f5a9ede 100644 --- a/module/plugins/accounts/UploadingCom.py +++ b/module/plugins/accounts/UploadingCom.py @@ -50,4 +50,4 @@ class UploadingCom(Account): req.cj.setCookie("uploading.com", "_lang", "en") req.load("http://uploading.com/") req.load("http://uploading.com/general/login_form/?JsHttpRequest=%s-xml" % long(time() * 1000), - post={"email": user, "password": data["password"], "remember": "on"}) + post={"email": user, "password": data['password'], "remember": "on"}) diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 1eb90801a..74383ec22 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -27,7 +27,7 @@ class ZeveraCom(Account): def login(self, user, data, req): self.loginname = user - self.password = data["password"] + self.password = data['password'] if self.getAPIData(req) == "No traffic": self.wrongPassword() diff --git a/module/plugins/captcha/captcha.py b/module/plugins/captcha/captcha.py index 48f4a4217..a4667b4ed 100644 --- a/module/plugins/captcha/captcha.py +++ b/module/plugins/captcha/captcha.py @@ -84,7 +84,7 @@ class OCR(object): if os.name == "nt": tessparams = [join(pypath,"tesseract","tesseract.exe")] else: - tessparams = ['tesseract'] + tessparams = ["tesseract"] tessparams.extend( [abspath(tmp.name), abspath(tmpTxt.name).replace(".txt", "")] ) diff --git a/module/plugins/crypter/DailymotionBatch.py b/module/plugins/crypter/DailymotionBatch.py index e13f267f4..d9309af90 100644 --- a/module/plugins/crypter/DailymotionBatch.py +++ b/module/plugins/crypter/DailymotionBatch.py @@ -45,8 +45,8 @@ class DailymotionBatch(Crypter): if "error" in playlist: return - name = playlist["name"] - owner = playlist["owner.screenname"] + name = playlist['name'] + owner = playlist['owner.screenname'] return name, owner def _getPlaylists(self, user_id, page=1): @@ -57,10 +57,10 @@ class DailymotionBatch(Crypter): if "error" in user: return - for playlist in user["list"]: - yield playlist["id"] + for playlist in user['list']: + yield playlist['id'] - if user["has_more"]: + if user['has_more']: for item in self._getPlaylists(user_id, page + 1): yield item @@ -75,10 +75,10 @@ class DailymotionBatch(Crypter): if "error" in playlist: return - for video in playlist["list"]: - yield video["url"] + for video in playlist['list']: + yield video['url'] - if playlist["has_more"]: + if playlist['has_more']: for item in self._getVideos(id, page + 1): yield item diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index f9214f0c8..5ef8eab21 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -53,14 +53,14 @@ class DlProtectCom(SimpleCrypter): post_req.update({"i": b64time, "submitform": "Decrypt+link"}) if ">Password :" in self.html: - post_req["pwd"] = self.getPassword() + post_req['pwd'] = self.getPassword() if ">Security Code" in self.html: captcha_id = re.search(r'/captcha\.php\?uid=(.+?)"', self.html).group(1) captcha_url = "http://www.dl-protect.com/captcha.php?uid=" + captcha_id captcha_code = self.decryptCaptcha(captcha_url, imgtype="gif") - post_req["secure"] = captcha_code + post_req['secure'] = captcha_code self.html = self.load(self.pyfile.url, post=post_req) diff --git a/module/plugins/crypter/DuckCryptInfo.py b/module/plugins/crypter/DuckCryptInfo.py index 4cd3ec197..bbf6e6b0d 100644 --- a/module/plugins/crypter/DuckCryptInfo.py +++ b/module/plugins/crypter/DuckCryptInfo.py @@ -49,7 +49,7 @@ class DuckCryptInfo(Crypter): def handleLink(self, url): src = self.load(url) soup = BeautifulSoup(src) - link = soup.find("iframe")["src"] + link = soup.find("iframe")['src'] if not link: self.logDebug('no links found - (Plugin out of date?)') else: diff --git a/module/plugins/crypter/HoerbuchIn.py b/module/plugins/crypter/HoerbuchIn.py index c6773b3f0..06a15fc65 100644 --- a/module/plugins/crypter/HoerbuchIn.py +++ b/module/plugins/crypter/HoerbuchIn.py @@ -28,7 +28,7 @@ class HoerbuchIn(Crypter): 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.decryptFolder(a["href"]) + links = self.decryptFolder(a['href']) self.packages.append((package, links, pyfile.package().folder)) else: diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py index e4497eb09..5fde4e958 100644 --- a/module/plugins/crypter/LinkSaveIn.py +++ b/module/plugins/crypter/LinkSaveIn.py @@ -34,7 +34,7 @@ class LinkSaveIn(Crypter): self.fileid = None self.captcha = False self.package = None - self.preferred_sources = ['cnl2', 'rsdf', 'ccf', 'dlc', 'web'] + self.preferred_sources = ["cnl2", "rsdf", "ccf", "dlc", "web"] def decrypt(self, pyfile): # Init diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py index cadf2760f..ec6533ffc 100644 --- a/module/plugins/crypter/NCryptIn.py +++ b/module/plugins/crypter/NCryptIn.py @@ -28,7 +28,7 @@ class NCryptIn(Crypter): self.package = None self.html = None self.cleanedHtml = None - self.links_source_order = ['cnl2', 'rsdf', 'ccf', 'dlc', 'web'] + self.links_source_order = ["cnl2", "rsdf", "ccf", "dlc", "web"] self.protection_type = None def decrypt(self, pyfile): diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py index f5c158d2e..1187692a0 100644 --- a/module/plugins/crypter/RelinkUs.py +++ b/module/plugins/crypter/RelinkUs.py @@ -19,7 +19,7 @@ class RelinkUs(Crypter): __author_mail__ = "fragonib[AT]yahoo[DOT]es" # Constants - PREFERRED_LINK_SOURCES = ['cnl2', 'dlc', 'web'] + PREFERRED_LINK_SOURCES = ["cnl2", "dlc", "web"] OFFLINE_TOKEN = r'<title>Tattooside' PASSWORD_TOKEN = r'container_password\.php' @@ -197,7 +197,7 @@ class RelinkUs(Crypter): try: dlc = self.load(container_url) dlc_filename = self.fileid + ".dlc" - dlc_filepath = os.path.join(self.config["general"]["download_folder"], dlc_filename) + dlc_filepath = os.path.join(self.config['general']['download_folder'], dlc_filename) f = open(dlc_filepath, "wb") f.write(dlc) f.close() diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index cb2617168..022f3e5ff 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -40,7 +40,7 @@ class SafelinkingNet(Crypter): if "link-password" in self.html: password = pyfile.package().password - postData["link-password"] = password + postData['link-password'] = password if "altcaptcha" in self.html: for _ in xrange(5): @@ -53,8 +53,8 @@ class SafelinkingNet(Crypter): self.fail("Error parsing captcha") challenge, response = captcha.challenge(captchaKey) - postData["adcopy_challenge"] = challenge - postData["adcopy_response"] = response + postData['adcopy_challenge'] = challenge + postData['adcopy_response'] = response self.html = self.load(url, post=postData) if "The password you entered was incorrect" in self.html: @@ -72,9 +72,9 @@ class SafelinkingNet(Crypter): if m: linkDict = json_loads(m.group(1)) for link in linkDict: - if not "http://" in link["full"]: - packageLinks.append("https://safelinking.net/d/" + link["full"]) + if not "http://" in link['full']: + packageLinks.append("https://safelinking.net/d/" + link['full']) else: - packageLinks.append(link["full"]) + packageLinks.append(link['full']) self.core.files.addLinks(packageLinks, pyfile.package().id) diff --git a/module/plugins/crypter/SerienjunkiesOrg.py b/module/plugins/crypter/SerienjunkiesOrg.py index 6fbbfedb3..ecca56209 100644 --- a/module/plugins/crypter/SerienjunkiesOrg.py +++ b/module/plugins/crypter/SerienjunkiesOrg.py @@ -51,9 +51,9 @@ class SerienjunkiesOrg(Crypter): package_links = [] for a in nav.findAll("a"): if self.getConfig("changeNameSJ") == "Show": - package_links.append(a["href"]) + package_links.append(a['href']) else: - package_links.append(a["href"] + "#hasName") + package_links.append(a['href'] + "#hasName") if self.getConfig("changeNameSJ") == "Show": self.packages.append((packageName, package_links, packageName)) else: @@ -85,32 +85,32 @@ class SerienjunkiesOrg(Crypter): opts[n.strip()] = val.strip() gid += 1 groups[gid] = {} - groups[gid]["ep"] = {} - groups[gid]["opts"] = opts + groups[gid]['ep'] = {} + groups[gid]['opts'] = opts elif re.search("<strong>Download:", str(p)): parts = str(p).split("<br />") if re.search("<strong>", parts[0]): ename = re.search('<strong>(.*?)</strong>', parts[0]).group(1).strip().decode("utf-8").replace( "–", "-") - groups[gid]["ep"][ename] = {} + groups[gid]['ep'][ename] = {} parts.remove(parts[0]) for part in parts: hostername = re.search(r" \| ([-a-zA-Z0-9]+\.\w+)", part) if hostername: hostername = hostername.group(1) - groups[gid]["ep"][ename][hostername] = [] + groups[gid]['ep'][ename][hostername] = [] links = re.findall('href="(.*?)"', part) for link in links: - groups[gid]["ep"][ename][hostername].append(link + "#hasName") + groups[gid]['ep'][ename][hostername].append(link + "#hasName") links = [] for g in groups.values(): - for ename in g["ep"]: - links.extend(self.getpreferred(g["ep"][ename])) + for ename in g['ep']: + links.extend(self.getpreferred(g['ep'][ename])) if self.getConfig("changeNameSJ") == "Episode": self.packages.append((ename, links, ename)) links = [] - package = "%s (%s, %s)" % (seasonName, g["opts"]["Format"], g["opts"]["Sprache"]) + package = "%s (%s, %s)" % (seasonName, g['opts']['Format'], g['opts']['Sprache']) if self.getConfig("changeNameSJ") == "Format": self.packages.append((package, links, package)) links = [] @@ -135,12 +135,12 @@ class SerienjunkiesOrg(Crypter): sleep(5) self.retry() - captchaUrl = "http://download.serienjunkies.org" + captchaTag["src"] + captchaUrl = "http://download.serienjunkies.org" + captchaTag['src'] result = self.decryptCaptcha(str(captchaUrl), imgtype="png") sinp = form.find(attrs={"name": "s"}) self.req.lastURL = str(url) - sj = self.load(str(url), post={'s': sinp["value"], 'c': result, 'action': "Download"}) + sj = self.load(str(url), post={'s': sinp['value'], 'c': result, 'action': "Download"}) soup = BeautifulSoup(sj) rawLinks = soup.findAll(attrs={"action": re.compile("^http://download.serienjunkies.org/")}) @@ -154,7 +154,7 @@ class SerienjunkiesOrg(Crypter): links = [] for link in rawLinks: - frameUrl = link["action"].replace("/go-", "/frame/go-") + frameUrl = link['action'].replace("/go-", "/frame/go-") links.append(self.handleFrame(frameUrl)) if re.search("#hasName", url) or ((self.getConfig("changeNameSJ") == "Packagename") and (self.getConfig("changeNameDJ") == "Packagename")): @@ -171,12 +171,12 @@ class SerienjunkiesOrg(Crypter): soup = BeautifulSoup(sj) form = soup.find("form", attrs={"action": re.compile("^http://serienjunkies.org")}) captchaTag = form.find(attrs={"src": re.compile("^/safe/secure/")}) - captchaUrl = "http://serienjunkies.org" + captchaTag["src"] + captchaUrl = "http://serienjunkies.org" + captchaTag['src'] result = self.decryptCaptcha(str(captchaUrl)) - url = form["action"] + url = form['action'] sinp = form.find(attrs={"name": "s"}) - self.req.load(str(url), post={'s': sinp["value"], 'c': result, 'dl.start': "Download"}, cookies=False, + self.req.load(str(url), post={'s': sinp['value'], 'c': result, 'dl.start': "Download"}, cookies=False, just_header=True) decrypted = self.req.lastEffectiveURL if decrypted == str(url): @@ -215,32 +215,32 @@ class SerienjunkiesOrg(Crypter): opts[n.strip()] = val.strip() gid += 1 groups[gid] = {} - groups[gid]["ep"] = {} - groups[gid]["opts"] = opts + groups[gid]['ep'] = {} + groups[gid]['opts'] = opts elif re.search("<strong>Download:", str(p)): parts = str(p).split("<br />") if re.search("<strong>", parts[0]): ename = re.search('<strong>(.*?)</strong>', parts[0]).group(1).strip().decode("utf-8").replace( "–", "-") - groups[gid]["ep"][ename] = {} + groups[gid]['ep'][ename] = {} parts.remove(parts[0]) for part in parts: hostername = re.search(r" \| ([-a-zA-Z0-9]+\.\w+)", part) if hostername: hostername = hostername.group(1) - groups[gid]["ep"][ename][hostername] = [] + groups[gid]['ep'][ename][hostername] = [] links = re.findall('href="(.*?)"', part) for link in links: - groups[gid]["ep"][ename][hostername].append(link + "#hasName") + groups[gid]['ep'][ename][hostername].append(link + "#hasName") links = [] for g in groups.values(): - for ename in g["ep"]: - links.extend(self.getpreferred(g["ep"][ename])) + for ename in g['ep']: + links.extend(self.getpreferred(g['ep'][ename])) if self.getConfig("changeNameDJ") == "Episode": self.packages.append((ename, links, ename)) links = [] - package = "%s (%s, %s)" % (seasonName, g["opts"]["Format"], g["opts"]["Sprache"]) + package = "%s (%s, %s)" % (seasonName, g['opts']['Format'], g['opts']['Sprache']) if self.getConfig("changeNameDJ") == "Format": self.packages.append((package, links, package)) links = [] @@ -255,7 +255,7 @@ class SerienjunkiesOrg(Crypter): soup = BeautifulSoup(src) content = soup.find("div", attrs={"id": "content"}) for a in content.findAll("a", attrs={"rel": "bookmark"}): - package_links.append(a["href"]) + package_links.append(a['href']) self.core.files.addLinks(package_links, self.pyfile.package().id) def decrypt(self, pyfile): diff --git a/module/plugins/crypter/TurbobitNetFolder.py b/module/plugins/crypter/TurbobitNetFolder.py index d9e63b4ce..2dcd65757 100644 --- a/module/plugins/crypter/TurbobitNetFolder.py +++ b/module/plugins/crypter/TurbobitNetFolder.py @@ -36,9 +36,9 @@ class TurbobitNetFolder(SimpleCrypter): get={"rootId": id, "rows": 200, "page": page}, decode=True) grid = json_loads(gridFile) - if grid["rows"]: - for i in grid["rows"]: - yield i["id"] + if grid['rows']: + for i in grid['rows']: + yield i['id'] for id in self._getLinks(id, page + 1): yield id else: diff --git a/module/plugins/crypter/YoutubeBatch.py b/module/plugins/crypter/YoutubeBatch.py index 1af9475eb..dd5d937d5 100644 --- a/module/plugins/crypter/YoutubeBatch.py +++ b/module/plugins/crypter/YoutubeBatch.py @@ -45,21 +45,21 @@ class YoutubeBatch(Crypter): def getChannel(self, user): 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"], + 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? def getPlaylist(self, p_id): playlists = self.api_response("playlists", {"part": "snippet", "id": p_id}) - if playlists["items"]: - playlist = playlists["items"][0] + if playlists['items']: + playlist = playlists['items'][0] return {"id": p_id, - "title": playlist["snippet"]["title"], - "channelId": playlist["snippet"]["channelId"], - "channelTitle": playlist["snippet"]["channelTitle"]} + "title": playlist['snippet']['title'], + "channelId": playlist['snippet']['channelId'], + "channelTitle": playlist['snippet']['channelTitle']} def _getPlaylists(self, id, token=None): req = {"part": "id", "maxResults": "50", "channelId": id} @@ -68,11 +68,11 @@ class YoutubeBatch(Crypter): playlists = self.api_response("playlists", req) - for playlist in playlists["items"]: - yield playlist["id"] + for playlist in playlists['items']: + yield playlist['id'] if "nextPageToken" in playlists: - for item in self._getPlaylists(id, playlists["nextPageToken"]): + for item in self._getPlaylists(id, playlists['nextPageToken']): yield item def getPlaylists(self, ch_id): @@ -85,11 +85,11 @@ class YoutubeBatch(Crypter): playlist = self.api_response("playlistItems", req) - for item in playlist["items"]: - yield item["contentDetails"]["videoId"] + for item in playlist['items']: + yield item['contentDetails']['videoId'] if "nextPageToken" in playlist: - for item in self._getVideosId(id, playlist["nextPageToken"]): + for item in self._getVideosId(id, playlist['nextPageToken']): yield item def getVideosId(self, p_id): @@ -106,18 +106,18 @@ class YoutubeBatch(Crypter): channel = self.getChannel(user) if channel: - playlists = self.getPlaylists(channel["id"]) - self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), channel["title"])) + playlists = self.getPlaylists(channel['id']) + self.logDebug("%s playlist\s found on channel \"%s\"" % (len(playlists), channel['title'])) - relatedplaylist = {p_name: self.getPlaylist(p_id) for p_name, p_id in channel["relatedPlaylists"].iteritems()} + relatedplaylist = {p_name: self.getPlaylist(p_id) for p_name, p_id in channel['relatedPlaylists'].iteritems()} self.logDebug("Channel's related playlists found = %s" % relatedplaylist.keys()) - relatedplaylist["uploads"]["title"] = "Unplaylisted videos" - relatedplaylist["uploads"]["checkDups"] = True #: checkDups flag + relatedplaylist['uploads']['title'] = "Unplaylisted videos" + relatedplaylist['uploads']['checkDups'] = True #: checkDups flag for p_name, p_data in relatedplaylist.iteritems(): if self.getConfig(p_name): - p_data["title"] += " of " + user + p_data['title'] += " of " + user playlists.append(p_data) else: playlists = [] @@ -131,9 +131,9 @@ class YoutubeBatch(Crypter): addedvideos = [] urlize = lambda x: "https://www.youtube.com/watch?v=" + x for p in playlists: - p_name = p["title"] - p_videos = self.getVideosId(p["id"]) - p_folder = save_join(self.config['general']['download_folder'], p["channelTitle"], p_name) + p_name = p['title'] + p_videos = self.getVideosId(p['id']) + p_folder = save_join(self.config['general']['download_folder'], p['channelTitle'], p_name) self.logDebug("%s video\s found on playlist \"%s\"" % (len(p_videos), p_name)) if not p_videos: diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 05cf29500..5ac117818 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -125,11 +125,11 @@ class BypassCaptcha(Hook): def captchaCorrect(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - self.respond(task.data["ticket"], True) + self.respond(task.data['ticket'], True) def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - self.respond(task.data["ticket"], False) + self.respond(task.data['ticket'], False) def processCaptcha(self, task): c = task.captchaFile @@ -139,5 +139,5 @@ class BypassCaptcha(Hook): task.error = e.getCode() return - task.data["ticket"] = ticket + task.data['ticket'] = ticket task.setResult(result) diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 28bce3d2b..b4e3ad34b 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -60,7 +60,7 @@ class Captcha9kw(Hook): if response.isdigit(): self.logInfo(_("%s credits left") % response) - self.info["credits"] = credits = int(response) + self.info['credits'] = credits = int(response) return credits else: self.logError(response) @@ -106,7 +106,7 @@ class Captcha9kw(Hook): time.sleep(3) result = response2 - task.data["ticket"] = response + task.data['ticket'] = response self.logInfo("result %s : %s" % (response, result)) task.setResult(result) else: @@ -142,7 +142,7 @@ class Captcha9kw(Hook): "correct": "1", "pyload": "1", "source": "pyload", - "id": task.data["ticket"]}) + "id": task.data['ticket']}) self.logInfo("Request correct: %s" % response) except BadHeader, e: @@ -161,7 +161,7 @@ class Captcha9kw(Hook): "correct": "2", "pyload": "1", "source": "pyload", - "id": task.data["ticket"]}) + "id": task.data['ticket']}) self.logInfo("Request refund: %s" % response) except BadHeader, e: diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index b413bdb59..54dfbe4d6 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -71,7 +71,7 @@ class CaptchaBrotherhood(Hook): else: credits = int(response[3:]) self.logInfo(_("%d credits left") % credits) - self.info["credits"] = credits + self.info['credits'] = credits return credits def submit(self, captcha, captchaType="file", match=None): @@ -167,5 +167,5 @@ class CaptchaBrotherhood(Hook): task.error = e.getCode() return - task.data["ticket"] = ticket + task.data['ticket'] = ticket task.setResult(result) diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index 8566a847e..a51eb4b47 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -80,7 +80,7 @@ class Checksum(Hook): self.algorithms = sorted( getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse=True) self.algorithms.extend(["crc32", "adler32"]) - self.formats = self.algorithms + ['sfv', 'crc', 'hash'] + self.formats = self.algorithms + ["sfv", "crc", "hash"] def downloadFinished(self, pyfile): """ @@ -158,15 +158,15 @@ class Checksum(Hook): download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "") for link in pypack.getChildren().itervalues(): - file_type = splitext(link["name"])[1][1:].lower() + file_type = splitext(link['name'])[1][1:].lower() #self.logDebug(link, file_type) if file_type not in self.formats: continue - hash_file = fs_encode(save_join(download_folder, link["name"])) + hash_file = fs_encode(save_join(download_folder, link['name'])) if not isfile(hash_file): - self.logWarning("File not found: %s" % link["name"]) + self.logWarning("File not found: %s" % link['name']) continue with open(hash_file) as f: @@ -174,14 +174,14 @@ class Checksum(Hook): for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text): data = m.groupdict() - self.logDebug(link["name"], data) + self.logDebug(link['name'], data) - local_file = fs_encode(save_join(download_folder, data["name"])) + local_file = fs_encode(save_join(download_folder, data['name'])) algorithm = self.methods.get(file_type, file_type) checksum = computeChecksum(local_file, algorithm) - if checksum == data["hash"]: + if checksum == data['hash']: self.logInfo('File integrity of "%s" verified by %s checksum (%s).' % - (data["name"], algorithm, checksum)) + (data['name'], algorithm, checksum)) else: self.logWarning("%s checksum for file %s does not match (%s != %s)" % - (algorithm, data["name"], checksum, data["hash"])) + (algorithm, data['name'], checksum, data['hash'])) diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 5a5ab7933..64ed2280f 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -183,7 +183,7 @@ class DeathByCaptcha(Hook): self.logError(e.getDesc()) return False - balance, rate = self.info["balance"], self.info["rate"] + balance, rate = self.info['balance'], self.info['rate'] self.logInfo("Account balance: US$%.3f (%d captchas left at %.2f cents each)" % (balance / 100, balance // rate, rate)) @@ -196,7 +196,7 @@ class DeathByCaptcha(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: try: - response = self.call_api("captcha/%d/report" % task.data["ticket"], True) + response = self.call_api("captcha/%d/report" % task.data['ticket'], True) except DeathByCaptchaException, e: self.logError(e.getDesc()) except Exception, e: @@ -211,5 +211,5 @@ class DeathByCaptcha(Hook): self.logError(e.getDesc()) return - task.data["ticket"] = ticket + task.data['ticket'] = ticket task.setResult(result) diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index d3cda7b80..533301a4e 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -32,6 +32,6 @@ class EasybytezCom(MultiHoster): except Exception, e: self.logDebug(e) self.logWarning("Unable to load supported hoster list, using last known") - return ['bitshare.com', 'crocko.com', 'ddlstorage.com', 'depositfiles.com', 'extabit.com', 'hotfile.com', - 'mediafire.com', 'netload.in', 'rapidgator.net', 'rapidshare.com', 'uploading.com', 'uload.to', - 'uploaded.to'] + return ["bitshare.com", "crocko.com", "ddlstorage.com", "depositfiles.com", "extabit.com", "hotfile.com", + "mediafire.com", "netload.in", "rapidgator.net", "rapidshare.com", "uploading.com", "uload.to", + "uploaded.to"] diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py index 65edd487b..9e151f8f6 100644 --- a/module/plugins/hooks/ExpertDecoders.py +++ b/module/plugins/hooks/ExpertDecoders.py @@ -51,14 +51,14 @@ class ExpertDecoders(Hook): if response.isdigit(): self.logInfo(_("%s credits left") % response) - self.info["credits"] = credits = int(response) + self.info['credits'] = credits = int(response) return credits else: self.logError(response) return 0 def processCaptcha(self, task): - task.data["ticket"] = ticket = uuid4() + task.data['ticket'] = ticket = uuid4() result = None with open(task.captchaFile, 'rb') as f: @@ -102,7 +102,7 @@ class ExpertDecoders(Hook): try: response = getURL(self.API_URL, post={"action": "refund", "key": self.getConfig("passkey"), - "gen_task_id": task.data["ticket"]}) + "gen_task_id": task.data['ticket']}) self.logInfo("Request refund: %s" % response) except BadHeader, e: diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 55aae1093..7f76df1cd 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -40,9 +40,9 @@ class ExternalScripts(Hook): def setup(self): self.scripts = {} - folders = ['download_preparing', 'download_finished', 'package_finished', - 'before_reconnect', 'after_reconnect', 'unrar_finished', - 'all_dls_finished', 'all_dls_processed'] + folders = ["download_preparing", "download_finished", "package_finished", + "before_reconnect", "after_reconnect", "unrar_finished", + "all_dls_finished", "all_dls_processed"] for folder in folders: self.scripts[folder] = [] @@ -106,13 +106,13 @@ class ExternalScripts(Hook): self.callScript(script, ip) def unrarFinished(self, folder, fname): - for script in self.scripts["unrar_finished"]: + for script in self.scripts['unrar_finished']: self.callScript(script, folder, fname) def allDownloadsFinished(self): - for script in self.scripts["all_dls_finished"]: + for script in self.scripts['all_dls_finished']: self.callScript(script) def allDownloadsProcessed(self): - for script in self.scripts["all_dls_processed"]: + for script in self.scripts['all_dls_processed']: self.callScript(script) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index a2e7d1dac..c307deb8f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -163,7 +163,7 @@ class ExtractArchive(Hook): if not exists(out): makedirs(out) - files_ids = [(save_join(dl, p.folder, x["name"]), x["id"]) for x in p.getChildren().itervalues()] + files_ids = [(save_join(dl, p.folder, x['name']), x['id']) for x in p.getChildren().itervalues()] matched = False # check as long there are unseen files @@ -307,15 +307,15 @@ class ExtractArchive(Hook): if not exists(f): continue try: - if self.config["permission"]["change_file"]: + if self.config['permission']['change_file']: if isfile(f): - chmod(f, int(self.config["permission"]["file"], 8)) + chmod(f, int(self.config['permission']['file'], 8)) elif isdir(f): - chmod(f, int(self.config["permission"]["folder"], 8)) + chmod(f, int(self.config['permission']['folder'], 8)) - if self.config["permission"]["change_dl"] and os.name != "nt": - uid = getpwnam(self.config["permission"]["user"])[2] - gid = getgrnam(self.config["permission"]["group"])[2] + if self.config['permission']['change_dl'] and os.name != "nt": + uid = getpwnam(self.config['permission']['user'])[2] + gid = getgrnam(self.config['permission']['group'])[2] chown(f, uid, gid) except Exception, e: self.logWarning(_("Setting User and Group failed"), e) diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py index 7dbe835c7..9a9bab9b4 100644 --- a/module/plugins/hooks/IRCInterface.py +++ b/module/plugins/hooks/IRCInterface.py @@ -155,25 +155,25 @@ class IRCInterface(Thread, Hook): self.handle_events(msg) def handle_events(self, msg): - if not msg["origin"].split("!", 1)[0] in self.getConfig("owner").split(): + if not msg['origin'].split("!", 1)[0] in self.getConfig("owner").split(): return - if msg["target"].split("!", 1)[0] != self.getConfig("nick"): + if msg['target'].split("!", 1)[0] != self.getConfig("nick"): return - if msg["action"] != "PRIVMSG": + if msg['action'] != "PRIVMSG": return # HANDLE CTCP ANTI FLOOD/BOT PROTECTION - if msg["text"] == "\x01VERSION\x01": + if msg['text'] == "\x01VERSION\x01": self.logDebug("Sending CTCP VERSION.") self.sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) return - elif msg["text"] == "\x01TIME\x01": + elif msg['text'] == "\x01TIME\x01": self.logDebug("Sending CTCP TIME.") self.sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) return - elif msg["text"] == "\x01LAG\x01": + elif msg['text'] == "\x01LAG\x01": self.logDebug("Received CTCP LAG.") # don't know how to answer return @@ -181,7 +181,7 @@ class IRCInterface(Thread, Hook): args = None try: - temp = msg["text"].split() + temp = msg['text'].split() trigger = temp[0] if len(temp) > 1: args = temp[1:] @@ -192,7 +192,7 @@ class IRCInterface(Thread, Hook): try: res = handler(args) for line in res: - self.response(line, msg["origin"]) + self.response(line, msg['origin']) except Exception, e: self.logError("pyLoad IRC: " + repr(e)) @@ -258,7 +258,7 @@ class IRCInterface(Thread, Hook): def event_info(self, args): if not args: - return ['ERROR: Use info like this: info <id>'] + return ["ERROR: Use info like this: info <id>"] info = None try: @@ -271,7 +271,7 @@ class IRCInterface(Thread, Hook): def event_packinfo(self, args): if not args: - return ['ERROR: Use packinfo like this: packinfo <id>'] + return ["ERROR: Use packinfo like this: packinfo <id>"] lines = [] pack = None @@ -321,7 +321,7 @@ class IRCInterface(Thread, Hook): def event_add(self, args): if len(args) < 2: return ['ERROR: Add links like this: "add <packagename|id> links". ', - 'This will add the link <link> to to the package <package> / the package with id <id>!'] + "This will add the link <link> to to the package <package> / the package with id <id>!"] pack = args[0].strip() links = [x.strip() for x in args[1:]] @@ -336,7 +336,7 @@ class IRCInterface(Thread, Hook): #TODO add links - return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack["name"], id)] + return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack['name'], id)] except: # create new package diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 794db3913..4d7be96e3 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -136,7 +136,7 @@ class ImageTyperz(Hook): if task.data['service'] == self.__name__ and "ticket" in task.data: response = getURL(self.RESPOND_URL, post={"action": "SETBADIMAGE", "username": self.getConfig("username"), "password": self.getConfig("passkey"), - "imageid": task.data["ticket"]}) + "imageid": task.data['ticket']}) if response == "SUCCESS": self.logInfo("Bad captcha solution received, requested refund") @@ -151,5 +151,5 @@ class ImageTyperz(Hook): task.error = e.getCode() return - task.data["ticket"] = ticket + task.data['ticket'] = ticket task.setResult(result) diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index 75995faf2..d6acac4a9 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -48,7 +48,7 @@ class LinkdecrypterCom(Hook): return builtin = [name.lower() for name in self.core.pluginManager.crypterPlugins.keys()] - builtin.extend(["downloadserienjunkiesorg"]) + builtin.append("downloadserienjunkiesorg") crypter_pattern = re.compile("(\w[\w.-]+)") online = [] @@ -64,7 +64,7 @@ class LinkdecrypterCom(Hook): regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online) dict = self.core.pluginManager.crypterPlugins[self.__name__] - dict["pattern"] = regexp - dict["re"] = re.compile(regexp) + dict['pattern'] = regexp + dict['re'] = re.compile(regexp) self.logDebug("REGEXP: " + regexp) diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py index 31be74fdd..22945cc0f 100644 --- a/module/plugins/hooks/MegaDebridEu.py +++ b/module/plugins/hooks/MegaDebridEu.py @@ -36,7 +36,7 @@ class MegaDebridEu(MultiHoster): reponse = getURL('http://www.mega-debrid.eu/api.php?action=getHosters') json_data = json_loads(reponse) - if json_data["response_code"] == "ok": + if json_data['response_code'] == "ok": host_list = [element[0] for element in json_data['hosters']] else: self.logError("Unable to retrieve hoster list") diff --git a/module/plugins/hooks/MergeFiles.py b/module/plugins/hooks/MergeFiles.py index e7bd63d17..5d6c208a7 100644 --- a/module/plugins/hooks/MergeFiles.py +++ b/module/plugins/hooks/MergeFiles.py @@ -47,12 +47,12 @@ class MergeFiles(Hook): files = {} fid_dict = {} for fid, data in pack.getChildren().iteritems(): - if re.search("\.[0-9]{3}$", data["name"]): - if data["name"][:-4] not in files: - files[data["name"][:-4]] = [] - files[data["name"][:-4]].append(data["name"]) - files[data["name"][:-4]].sort() - fid_dict[data["name"]] = fid + if re.search("\.[0-9]{3}$", data['name']): + if data['name'][:-4] not in files: + files[data['name'][:-4]] = [] + files[data['name'][:-4]].append(data['name']) + files[data['name'][:-4]].sort() + fid_dict[data['name']] = fid download_folder = self.config['general']['download_folder'] diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py index 31bbbcc9a..b9c663046 100644 --- a/module/plugins/hooks/MultiHome.py +++ b/module/plugins/hooks/MultiHome.py @@ -38,7 +38,7 @@ class MultiHome(Hook): self.interfaces = [] self.parseInterfaces(self.getConfig("interfaces").split(";")) if not self.interfaces: - self.parseInterfaces([self.config["download"]["interface"]]) + self.parseInterfaces([self.config['download']['interface']]) self.setConfig("interfaces", self.toConfig()) def toConfig(self): diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 0841e07a6..96e06950e 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -34,7 +34,7 @@ class RehostTo(MultiHoster): return data = self.account.getAccountInfo(user) - self.ses = data["ses"] - self.long_ses = data["long_ses"] + self.ses = data['ses'] + self.long_ses = data['long_ses'] return MultiHoster.coreReady(self) diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 242659d9e..b6ba853a7 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -95,7 +95,7 @@ class UpdateManager(Hook): return True if self.core.pluginManager.reloadPlugins(reloads) else False def periodical(self): - if not self.info["pyload"] and not (self.getConfig("nodebugupdate") and self.core.debug): + if not self.info['pyload'] and not (self.getConfig("nodebugupdate") and self.core.debug): self.updating = True self.update(onlyplugin=True if self.getConfig("mode") == "plugins only" else False) self.updating = False @@ -127,15 +127,15 @@ class UpdateManager(Hook): newversion = data[0] self.logInfo(_("*** New pyLoad Version %s available ***") % newversion) self.logInfo(_("*** Get it here: https://github.com/pyload/pyload/releases ***")) - r = self.info["pyload"] = True - self.info["version"] = newversion + r = self.info['pyload'] = True + self.info['version'] = newversion return r @threaded def _updatePlugins(self, updates): """ check for plugin updates """ - if self.info["plugins"]: + if self.info['plugins']: return False #: plugins were already updated updated = [] @@ -152,9 +152,9 @@ class UpdateManager(Hook): data = sorted(map(lambda x: dict(zip(schema, x.split('|'))), updates), key=itemgetter("type", "name")) for plugin in data: - filename = plugin["name"] - prefix = plugin["type"] - version = plugin["version"] + filename = plugin['name'] + prefix = plugin['type'] + version = plugin['version'] if filename.endswith(".pyc"): name = filename[:filename.find("_")] @@ -169,7 +169,7 @@ class UpdateManager(Hook): plugins = getattr(self.core.pluginManager, "%sPlugins" % type) - oldver = float(plugins[name]["v"]) if name in plugins else None + oldver = float(plugins[name]['v']) if name in plugins else None newver = float(version) if not oldver: @@ -213,7 +213,7 @@ class UpdateManager(Hook): self.logInfo(_("Plugins updated and reloaded")) else: self.logInfo(_("*** Plugins have been updated, pyLoad will be restarted now ***")) - self.info["plugins"] = True + self.info['plugins'] = True self.scheduler.addJob(4, self.core.api.restart(), threaded=False) #: risky, but pyload doesn't let more return True else: diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 09d035e10..37a464b33 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -64,8 +64,8 @@ class XFileSharingPro(Hook): #self.logDebug(regexp) dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] - dict["pattern"] = regexp - dict["re"] = re.compile(regexp) + dict['pattern'] = regexp + dict['re'] = re.compile(regexp) self.logDebug("Pattern loaded - handling %d hosters" % len(hosterList)) def getConfigSet(self, option): @@ -74,5 +74,5 @@ class XFileSharingPro(Hook): def unload(self): dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] - dict["pattern"] = r"^unmatchable$" - dict["re"] = re.compile(r"^unmatchable$") + dict['pattern'] = r'^unmatchable$' + dict['re'] = re.compile(r'^unmatchable$') diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py index 57a997a4b..a60d31b89 100644 --- a/module/plugins/hooks/XMPPInterface.py +++ b/module/plugins/hooks/XMPPInterface.py @@ -121,9 +121,7 @@ class XMPPInterface(IRCInterface, JabberClient): The handlers returned will be called when matching message is received in a client session.""" - return [ - ("normal", self.message), - ] + return [("normal", self.message)] def message(self, stanza): """Message handler for the component.""" @@ -231,9 +229,7 @@ class VersionHandler(object): def get_iq_get_handlers(self): """Return list of tuples (element_name, namespace, handler) describing handlers of <iq type='get'/> stanzas""" - return [ - ("query", "jabber:iq:version", self.get_version), - ] + return [("query", "jabber:iq:version", self.get_version)] def get_iq_set_handlers(self): """Return empty list, as this class provides no <iq type='set'/> stanza handler.""" diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 11ee8b7d3..b2064f22f 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -48,17 +48,17 @@ class AlldebridCom(Hoster): self.logDebug("Json data: %s" % str(data)) - if data["error"]: - if data["error"] == "This link isn't available on the hoster website.": + if data['error']: + if data['error'] == "This link isn't available on the hoster website.": self.offline() else: - self.logWarning(data["error"]) + self.logWarning(data['error']) self.tempOffline() else: if pyfile.name and not pyfile.name.endswith('.tmp'): - pyfile.name = data["filename"] - pyfile.size = parseFileSize(data["filesize"]) - new_url = data["link"] + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) + new_url = data['link'] if self.getConfig("https"): new_url = new_url.replace("http://", "https://") diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index 68b98e0a7..9206aaabd 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -56,7 +56,7 @@ class BasePlugin(Hoster): if server in servers: self.logDebug("Logging on to %s" % server) - self.req.addAuth(account.accounts[server]["password"]) + self.req.addAuth(account.accounts[server]['password']) else: for pwd in pyfile.package().password.splitlines(): if ":" in pwd: diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py index ba0f3d263..5f032ca8b 100644 --- a/module/plugins/hoster/DailymotionCom.py +++ b/module/plugins/hoster/DailymotionCom.py @@ -34,14 +34,14 @@ def getInfo(urls): info = json_loads(page) if "title" in info: - name = info["title"] + ".mp4" + name = info['title'] + ".mp4" else: name = url - if "error" in info or info["access_error"]: + if "error" in info or info['access_error']: status = "offline" else: - status = info["status"] + status = info['status'] if status in ("ready", "published"): status = "online" elif status in ("waiting", "processing"): diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index ddcb13153..19be45f44 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -46,8 +46,8 @@ class DataportCz(SimpleHoster): if not action or not inputs: self.parseError('free_download_form') - if "captchaId" in inputs and inputs["captchaId"] in captchas: - inputs['captchaCode'] = captchas[inputs["captchaId"]] + if "captchaId" in inputs and inputs['captchaId'] in captchas: + inputs['captchaCode'] = captchas[inputs['captchaId']] else: self.parseError('captcha') diff --git a/module/plugins/hoster/DdlstorageCom.py b/module/plugins/hoster/DdlstorageCom.py index eed53b1e1..9122b094a 100644 --- a/module/plugins/hoster/DdlstorageCom.py +++ b/module/plugins/hoster/DdlstorageCom.py @@ -61,7 +61,7 @@ class DdlstorageCom(XFileSharingPro): data = {'client_id': 53472, 'file_code': file_id} if self.user: - passwd = self.account.getAccountData(self.user)["password"] + passwd = self.account.getAccountData(self.user)['password'] data['req_type'] = 'file_info_reg' data['user_login'] = self.user data['user_password'] = md5(passwd).hexdigest() diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 03c8f10cd..f0a8aa933 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -56,7 +56,7 @@ class AdYouLike: res = self.plugin.load( r'http://api-ayl.appspot.com/challenge?key=%(ayl_key)s&env=%(ayl_env)s&callback=%(callback)s' % { - "ayl_key": ayl_data[self.engine]["key"], "ayl_env": ayl_data["all"]["env"], + "ayl_key": ayl_data[self.engine]['key'], "ayl_env": ayl_data['all']['env'], "callback": self.ADYOULIKE_CALLBACK}) found = re.search(self.ADYOULIKE_CHALLENGE_PATTERN, res) @@ -83,7 +83,7 @@ class AdYouLike: """ response = None try: - instructions_visual = challenge["translations"][ayl["all"]["lang"]]["instructions_visual"] + instructions_visual = challenge['translations'][ayl['all']['lang']]['instructions_visual'] found = re.search(u".*«(.*)».*", instructions_visual) if found: response = found.group(1).strip() @@ -98,9 +98,9 @@ class AdYouLike: self.plugin.fail("AdYouLike result failed") return {"_ayl_captcha_engine": self.engine, - "_ayl_env": ayl["all"]["env"], - "_ayl_tid": challenge["tid"], - "_ayl_token_challenge": challenge["token"], + "_ayl_env": ayl['all']['env'], + "_ayl_tid": challenge['tid'], + "_ayl_token_challenge": challenge['token'], "_ayl_response": response} diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 874eeb824..b5fb9608e 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -62,7 +62,7 @@ class ExtabitCom(SimpleHoster): for _ in xrange(5): get_data = {"type": "recaptcha"} - get_data["challenge"], get_data["capture"] = recaptcha.challenge(captcha_key) + get_data['challenge'], get_data['capture'] = recaptcha.challenge(captcha_key) response = json_loads(self.load("http://extabit.com/file/%s/" % fileID, get=get_data)) if "ok" in response: self.correctCaptcha() diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index 8eeabc17c..a59fae498 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -38,7 +38,7 @@ class FastixRu(Hoster): else: self.logDebug("Old URL: %s" % pyfile.url) api_key = self.account.getAccountData(self.user) - api_key = api_key["api"] + api_key = api_key['api'] url = "http://fastix.ru/api_v2/?apikey=%s&sub=getdirectlink&link=%s" % (api_key, pyfile.url) page = self.load(url) data = json_loads(page) @@ -46,7 +46,7 @@ class FastixRu(Hoster): if "error\":true" in page: self.offline() else: - new_url = data["downloadlink"] + new_url = data['downloadlink'] if new_url != pyfile.url: self.logDebug("New URL: %s" % new_url) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index c4112534c..4acbb12f8 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -72,7 +72,7 @@ class FastshareCz(SimpleHoster): def handlePremium(self): header = self.load(self.pyfile.url, just_header=True) if "location" in header: - url = header["location"] + url = header['location'] else: self.html = self.load(self.pyfile.url) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 13265e3e4..5d2d4b3c0 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -53,7 +53,7 @@ class FilecloudIo(SimpleHoster): found = re.search(self.AB1_PATTERN, self.html) if not found: self.parseError("__AB1") - data["__ab1"] = found.group(1) + data['__ab1'] = found.group(1) if not self.account: self.fail("User not logged in") @@ -70,25 +70,25 @@ class FilecloudIo(SimpleHoster): self.logDebug(response) response = json_loads(response) - if "error" in response and response["error"]: + if "error" in response and response['error']: self.fail(response) self.logDebug(response) - if response["captcha"]: + if response['captcha']: recaptcha = ReCaptcha(self) found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html) captcha_key = found.group(1) if found else self.RECAPTCHA_KEY - data["ctype"] = "recaptcha" + data['ctype'] = "recaptcha" for _ in xrange(5): - data["recaptcha_challenge"], data["recaptcha_response"] = recaptcha.challenge(captcha_key) + data['recaptcha_challenge'], data['recaptcha_response'] = recaptcha.challenge(captcha_key) json_url = "http://filecloud.io/download-request.json" response = self.load(json_url, post=data) self.logDebug(response) response = json_loads(response) - if "retry" in response and response["retry"]: + if "retry" in response and response['retry']: self.invalidCaptcha() else: self.correctCaptcha() @@ -96,7 +96,7 @@ class FilecloudIo(SimpleHoster): else: self.fail("Incorrect captcha") - if response["dl"]: + if response['dl']: self.html = self.load('http://filecloud.io/download.html') found = re.search(self.LINK_PATTERN % self.file_info['ID'], self.html) if not found: diff --git a/module/plugins/hoster/FilejungleCom.py b/module/plugins/hoster/FilejungleCom.py index 94babc97d..ab582b3a3 100644 --- a/module/plugins/hoster/FilejungleCom.py +++ b/module/plugins/hoster/FilejungleCom.py @@ -28,8 +28,8 @@ class FilejungleCom(FileserveCom): __author_name__ = "zoidberg" __author_mail__ = "zoidberg@mujmail.cz" - URLS = ['http://www.filejungle.com/f/', 'http://www.filejungle.com/check_links.php', - 'http://www.filejungle.com/checkReCaptcha.php'] + URLS = ["http://www.filejungle.com/f/", "http://www.filejungle.com/check_links.php", + "http://www.filejungle.com/checkReCaptcha.php"] LINKCHECK_TR = r'<li>\s*(<div class="col1">.*?)</li>' LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<[^>]*>| )*([^<]*)' diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index c56df23c8..a6f3fae14 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -90,10 +90,10 @@ class FilepostCom(SimpleHoster): for i in xrange(5): get_dict['JsHttpRequest'] = str(int(time() * 10000)) + '-xml' if i: - post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"] = recaptcha.challenge( + post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'] = recaptcha.challenge( captcha_key) self.logDebug(u"RECAPTCHA: %s : %s : %s" % ( - captcha_key, post_dict["recaptcha_challenge_field"], post_dict["recaptcha_response_field"])) + captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) download_url = self.getJsonResponse(get_dict, post_dict, 'link') if download_url: diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index ebb6204c3..ac12a7892 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -55,8 +55,8 @@ class FileserveCom(Hoster): __author_name__ = ("jeix", "mkaay", "Paul King", "zoidberg") __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "", "zoidberg@mujmail.cz") - URLS = ['http://www.fileserve.com/file/', 'http://www.fileserve.com/link-checker.php', - 'http://www.fileserve.com/checkReCaptcha.php'] + URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php", + "http://www.fileserve.com/checkReCaptcha.php"] LINKCHECK_TR = r'<tr>\s*(<td>http://www.fileserve\.com/file/.*?)</tr>' LINKCHECK_TD = r'<td>(?:<[^>]*>| )*([^<]*)' @@ -93,24 +93,24 @@ class FileserveCom(Hoster): self.logDebug(action) if "fail" in action: - if action["fail"] == "timeLimit": + if action['fail'] == "timeLimit": self.html = self.load(self.url, post={"checkDownload": "showError", "errorType": "timeLimit"}, decode=True) self.doLongWait(re.search(self.LONG_WAIT_PATTERN, self.html)) - elif action["fail"] == "parallelDownload": + elif action['fail'] == "parallelDownload": self.logWarning(_("Parallel download error, now waiting 60s.")) self.retry(wait_time=60, reason="parallelDownload") else: - self.fail("Download check returned %s" % action["fail"]) + self.fail("Download check returned %s" % action['fail']) elif "success" in action: - if action["success"] == "showCaptcha": + if action['success'] == "showCaptcha": self.doCaptcha() self.doTimmer() - elif action["success"] == "showTimmer": + elif action['success'] == "showTimmer": self.doTimmer() else: @@ -173,7 +173,7 @@ class FileserveCom(Hoster): 'recaptcha_response_field': code, 'recaptcha_shortencode_field': self.file_id})) self.logDebug("reCaptcha response : %s" % response) - if not response["success"]: + if not response['success']: self.invalidCaptcha() else: self.correctCaptcha() @@ -193,7 +193,7 @@ class FileserveCom(Hoster): #try api download response = self.load("http://app.fileserve.com/api/download/premium/", post={"username": self.user, - "password": self.account.getAccountData(self.user)["password"], + "password": self.account.getAccountData(self.user)['password'], "shorten": self.file_id}, decode=True) if response: diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index ddb5a9ec0..ff1056c9f 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -164,7 +164,7 @@ class FreakshareCom(Hoster): if challenge: re_captcha = ReCaptcha(self) - (request_options["recaptcha_challenge_field"], - request_options["recaptcha_response_field"]) = re_captcha.challenge(challenge.group(1)) + (request_options['recaptcha_challenge_field'], + request_options['recaptcha_response_field']) = re_captcha.challenge(challenge.group(1)) return request_options diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index c6ae75530..725126d17 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -50,7 +50,7 @@ class Ftp(Hoster): if netloc in servers: self.logDebug("Logging on to %s" % netloc) - self.req.addAuth(self.account.accounts[netloc]["password"]) + self.req.addAuth(self.account.accounts[netloc]['password']) else: for pwd in pyfile.package().password.splitlines(): if ":" in pwd: diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index 89f6cd35f..b44ecb6dd 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -48,17 +48,17 @@ class IfileIt(SimpleHoster): if json_response['status'] == 3: self.offline() - if json_response["captcha"]: + if json_response['captcha']: captcha_key = re.search(self.RECAPTCHA_KEY_PATTERN, self.html).group(1) recaptcha = ReCaptcha(self) - post_data["ctype"] = "recaptcha" + post_data['ctype'] = "recaptcha" for _ in xrange(5): - post_data["recaptcha_challenge"], post_data["recaptcha_response"] = recaptcha.challenge(captcha_key) + post_data['recaptcha_challenge'], post_data['recaptcha_response'] = recaptcha.challenge(captcha_key) json_response = json_loads(self.load(json_url, post=post_data)) self.logDebug(json_response) - if json_response["retry"]: + if json_response['retry']: self.invalidCaptcha() else: self.correctCaptcha() @@ -69,7 +69,7 @@ class IfileIt(SimpleHoster): if not "ticket_url" in json_response: self.parseError("Download URL") - self.download(json_response["ticket_url"]) + self.download(json_response['ticket_url']) getInfo = create_getInfo(IfileIt) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index 3df1e8330..1ebed3bd4 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -31,9 +31,9 @@ from module.plugins.internal.SimpleHoster import SimpleHoster def api_download_info(url): - json_data = ['yw7XQy2v9', ["download/info", {"link": url}]] + json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] post_data = urllib.urlencode({'r': json_dumps(json_data)}) - api_rep = urllib.urlopen('http://api.letitbit.net/json', data=post_data).read() + api_rep = urllib.urlopen("http://api.letitbit.net/json", data=post_data).read() return json_loads(api_rep) @@ -157,7 +157,7 @@ class LetitbitNet(SimpleHoster): def handlePremium(self): api_key = self.user - premium_key = self.account.getAccountData(self.user)["password"] + premium_key = self.account.getAccountData(self.user)['password'] json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": self.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 2ed7744d7..3de19945b 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -34,7 +34,7 @@ class LinksnappyCom(Hoster): json_params = json_dumps({'link': pyfile.url, 'type': host, 'username': self.user, - 'password': self.account.getAccountData(self.user)["password"]}) + 'password': self.account.getAccountData(self.user)['password']}) r = self.load('http://gen.linksnappy.com/genAPI.php', post={'genLinks': json_params}) self.logDebug("JSON data: " + r) diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 23c698710..1e68cec22 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -64,11 +64,11 @@ class MegaDebridEu(Hoster): """ user, data = self.account.selectAccount() jsonResponse = self.load(self.API_URL, - get={'action': 'connectUser', 'login': user, 'password': data["password"]}) + get={'action': 'connectUser', 'login': user, 'password': data['password']}) response = json_loads(jsonResponse) - if response["response_code"] == "ok": - self.token = response["token"] + if response['response_code'] == "ok": + self.token = response['token'] return True else: return False @@ -82,8 +82,8 @@ class MegaDebridEu(Hoster): post={"link": linkToDebrid}) response = json_loads(jsonResponse) - if response["response_code"] == "ok": - debridedLink = response["debridLink"][1:-1] + if response['response_code'] == "ok": + debridedLink = response['debridLink'][1:-1] return debridedLink else: self.exitOnFail("Unable to debrid %s" % linkToDebrid) diff --git a/module/plugins/hoster/MegaNz.py b/module/plugins/hoster/MegaNz.py index a396204ab..cf35f2d2d 100644 --- a/module/plugins/hoster/MegaNz.py +++ b/module/plugins/hoster/MegaNz.py @@ -110,7 +110,7 @@ class MegaNz(Hoster): dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] if "e" in dl: - e = dl["e"] + e = dl['e'] # ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later if e == -18: self.retry() @@ -121,12 +121,12 @@ class MegaNz(Hoster): # EACCESS (-11): Access violation (e.g., trying to write to a read-only share) key = self.b64_decode(key) - attr = self.decryptAttr(dl["at"], key) + attr = self.decryptAttr(dl['at'], key) - pyfile.name = attr["n"] + self.FILE_SUFFIX + pyfile.name = attr['n'] + self.FILE_SUFFIX - self.download(dl["g"]) + self.download(dl['g']) self.decryptFile(key) # Everything is finished and final name can be set - pyfile.name = attr["n"] + pyfile.name = attr['n'] diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 378acd856..aa167ba30 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -36,15 +36,15 @@ class MegacrypterCom(MegaNz): dl = self.callApi(link=node, m="dl") # TODO: map error codes, implement password protection - # if info["pass"] is True: - # crypted_file_key, md5_file_key = info["key"].split("#") + # if info['pass'] is True: + # crypted_file_key, md5_file_key = info['key'].split("#") - key = self.b64_decode(info["key"]) + key = self.b64_decode(info['key']) - pyfile.name = info["name"] + self.FILE_SUFFIX + pyfile.name = info['name'] + self.FILE_SUFFIX - self.download(dl["url"]) + self.download(dl['url']) self.decryptFile(key) # Everything is finished and final name can be set - pyfile.name = info["name"] + pyfile.name = info['name'] diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index b2ae07ef1..c2fbaf46e 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -68,15 +68,15 @@ class MultishareCz(SimpleHoster): self.fail("Not enough credit left to download file") url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()) - params = {"u_ID": self.acc_info["u_ID"], "u_hash": self.acc_info["u_hash"], "link": self.pyfile.url} + params = {"u_ID": self.acc_info['u_ID'], "u_hash": self.acc_info['u_hash'], "link": self.pyfile.url} self.logDebug(url, params) self.download(url, get=params) def checkCredit(self): self.acc_info = self.account.getAccountInfo(self.user, True) - self.logInfo("User %s has %i MB left" % (self.user, self.acc_info["trafficleft"] / 1024)) + self.logInfo("User %s has %i MB left" % (self.user, self.acc_info['trafficleft'] / 1024)) - return self.pyfile.size / 1024 <= self.acc_info["trafficleft"] + return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] getInfo = create_getInfo(MultishareCz) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index 043de5463..5431ebb9a 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -69,8 +69,8 @@ class NetloadIn(Hoster): def prepare(self): self.download_api_data() - if self.api_data and self.api_data["filename"]: - self.pyfile.name = self.api_data["filename"] + if self.api_data and self.api_data['filename']: + self.pyfile.name = self.api_data['filename'] if self.premium: self.logDebug("Netload: Use Premium Account") @@ -113,13 +113,13 @@ class NetloadIn(Hoster): self.api_data = {} if src and ";" in src and src not in ("unknown file_data", "unknown_server_data", "No input file specified."): lines = src.split(";") - self.api_data["exists"] = True - self.api_data["fileid"] = lines[0] - self.api_data["filename"] = lines[1] - self.api_data["size"] = lines[2] - self.api_data["status"] = lines[3] - if self.api_data["status"] == "online": - self.api_data["checksum"] = lines[4].strip() + self.api_data['exists'] = True + self.api_data['fileid'] = lines[0] + self.api_data['filename'] = lines[1] + self.api_data['size'] = lines[2] + self.api_data['status'] = lines[3] + if self.api_data['status'] == "online": + self.api_data['checksum'] = lines[4].strip() else: self.api_data = False # check manually since api data is useless sometimes diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py index 2a6bf8759..2176f1cd5 100644 --- a/module/plugins/hoster/OboomCom.py +++ b/module/plugins/hoster/OboomCom.py @@ -34,7 +34,7 @@ class OboomCom(Hoster): if self.premium: accountInfo = self.account.getAccountInfo(self.user, True) if "session" in accountInfo: - self.sessionToken = accountInfo["session"] + self.sessionToken = accountInfo['session'] else: self.fail("Could not retrieve premium session") else: @@ -88,9 +88,9 @@ class OboomCom(Hoster): result = self.loadUrl(apiUrl, params) if result[0] == 200: item = result[1][0] - if item["state"] == "online": - self.fileSize = item["size"] - self.fileName = item["name"] + if item['state'] == "online": + self.fileSize = item['size'] + self.fileName = item['name'] else: self.offline() else: @@ -100,10 +100,10 @@ class OboomCom(Hoster): apiUrl = "https://api.oboom.com/1.0/dl" params = {"item": self.fileId, "http_errors": 0} if self.premium: - params["token"] = self.sessionToken + params['token'] = self.sessionToken else: - params["token"] = self.downloadToken - params["auth"] = self.downloadAuth + params['token'] = self.downloadToken + params['auth'] = self.downloadAuth result = self.loadUrl(apiUrl, params) if result[0] == 200: diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index aaa1442e4..f030c9e87 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -42,19 +42,19 @@ class OverLoadMe(Hoster): data = self.account.getAccountData(self.user) page = self.load("https://api.over-load.me/getdownload.php", - get={"auth": data["password"], "link": pyfile.url}) + get={"auth": data['password'], "link": pyfile.url}) data = json_loads(page) self.logDebug("Returned Data: %s" % data) - if data["err"] == 1: - self.logWarning(data["msg"]) + if data['err'] == 1: + self.logWarning(data['msg']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data["filename"]: - pyfile.name = data["filename"] - pyfile.size = parseFileSize(data["filesize"]) - new_url = data["downloadlink"] + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) + new_url = data['downloadlink'] if self.getConfig("https"): new_url = new_url.replace("http://", "https://") diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index ce2b6f48e..f87405675 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -110,13 +110,13 @@ class RapidgatorNet(SimpleHoster): self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) url = "http://rapidgator.net%s?fid=%s" % ( - jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars["fid"]) + jsvars.get('startTimerUrl', '/download/AjaxStartTimer'), jsvars['fid']) jsvars.update(self.getJsonResponse(url)) self.wait(int(jsvars.get('secs', 45)) + 1, False) url = "http://rapidgator.net%s?sid=%s" % ( - jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars["sid"]) + jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars['sid']) jsvars.update(self.getJsonResponse(url)) self.req.http.lastURL = self.pyfile.url diff --git a/module/plugins/hoster/RapidshareCom.py b/module/plugins/hoster/RapidshareCom.py index 4ecd3c841..b50f1c568 100644 --- a/module/plugins/hoster/RapidshareCom.py +++ b/module/plugins/hoster/RapidshareCom.py @@ -87,7 +87,7 @@ class RapidshareCom(Hoster): self.name = m.group("name_new") self.download_api_data() - if self.api_data["status"] == "1": + if self.api_data['status'] == "1": self.pyfile.name = self.get_file_name() if self.premium: @@ -95,15 +95,15 @@ class RapidshareCom(Hoster): else: self.handleFree() - elif self.api_data["status"] == "2": + elif self.api_data['status'] == "2": self.logInfo(_("Rapidshare: Traffic Share (direct download)")) self.pyfile.name = self.get_file_name() self.download(self.pyfile.url, get={"directstart": 1}) - elif self.api_data["status"] in ("0", "4", "5"): + elif self.api_data['status'] in ("0", "4", "5"): self.offline() - elif self.api_data["status"] == "3": + elif self.api_data['status'] == "3": self.tempOffline() else: self.fail("Unknown response code.") @@ -133,7 +133,7 @@ class RapidshareCom(Hoster): def handlePremium(self): info = self.account.getAccountInfo(self.user, True) self.logDebug("%s: Use Premium Account" % self.__name__) - url = self.api_data["mirror"] + url = self.api_data['mirror'] self.download(url, get={"directstart": 1}) def download_api_data(self, force=False): @@ -163,12 +163,12 @@ class RapidshareCom(Hoster): self.api_data = {"fileid": fields[0], "filename": fields[1], "size": int(fields[2]), "serverid": fields[3], "status": fields[4], "shorthost": fields[5], "checksum": fields[6].strip().lower()} - if int(self.api_data["status"]) > 100: - self.api_data["status"] = str(int(self.api_data["status"]) - 100) - elif int(self.api_data["status"]) > 50: - self.api_data["status"] = str(int(self.api_data["status"]) - 50) + if int(self.api_data['status']) > 100: + self.api_data['status'] = str(int(self.api_data['status']) - 100) + elif int(self.api_data['status']) > 50: + self.api_data['status'] = str(int(self.api_data['status']) - 50) - self.api_data["mirror"] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data + self.api_data['mirror'] = "http://rs%(serverid)s%(shorthost)s.rapidshare.com/files/%(fileid)s/%(filename)s" % self.api_data def freeWait(self): """downloads html with the important information @@ -214,14 +214,14 @@ class RapidshareCom(Hoster): "name": name, "host": data[0], "auth": data[1], - "server": self.api_data["serverid"], - "size": self.api_data["size"]} + "server": self.api_data['serverid'], + "size": self.api_data['size']} self.setWait(int(data[2]) + 2 + self.offset) self.wait() return dl_dict def get_file_name(self): - if self.api_data["filename"]: - return self.api_data["filename"] + if self.api_data['filename']: + return self.api_data['filename'] return self.url.split("/")[-1] diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 36fcd194c..17cd86ccd 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -54,16 +54,16 @@ class RealdebridCom(Hoster): self.logDebug("Returned Data: %s" % data) - if data["error"] != 0: - if data["message"] == "Your file is unavailable on the hoster.": + if data['error'] != 0: + if data['message'] == "Your file is unavailable on the hoster.": self.offline() else: - self.logWarning(data["message"]) + self.logWarning(data['message']) self.tempOffline() else: - if pyfile.name is not None and pyfile.name.endswith('.tmp') and data["file_name"]: - pyfile.name = data["file_name"] - pyfile.size = parseFileSize(data["file_size"]) + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: + pyfile.name = data['file_name'] + pyfile.size = parseFileSize(data['file_size']) new_url = data['generated_links'][0][-1] if self.getConfig("https"): diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 94e53520a..79c06f863 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -26,7 +26,7 @@ class RehostTo(Hoster): self.fail("No rehost.to account provided") data = self.account.getAccountInfo(self.user) - long_ses = data["long_ses"] + long_ses = data['long_ses'] self.logDebug("Rehost.to: Old URL: %s" % pyfile.url) new_url = "http://rehost.to/process_download.php?user=cookie&pass=%s&dl=%s" % (long_ses, quote(pyfile.url, "")) diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py index ecfe389e3..a26827401 100644 --- a/module/plugins/hoster/RyushareCom.py +++ b/module/plugins/hoster/RyushareCom.py @@ -31,7 +31,7 @@ class RyushareCom(XFileSharingPro): self.html = self.load(self.pyfile.url) action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) if "method_premium" in inputs: - del inputs["method_premium"] + del inputs['method_premium'] self.html = self.load(self.pyfile.url, post=inputs) action, inputs = self.parseHtmlForm('F1') @@ -45,7 +45,7 @@ class RyushareCom(XFileSharingPro): match = re.search(self.WAIT_PATTERN, self.html) if match: m = match.groupdict(0) - waittime = int(m["hour"]) * 60 * 60 + int(m["min"]) * 60 + int(m["sec"]) + waittime = int(m['hour']) * 60 * 60 + int(m['min']) * 60 + int(m['sec']) self.setWait(waittime, True) retry = True @@ -62,8 +62,8 @@ class RyushareCom(XFileSharingPro): captcha = SolveMedia(self) challenge, response = captcha.challenge(captchaKey) - inputs["adcopy_challenge"] = challenge - inputs["adcopy_response"] = response + inputs['adcopy_challenge'] = challenge + inputs['adcopy_response'] = response self.html = self.load(self.pyfile.url, post=inputs) if "WRONG CAPTCHA" in self.html: diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 78cc29fdb..0e0676626 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -84,17 +84,17 @@ class ShareonlineBiz(Hoster): fields = src.split(";") self.api_data = {"fileid": fields[0], "status": fields[1]} - if not self.api_data["status"] == "OK": + if not self.api_data['status'] == "OK": self.offline() else: - self.api_data["filename"] = fields[2] - self.api_data["size"] = fields[3] # in bytes - self.api_data["md5"] = fields[4].strip().lower().replace("\n\n", "") # md5 + self.api_data['filename'] = fields[2] + self.api_data['size'] = fields[3] # in bytes + self.api_data['md5'] = fields[4].strip().lower().replace("\n\n", "") # md5 def handleFree(self): self.loadAPIData() - self.pyfile.name = self.api_data["filename"] - self.pyfile.size = int(self.api_data["size"]) + self.pyfile.name = self.api_data['filename'] + self.pyfile.size = int(self.api_data['size']) self.html = self.load(self.pyfile.url, cookies=True) # refer, stuff self.setWait(3) @@ -147,7 +147,7 @@ class ShareonlineBiz(Hoster): def handlePremium(self): #: should be working better loading (account) api internally self.account.getAccountInfo(self.user, True) src = self.load("http://api.share-online.biz/account.php", - {"username": self.user, "password": self.account.accounts[self.user]["password"], + {"username": self.user, "password": self.account.accounts[self.user]['password'], "act": "download", "lid": self.file_id}) self.api_data = dlinfo = {} @@ -156,13 +156,13 @@ class ShareonlineBiz(Hoster): dlinfo[key.lower()] = value self.logDebug(dlinfo) - if not dlinfo["status"] == "online": + if not dlinfo['status'] == "online": self.offline() else: - self.pyfile.name = dlinfo["name"] - self.pyfile.size = int(dlinfo["size"]) + self.pyfile.name = dlinfo['name'] + self.pyfile.size = int(dlinfo['size']) - dlLink = dlinfo["url"] + dlLink = dlinfo['url'] if dlLink == "server_under_maintenance": self.tempOffline() else: diff --git a/module/plugins/hoster/StreamcloudEu.py b/module/plugins/hoster/StreamcloudEu.py index 849f3797a..a9b2804e4 100644 --- a/module/plugins/hoster/StreamcloudEu.py +++ b/module/plugins/hoster/StreamcloudEu.py @@ -74,7 +74,7 @@ class StreamcloudEu(XFileSharingPro): self.logDebug(self.HOSTER_NAME, inputs) - if 'op' in inputs and inputs['op'] in ('download1', 'download2', 'download3'): + if 'op' in inputs and inputs['op'] in ("download1", "download2", "download3"): if "password" in inputs: if self.passwords: inputs['password'] = self.passwords.pop(0) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index a111240ca..a3da22fe4 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -103,7 +103,7 @@ class UlozTo(SimpleHoster): self.logDebug('Using "old" version') captcha_value = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id']) - self.logDebug('CAPTCHA ID: ' + inputs['captcha_id'] + ', CAPTCHA VALUE: ' + captcha_value) + self.logDebug('CAPTCHA ID: ' + inputs['captcha_id'] + ", CAPTCHA VALUE: " + captcha_value) inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value}) @@ -116,7 +116,7 @@ class UlozTo(SimpleHoster): data = json_loads(xapca) captcha_value = self.decryptCaptcha(str(data['image'])) - self.logDebug('CAPTCHA HASH: ' + data['hash'] + ', CAPTCHA SALT: ' + str(data['salt']) + ', CAPTCHA VALUE: ' + captcha_value) + self.logDebug("CAPTCHA HASH: " + data['hash'] + ", CAPTCHA SALT: " + str(data['salt']) + ", CAPTCHA VALUE: " + captcha_value) inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) else: diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py index 4cf8b35b5..bfe28f158 100644 --- a/module/plugins/hoster/UploadedTo.py +++ b/module/plugins/hoster/UploadedTo.py @@ -148,8 +148,8 @@ class UploadedTo(Hoster): def handlePremium(self): info = self.account.getAccountInfo(self.user, True) self.logDebug("%(name)s: Use Premium Account (%(left)sGB left)" % {"name": self.__name__, - "left": info["trafficleft"] / 1024 / 1024}) - if int(self.data[1]) / 1024 > info["trafficleft"]: + "left": info['trafficleft'] / 1024 / 1024}) + if int(self.data[1]) / 1024 > info['trafficleft']: self.logInfo(_("%s: Not enough traffic left" % self.__name__)) self.account.empty(self.user) self.resetAccount() diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index d5d1e6507..896858cbc 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -258,7 +258,7 @@ class XFileSharingPro(SimpleHoster): self.logDebug(self.HOSTER_NAME, inputs) - if 'op' in inputs and inputs['op'] in ('download2', 'download3'): + if 'op' in inputs and inputs['op'] in ("download2", "download3"): if "password" in inputs: if self.passwords: inputs['password'] = self.passwords.pop(0) diff --git a/module/plugins/hoster/XHamsterCom.py b/module/plugins/hoster/XHamsterCom.py index b5b548620..d11520cd5 100644 --- a/module/plugins/hoster/XHamsterCom.py +++ b/module/plugins/hoster/XHamsterCom.py @@ -54,13 +54,13 @@ class XHamsterCom(Hoster): j = clean_json(json_flashvar.group(1)) flashvars = json_loads(j) - if flashvars["srv"]: - srv_url = flashvars["srv"] + '/' + if flashvars['srv']: + srv_url = flashvars['srv'] + '/' else: self.fail("Parse error (srv_url)") - if flashvars["url_mode"]: - url_mode = flashvars["url_mode"] + if flashvars['url_mode']: + url_mode = flashvars['url_mode'] else: self.fail("Parse error (url_mode)") @@ -72,8 +72,8 @@ class XHamsterCom(Hoster): long_url = srv_url + file_url self.logDebug("long_url: %s" % long_url) else: - if flashvars["file"]: - file_url = unquote(flashvars["file"]) + if flashvars['file']: + file_url = unquote(flashvars['file']) else: self.fail("Parse error (file_url)") diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index d6083e4f7..8f3fb284f 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -166,31 +166,31 @@ class Xdcc(Hoster): "text": msg[3][1:] } - if nick == msg["target"][0:len(nick)] and "PRIVMSG" == msg["action"]: - if msg["text"] == "\x01VERSION\x01": + if nick == msg['target'][0:len(nick)] and "PRIVMSG" == msg['action']: + if msg['text'] == "\x01VERSION\x01": self.logDebug("XDCC: Sending CTCP VERSION.") sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) - elif msg["text"] == "\x01TIME\x01": + elif msg['text'] == "\x01TIME\x01": self.logDebug("Sending CTCP TIME.") sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) - elif msg["text"] == "\x01LAG\x01": + elif msg['text'] == "\x01LAG\x01": pass # don't know how to answer - if not (bot == msg["origin"][0:len(bot)] - and nick == msg["target"][0:len(nick)] - and msg["action"] in ("PRIVMSG", "NOTICE")): + if not (bot == msg['origin'][0:len(bot)] + and nick == msg['target'][0:len(nick)] + and msg['action'] in ("PRIVMSG", "NOTICE")): continue if self.debug is 1: - print "%s: %s" % (msg["origin"], msg["text"]) + print "%s: %s" % (msg['origin'], msg['text']) - if "You already requested that pack" in msg["text"]: + if "You already requested that pack" in msg['text']: retry = time.time() + 300 - if "you must be on a known channel to request a pack" in msg["text"]: + if "you must be on a known channel to request a pack" in msg['text']: self.fail("Wrong channel") - m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg["text"]) + m = re.match('\x01DCC SEND (.*?) (\d+) (\d+)(?: (\d+))?\x01', msg['text']) if m: done = True diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 0aca311ce..a7cd924bf 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -53,7 +53,7 @@ class YibaishiwuCom(SimpleHoster): for m in mirrors: try: - url = m['url'].replace('\\', '') + url = m['url'].replace("\\", "") self.logDebug("Trying URL: " + url) self.download(url) break diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py index 6505eac1a..eb260298b 100644 --- a/module/plugins/hoster/YoutubeCom.py +++ b/module/plugins/hoster/YoutubeCom.py @@ -23,7 +23,7 @@ def which(program): if is_exe(program): return program else: - for path in os.environ["PATH"].split(os.pathsep): + for path in os.environ['PATH'].split(os.pathsep): path = path.strip('"') exe_file = os.path.join(path, program) if is_exe(exe_file): diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 0dea76109..46d943bd7 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -141,8 +141,8 @@ class MultiHoster(Hook): self.logDebug("Overwritten Hosters: %s" % ", ".join(sorted(self.supported))) for hoster in self.supported: dict = self.core.pluginManager.hosterPlugins[hoster] - dict["new_module"] = module - dict["new_name"] = self.__name__ + dict['new_module'] = module + dict['new_name'] = self.__name__ if excludedList: self.logInfo("The following hosters were not overwritten - account exists: %s" % ", ".join(sorted(excludedList))) @@ -158,17 +158,17 @@ class MultiHoster(Hook): self.logDebug("Regexp: %s" % regexp) dict = self.core.pluginManager.hosterPlugins[self.__name__] - dict["pattern"] = regexp - dict["re"] = re.compile(regexp) + dict['pattern'] = regexp + dict['re'] = re.compile(regexp) def unloadHoster(self, hoster): dict = self.core.pluginManager.hosterPlugins[hoster] if "module" in dict: - del dict["module"] + del dict['module'] if "new_module" in dict: - del dict["new_module"] - del dict["new_name"] + del dict['new_module'] + del dict['new_name'] def unload(self): """Remove override for all hosters. Scheduler job is removed by hookmanager""" @@ -178,8 +178,8 @@ class MultiHoster(Hook): # reset pattern klass = getattr(self.core.pluginManager.getPlugin(self.__name__), self.__name__) dict = self.core.pluginManager.hosterPlugins[self.__name__] - dict["pattern"] = getattr(klass, '__pattern__', r"^unmatchable$") - dict["re"] = re.compile(dict["pattern"]) + dict['pattern'] = getattr(klass, "__pattern__", r'^unmatchable$') + dict['re'] = re.compile(dict['pattern']) def downloadFailed(self, pyfile): """remove plugin override if download fails but not if file is offline/temp.offline""" diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index ba143f4d8..0dfecf0fb 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -291,7 +291,7 @@ class SimpleHoster(Hoster): return parseHtmlForm(attr_str, self.html, input_names) def checkTrafficLeft(self): - traffic = self.account.getAccountInfo(self.user, True)["trafficleft"] + traffic = self.account.getAccountInfo(self.user, True)['trafficleft'] if traffic == -1: return True size = self.pyfile.size / 1024 diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py index 28f801f3e..0251620ab 100644 --- a/module/plugins/internal/UnRar.py +++ b/module/plugins/internal/UnRar.py @@ -203,8 +203,8 @@ class UnRar(AbtractExtractor): args.append("-y") # set a password - if "password" in kwargs and kwargs["password"]: - args.append("-p%s" % kwargs["password"]) + if "password" in kwargs and kwargs['password']: + args.append("-p%s" % kwargs['password']) else: args.append("-p-") |