diff options
Diffstat (limited to 'module/plugins/hoster/CzshareCom.py')
-rw-r--r-- | module/plugins/hoster/CzshareCom.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 01e120e5e..0e28f31dd 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "1.00" + __version__ = "1.01" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -39,7 +39,7 @@ class CzshareCom(SimpleHoster): USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' - def checkTrafficLeft(self): + def check_traffic_left(self): #: check if user logged in m = re.search(self.USER_CREDIT_PATTERN, self.html) if m is None: @@ -52,32 +52,32 @@ class CzshareCom(SimpleHoster): #: check user credit try: credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2)) - self.logInfo(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) - self.logInfo(_("User %s has %i KiB left") % (self.user, credit / 1024)) + self.log_info(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024)) + self.log_info(_("User %s has %i KiB left") % (self.user, credit / 1024)) if credit < self.pyfile.size: - self.logInfo(_("Not enough credit to download file: %s") % self.pyfile.name) + self.log_info(_("Not enough credit to download file: %s") % self.pyfile.name) return False except Exception, e: #: let's continue and see what happens... - self.logError(e) + self.log_error(e) return True - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): #: parse download link try: form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) except Exception, e: - self.logError(e) - self.resetAccount() + self.log_error(e) + self.reset_account() #: download the file, destination is determined by pyLoad self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True) - def handleFree(self, pyfile): + def handle_free(self, pyfile): #: get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: @@ -85,7 +85,7 @@ class CzshareCom(SimpleHoster): parsed_url = "http://sdilej.cz" + m.group(1) - self.logDebug("PARSED_URL:" + parsed_url) + self.log_debug("PARSED_URL:" + parsed_url) #: get download ticket and parse html self.html = self.load(parsed_url) @@ -98,32 +98,32 @@ class CzshareCom(SimpleHoster): pyfile.size = int(inputs['size']) except Exception, e: - self.logError(e) + self.log_error(e) self.error(_("Form")) #: get and decrypt captcha captcha_url = 'http://sdilej.cz/captcha.php' for _i in xrange(5): - inputs['captchastring2'] = self.decryptCaptcha(captcha_url) + inputs['captchastring2'] = self.decrypt_captcha(captcha_url) self.html = self.load(parsed_url, post=inputs) if u"<li>Zadaný ověřovací kód nesouhlasí!</li>" in self.html: - self.invalidCaptcha() + self.invalid_captcha() elif re.search(self.MULTIDL_PATTERN, self.html): self.wait(5 * 60, 12, _("Download limit reached")) else: - self.correctCaptcha() + self.correct_captcha() break else: self.fail(_("No valid captcha code entered")) m = re.search("countdown_number = (\d+);", self.html) - self.setWait(int(m.group(1)) if m else 50) + self.set_wait(int(m.group(1)) if m else 50) #: download the file, destination is determined by pyLoad - self.logDebug("WAIT URL", self.req.lastEffectiveURL) + self.log_debug("WAIT URL", self.req.lastEffectiveURL) m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: @@ -134,9 +134,9 @@ class CzshareCom(SimpleHoster): self.wait() - def checkFile(self): + def check_file(self): #: check download - check = self.checkDownload({ + check = self.check_download({ "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), "credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), "multi-dl" : re.compile(self.MULTIDL_PATTERN), @@ -147,13 +147,13 @@ class CzshareCom(SimpleHoster): self.fail(_("File not available - try later")) elif check == "credit": - self.resetAccount() + self.reset_account() elif check == "multi-dl": self.wait(5 * 60, 12, _("Download limit reached")) elif check == "captcha": - self.invalidCaptcha() + self.invalid_captcha() self.retry() return super(CzshareCom, self).checkFile() |