diff options
Diffstat (limited to 'module/plugins/hoster/MultishareCz.py')
-rw-r--r-- | module/plugins/hoster/MultishareCz.py | 88 |
1 files changed, 30 insertions, 58 deletions
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index c2fbaf46e..7a6e73252 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -1,82 +1,54 @@ # -*- coding: utf-8 -*- -""" - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, see <http://www.gnu.org/licenses/>. -""" - import re + from random import random + from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): - __name__ = "MultishareCz" - __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?multishare.cz/stahnout/(?P<ID>\d+).*' - __version__ = "0.34" + __name__ = "MultishareCz" + __type__ = "hoster" + __version__ = "0.40" + + __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' + __description__ = """MultiShare.cz hoster plugin""" - __author_name__ = "zoidberg" - __author_mail__ = "zoidberg@mujmail.cz" + __license__ = "GPLv3" + __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - FILE_INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' - OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' - FILE_SIZE_REPLACEMENTS = [(' ', '')] - 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() + SIZE_REPLACEMENTS = [(' ', '')] - if self.premium: - self.handlePremium() - else: - self.handleFree() - else: - self.handleOverriden() + CHECK_TRAFFIC = True + MULTI_HOSTER = True + + INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' + OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' - def handleFree(self): - self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.fileID) - def handlePremium(self): - if not self.checkCredit(): - self.logWarning("Not enough credit left to download file") - self.resetAccount() + def handleFree(self, pyfile): + self.download("http://www.multishare.cz/html/download_free.php", get={'ID': self.info['pattern']['ID']}) - self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) - def handleOverriden(self): - if not self.premium: - self.fail("Only premium users can download from other hosters") + def handlePremium(self, pyfile): + self.download("http://www.multishare.cz/html/download_premium.php", get={'ID': self.info['pattern']['ID']}) - self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True) - self.getFileInfo() - if not self.checkCredit(): - self.fail("Not enough credit left to download file") + def handleMulti(self, pyfile): + self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": pyfile.url}, decode=True) - 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.download(url, get=params) + self.checkInfo() - 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)) + if not self.checkTrafficLeft(): + self.fail(_("Not enough credit left to download file")) - return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] + self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()), + get={'u_ID' : self.acc_info['u_ID'], + 'u_hash': self.acc_info['u_hash'], + 'link' : pyfile.url}, + disposition=True) getInfo = create_getInfo(MultishareCz) |