diff options
author | Stefano <l.stickell@yahoo.it> | 2013-07-22 20:50:34 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-07-22 20:50:34 +0200 |
commit | 2edeee0532ec6d6b4b26fd045a5971f67ca455da (patch) | |
tree | 8d656afc9c18f7dba7c05d6635f898fdf58d66d6 /module/plugins/hoster/MultishareCz.py | |
parent | Fixed PEP 8 violations in Crypters (diff) | |
download | pyload-2edeee0532ec6d6b4b26fd045a5971f67ca455da.tar.xz |
Fixed PEP 8 violations in Hosters
Diffstat (limited to 'module/plugins/hoster/MultishareCz.py')
-rw-r--r-- | module/plugins/hoster/MultishareCz.py | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index a0dda30b8..f9289a923 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -20,6 +20,7 @@ import re from random import random from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo + class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" @@ -31,50 +32,51 @@ class MultishareCz(SimpleHoster): FILE_INFO_PATTERN = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>' FILE_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.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() + self.handleFree() + else: + self.handleOverriden() 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() - + self.resetAccount() + self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) - + def handleOverriden(self): - if not self.premium: + if not self.premium: self.fail("Only premium users can download from other hosters") - - self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post = {"link": self.pyfile.url}, decode = True) - self.getFileInfo() - + + 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") - - 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} + + 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) - - def checkCredit(self): + 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)) - + self.logInfo("User %s has %i MB left" % (self.user, self.acc_info["trafficleft"] / 1024)) + return self.pyfile.size / 1024 <= self.acc_info["trafficleft"] -getInfo = create_getInfo(MultishareCz)
\ No newline at end of file + +getInfo = create_getInfo(MultishareCz) |