From 8342aad089589479650703de915a356d634b202b Mon Sep 17 00:00:00 2001 From: Stefano Date: Sat, 23 Mar 2013 22:32:28 +0100 Subject: Plugins: fixed inconsistent indentation --- module/plugins/accounts/AlldebridCom.py | 26 ++++++++-------- module/plugins/crypter/LixIn.py | 19 ++++++----- module/plugins/crypter/TrailerzoneInfo.py | 4 +-- module/plugins/hooks/Captcha9kw.py | 52 +++++++++++++++---------------- module/plugins/hooks/ExtractArchive.py | 2 -- module/plugins/hoster/X7To.py | 2 +- 6 files changed, 51 insertions(+), 54 deletions(-) diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 7d4d245ba..beaddeac9 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -17,20 +17,20 @@ class AlldebridCom(Account): data = self.getAccountData(user) page = req.load("http://www.alldebrid.com/account/") soup=BeautifulSoup(page) - #Try to parse expiration date directly from the control panel page (better accuracy) + #Try to parse expiration date directly from the control panel page (better accuracy) try: - time_text=soup.find('div',attrs={'class':'remaining_time_text'}).strong.string - self.log.debug("Account expires in: %s" % time_text) - p = re.compile('\d+') - exp_data=p.findall(time_text) - exp_time=time()+int(exp_data[0])*24*60*60+int(exp_data[1])*60*60+(int(exp_data[2])-1)*60 - #Get expiration date from API + time_text=soup.find('div',attrs={'class':'remaining_time_text'}).strong.string + self.log.debug("Account expires in: %s" % time_text) + p = re.compile('\d+') + exp_data=p.findall(time_text) + exp_time=time()+int(exp_data[0])*24*60*60+int(exp_data[1])*60*60+(int(exp_data[2])-1)*60 + #Get expiration date from API except: - data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, data["password"])) - self.log.debug(page) - xml = dom.parseString(page) - exp_time=time()+int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue)*86400 + data = self.getAccountData(user) + page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, data["password"])) + self.log.debug(page) + xml = dom.parseString(page) + exp_time=time()+int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue)*86400 account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info @@ -40,7 +40,7 @@ class AlldebridCom(Account): page = req.load("http://www.alldebrid.com/register/?%s" % (urlparams)) if "This login doesn't exist" in page: - self.wrongPassword() + self.wrongPassword() if "The password is not valid" in page: self.wrongPassword() diff --git a/module/plugins/crypter/LixIn.py b/module/plugins/crypter/LixIn.py index 1ed5510fd..e2ee30731 100644 --- a/module/plugins/crypter/LixIn.py +++ b/module/plugins/crypter/LixIn.py @@ -33,7 +33,7 @@ class LixIn(Crypter): matches = re.search(self.SUBMIT_PATTERN,self.html) if not matches: - self.fail("link doesn't seem valid") + self.fail("link doesn't seem valid") matches = re.search(self.CAPTCHA_PATTERN, self.html) if matches: @@ -42,20 +42,19 @@ class LixIn(Crypter): if matches: self.logDebug("trying captcha") captcharesult = self.decryptCaptcha("http://lix.in/"+matches.group("image")) - self.html = self.req.load(url, decode=True, post={"capt" : captcharesult, "submit":"submit","tiny":id}) - else: - self.logDebug("no captcha/captcha solved") - break - else: + self.html = self.req.load(url, decode=True, post={"capt" : captcharesult, "submit":"submit","tiny":id}) + else: + self.logDebug("no captcha/captcha solved") + break + else: self.html = self.req.load(url, decode=True, post={"submit" : "submit", - "tiny" : id}) - + "tiny" : id}) + matches = re.search(self.LINK_PATTERN, self.html) if not matches: - self.fail("can't find destination url") + self.fail("can't find destination url") new_link = matches.group("link") self.logDebug("Found link %s, adding to package" % new_link) self.packages.append((self.pyfile.package().name, [new_link], self.pyfile.package().name)) - \ No newline at end of file diff --git a/module/plugins/crypter/TrailerzoneInfo.py b/module/plugins/crypter/TrailerzoneInfo.py index 2683c2429..43a4fcce5 100644 --- a/module/plugins/crypter/TrailerzoneInfo.py +++ b/module/plugins/crypter/TrailerzoneInfo.py @@ -22,10 +22,10 @@ class TrailerzoneInfo(Crypter): self.handleProtect(url) elif goPattern.match(url): self.handleGo(url) - + def handleProtect(self, url): self.handleGo("http://trailerzone.info/go.html#:::" + url.split("#:::",1)[1]) - + def handleGo(self, url): src = self.req.load(str(url)) diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index b34ffeb05..a01ce9576 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -62,40 +62,40 @@ class Captcha9kw(Hook): data = b64encode(data) self.logDebug("%s : %s" % (task.captchaFile, data)) if task.isPositional(): - mouse = 1 + mouse = 1 else: - mouse = 0 + mouse = 0 response = getURL(self.API_URL, post = { - "apikey": self.getConfig("passkey"), - "pyload": "1", - "source": "pyload", - "base64": "1", - "mouse": mouse, - "file-upload-01": data, - "action": "usercaptchaupload" }) + "apikey": self.getConfig("passkey"), + "pyload": "1", + "source": "pyload", + "base64": "1", + "mouse": mouse, + "file-upload-01": data, + "action": "usercaptchaupload" }) - if response.isdigit(): - self.logInfo(_("NewCaptchaID from upload: %s : %s" % (response,task.captchaFile))) + if response.isdigit(): + self.logInfo(_("NewCaptchaID from upload: %s : %s" % (response,task.captchaFile))) - for i in range(1, 200, 2): - response2 = getURL(self.API_URL, get = { "apikey": self.getConfig("passkey"), "id": response,"pyload": "1","source": "pyload", "action": "usercaptchacorrectdata" }) + for i in range(1, 200, 2): + response2 = getURL(self.API_URL, get = { "apikey": self.getConfig("passkey"), "id": response,"pyload": "1","source": "pyload", "action": "usercaptchacorrectdata" }) - if(response2 != ""): - break; + if(response2 != ""): + break; - time.sleep(1) + time.sleep(1) - result = response2 - task.data["ticket"] = response - self.logInfo("result %s : %s" % (response, result)) - task.setResult(result) - else: - self.logError("Bad upload: %s" % response) - return False + result = response2 + task.data["ticket"] = response + self.logInfo("result %s : %s" % (response, result)) + task.setResult(result) + else: + self.logError("Bad upload: %s" % response) + return False def newCaptchaTask(self, task): - if not task.isTextual() and not task.isPositional(): + if not task.isTextual() and not task.isPositional(): return False if not self.getConfig("passkey"): @@ -130,7 +130,7 @@ class Captcha9kw(Hook): except BadHeader, e: self.logError("Could not send correct request.", str(e)) else: - self.logError("No CaptchaID for correct request (task %s) found." % task) + self.logError("No CaptchaID for correct request (task %s) found." % task) def captchaInvalid(self, task): if "ticket" in task.data: @@ -150,4 +150,4 @@ class Captcha9kw(Hook): except BadHeader, e: self.logError("Could not send refund request.", str(e)) else: - self.logError("No CaptchaID for not correct request (task %s) found." % task) \ No newline at end of file + self.logError("No CaptchaID for not correct request (task %s) found." % task) diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index c789495ca..a5a973b7f 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -196,8 +196,6 @@ class ExtractArchive(Hook): files_ids = new_files_ids # also check extracted files if not matched: self.logInfo(_("No files found to extract")) - - def startExtracting(self, plugin, fid, passwords, thread): pyfile = self.core.files.getFile(fid) diff --git a/module/plugins/hoster/X7To.py b/module/plugins/hoster/X7To.py index 51f8e6cd4..79adf2a3f 100644 --- a/module/plugins/hoster/X7To.py +++ b/module/plugins/hoster/X7To.py @@ -55,7 +55,7 @@ class X7To(Hoster): file_id = re.search(r"var dlID = '(.*?)'", self.html) if not file_id: self.fail("Free download id not found") - + file_url = "http://x7.to/james/ticket/dl/" + file_id.group(1) self.logDebug("download id %s" % file_id.group(1)) -- cgit v1.2.3