diff options
Diffstat (limited to 'module/plugins/hoster/QuickshareCz.py')
-rw-r--r-- | module/plugins/hoster/QuickshareCz.py | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 1e0750b88..4311a82aa 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -9,7 +9,8 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" - __version__ = "0.56" + __version__ = "0.57" + __status__ = "testing" __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' __config__ = [("use_premium", "bool", "Use premium account if available", True)] @@ -25,39 +26,39 @@ class QuickshareCz(SimpleHoster): def process(self, pyfile): - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() + self.html = self.load(pyfile.url) + self.get_fileInfo() - # parse js variables + #: Parse js variables self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'.+?')", self.html)) - self.logDebug(self.jsvars) + self.log_debug(self.jsvars) pyfile.name = self.jsvars['ID3'] - # determine download type - free or premium + #: Determine download type - free or premium if self.premium: if 'UU_prihlasen' in self.jsvars: - if self.jsvars['UU_prihlasen'] == '0': - self.logWarning(_("User not logged in")) + if self.jsvars['UU_prihlasen'] == "0": + self.log_warning(_("User not logged in")) self.relogin(self.user) self.retry() elif float(self.jsvars['UU_kredit']) < float(self.jsvars['kredit_odecet']): - self.logWarning(_("Not enough credit left")) + self.log_warning(_("Not enough credit left")) self.premium = False if self.premium: - self.handlePremium(pyfile) + self.handle_premium(pyfile) else: - self.handleFree(pyfile) + self.handle_free(pyfile) - if self.checkDownload({"error": re.compile(r"\AChyba!")}, max_size=100): + if self.check_download({'error': re.compile(r"\AChyba!")}, max_size=100): self.fail(_("File not m or plugin defect")) - def handleFree(self, pyfile): - # get download url + def handle_free(self, pyfile): + #: Get download url download_url = '%s/download.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4")) - self.logDebug("FREE URL1:" + download_url, data) + self.log_debug("FREE URL1:" + download_url, data) self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) self.load(download_url, post=data) @@ -69,20 +70,20 @@ class QuickshareCz(SimpleHoster): self.fail(_("File not found")) self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10 - self.logDebug("FREE URL2:" + self.link) + self.log_debug("FREE URL2:" + self.link) - # check errors + #: Check errors m = re.search(r'/chyba/(\d+)', self.link) if m: - if m.group(1) == '1': + if m.group(1) == "1": self.retry(60, 2 * 60, "This IP is already downloading") - elif m.group(1) == '2': + elif m.group(1) == "2": self.retry(60, 60, "No free slots available") else: self.fail(_("Error %d") % m.group(1)) - def handlePremium(self, pyfile): + def handle_premium(self, pyfile): download_url = '%s/download_premium.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) self.download(download_url, get=data) |