summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/CzshareCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/CzshareCom.py')
-rw-r--r--module/plugins/hoster/CzshareCom.py42
1 files changed, 19 insertions, 23 deletions
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py
index 3d2de5f7f..d678f25fa 100644
--- a/module/plugins/hoster/CzshareCom.py
+++ b/module/plugins/hoster/CzshareCom.py
@@ -12,7 +12,7 @@ from module.utils import parseFileSize as parse_size
class CzshareCom(SimpleHoster):
__name__ = "CzshareCom"
__type__ = "hoster"
- __version__ = "1.02"
+ __version__ = "1.04"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+'
@@ -40,11 +40,11 @@ class CzshareCom(SimpleHoster):
USER_CREDIT_PATTERN = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->'
- def check_traffic_left(self):
+ def check_traffic(self):
#: Check if user logged in
m = re.search(self.USER_CREDIT_PATTERN, self.html)
if m is None:
- self.account.relogin(self.user)
+ self.account.relogin()
self.html = self.load(self.pyfile.url)
m = re.search(self.USER_CREDIT_PATTERN, self.html)
if m is None:
@@ -54,10 +54,11 @@ class CzshareCom(SimpleHoster):
try:
credit = parse_size(m.group(1).replace(' ', ''), m.group(2))
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))
+ self.log_info(_("User %s has %i KiB left") % (self.account.user, credit / 1024))
if credit < self.pyfile.size:
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.log_error(e)
@@ -66,13 +67,13 @@ class CzshareCom(SimpleHoster):
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.log_error(e)
- self.restart(nopremium=True)
+ self.restart()
#: Download the file, destination is determined by pyLoad
self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True)
@@ -104,21 +105,17 @@ class CzshareCom(SimpleHoster):
#: Get and decrypt captcha
captcha_url = 'http://sdilej.cz/captcha.php'
- for _i in xrange(5):
- inputs['captchastring2'] = self.captcha.decrypt(captcha_url)
- self.html = self.load(parsed_url, post=inputs)
+ inputs['captchastring2'] = self.captcha.decrypt(captcha_url)
+ self.html = self.load(parsed_url, post=inputs)
- if u"<li>Zadaný ověřovací kód nesouhlasí!</li>" in self.html:
- self.captcha.invalid()
+ if u"<li>Zadaný ověřovací kód nesouhlasí!</li>" in self.html:
+ self.retry_captcha()
- elif re.search(self.MULTIDL_PATTERN, self.html):
- self.wait(5 * 60, 12, _("Download limit reached"))
+ elif re.search(self.MULTIDL_PATTERN, self.html):
+ self.wait(5 * 60, 12, _("Download limit reached"))
- else:
- self.captcha.correct()
- break
else:
- self.fail(_("No valid captcha code entered"))
+ self.captcha.correct()
m = re.search("countdown_number = (\d+);", self.html)
self.set_wait(int(m.group(1)) if m else 50)
@@ -135,9 +132,9 @@ class CzshareCom(SimpleHoster):
self.wait()
- def check_file(self):
+ def check_download(self):
#: Check download
- check = self.check_download({
+ check = self.check_file({
"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),
@@ -148,16 +145,15 @@ class CzshareCom(SimpleHoster):
self.fail(_("File not available - try later"))
elif check == "credit":
- self.restart(nopremium=True)
+ self.restart()
elif check == "multi-dl":
self.wait(5 * 60, 12, _("Download limit reached"))
elif check == "captcha":
- self.captcha.invalid()
- self.retry()
+ self.retry_captcha()
- return super(CzshareCom, self).check_file()
+ return super(CzshareCom, self).check_download()
getInfo = create_getInfo(CzshareCom)