diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-12-17 20:02:20 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-12-17 20:02:20 +0100 |
commit | 57300575fa97107d172e0c9909b244c8c8ae6c12 (patch) | |
tree | 86dcbc38175e55c3ac077ff9a894fe74bb3d54ea /module/plugins/hoster/MultishareCz.py | |
parent | [FilerNet] Typo (diff) | |
download | pyload-57300575fa97107d172e0c9909b244c8c8ae6c12.tar.xz |
Extend SimpleHoster in multi-hoster plugins
Diffstat (limited to 'module/plugins/hoster/MultishareCz.py')
-rw-r--r-- | module/plugins/hoster/MultishareCz.py | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index fc866e2b1..d7ddb753c 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -27,23 +27,8 @@ class MultishareCz(SimpleHoster): OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' - def process(self, pyfile): - msurl = re.match(self.__pattern__, pyfile.url) - if msurl: - self.fileID = msurl.group('ID') - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() - - if self.premium: - self.handlePremium() - else: - self.handleFree() - else: - self.handleOverriden() - - def handleFree(self): - self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.fileID) + self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.info['pattern']['ID']) def handlePremium(self): @@ -51,27 +36,29 @@ class MultishareCz(SimpleHoster): self.logWarning(_("Not enough credit left to download file")) self.resetAccount() - self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) - + self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.info['pattern']['ID']) - def handleOverriden(self): - if not self.premium: - self.fail(_("Only premium users can download from other hosters")) + def handleMulti(self): self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True) - self.getFileInfo() + + self.checkInfo() if not self.checkCredit(): self.fail(_("Not enough credit left to download file")) - url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()) + url = "http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()) params = {"u_ID": self.acc_info['u_ID'], "u_hash": self.acc_info['u_hash'], "link": self.pyfile.url} + self.logDebug(url, params) + + self.link = True self.download(url, get=params) def checkCredit(self): self.acc_info = self.account.getAccountInfo(self.user, True) + self.logInfo(_("User %s has %i MB left") % (self.user, self.acc_info['trafficleft'] / 1024)) return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] |