summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/LetitbitNet.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-07-07 01:23:55 +0200
commitb1759bc440cd6013837697eb8de540914f693ffd (patch)
treed170caf63d7f65e44d23ea2d91a65759a1665928 /module/plugins/hoster/LetitbitNet.py
parent[Plugin] Fix decoding in load method (diff)
downloadpyload-b1759bc440cd6013837697eb8de540914f693ffd.tar.xz
No camelCase style anymore
Diffstat (limited to 'module/plugins/hoster/LetitbitNet.py')
-rw-r--r--module/plugins/hoster/LetitbitNet.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py
index 62afb6c7c..60634354b 100644
--- a/module/plugins/hoster/LetitbitNet.py
+++ b/module/plugins/hoster/LetitbitNet.py
@@ -12,7 +12,7 @@ import urlparse
from module.common.json_layer import json_loads, json_dumps
from module.network.RequestFactory import getURL
from module.plugins.internal.ReCaptcha import ReCaptcha
-from module.plugins.internal.SimpleHoster import SimpleHoster, secondsToMidnight
+from module.plugins.internal.SimpleHoster import SimpleHoster, seconds_to_midnight
def api_response(url):
@@ -22,7 +22,7 @@ def api_response(url):
return json_loads(api_rep)
-def getInfo(urls):
+def get_info(urls):
for url in urls:
api_rep = api_response(url)
if api_rep['status'] == 'OK':
@@ -35,7 +35,7 @@ def getInfo(urls):
class LetitbitNet(SimpleHoster):
__name__ = "LetitbitNet"
__type__ = "hoster"
- __version__ = "0.31"
+ __version__ = "0.32"
__pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+'
__config__ = [("use_premium", "bool", "Use premium account if available", True)]
@@ -53,16 +53,16 @@ class LetitbitNet(SimpleHoster):
def setup(self):
- self.resumeDownload = True
+ self.resume_download = True
- def handleFree(self, pyfile):
- action, inputs = self.parseHtmlForm('id="ifree_form"')
+ def handle_free(self, pyfile):
+ action, inputs = self.parse_html_form('id="ifree_form"')
if not action:
self.error(_("ifree_form"))
pyfile.size = float(inputs['sssize'])
- self.logDebug(action, inputs)
+ self.log_debug(action, inputs)
inputs['desc'] = ""
self.html = self.load(urlparse.urljoin("http://letitbit.net/", action), post=inputs)
@@ -70,12 +70,12 @@ class LetitbitNet(SimpleHoster):
m = re.search(self.SECONDS_PATTERN, self.html)
seconds = int(m.group(1)) if m else 60
- self.logDebug("Seconds found", seconds)
+ self.log_debug("Seconds found", seconds)
m = re.search(self.CAPTCHA_CONTROL_FIELD, self.html)
recaptcha_control_field = m.group(1)
- self.logDebug("ReCaptcha control field found", recaptcha_control_field)
+ self.log_debug("ReCaptcha control field found", recaptcha_control_field)
self.wait(seconds)
@@ -83,7 +83,7 @@ class LetitbitNet(SimpleHoster):
if res != '1':
self.error(_("Unknown response - ajax_check_url"))
- self.logDebug(res)
+ self.log_debug(res)
recaptcha = ReCaptcha(self)
response, challenge = recaptcha.challenge()
@@ -92,21 +92,21 @@ class LetitbitNet(SimpleHoster):
"recaptcha_response_field": response,
"recaptcha_control_field": recaptcha_control_field}
- self.logDebug("Post data to send", post_data)
+ self.log_debug("Post data to send", post_data)
res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data)
- self.logDebug(res)
+ self.log_debug(res)
if not res:
- self.invalidCaptcha()
+ self.invalid_captcha()
if res == "error_free_download_blocked":
- self.logWarning(_("Daily limit reached"))
- self.wait(secondsToMidnight(gmt=2), True)
+ self.log_warning(_("Daily limit reached"))
+ self.wait(seconds_to_midnight(gmt=2), True)
if res == "error_wrong_captcha":
- self.invalidCaptcha()
+ self.invalid_captcha()
self.retry()
elif res.startswith('['):
@@ -121,13 +121,13 @@ class LetitbitNet(SimpleHoster):
self.link = urls[0]
- def handlePremium(self, pyfile):
+ def handle_premium(self, pyfile):
api_key = self.user
premium_key = self.account.getAccountData(self.user)['password']
json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]]
api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)})
- self.logDebug("API Data: " + api_rep)
+ self.log_debug("API Data: " + api_rep)
api_rep = json_loads(api_rep)
if api_rep['status'] == 'FAIL':