summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/MultishareCz.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/MultishareCz.py')
-rw-r--r--module/plugins/hoster/MultishareCz.py49
1 files changed, 18 insertions, 31 deletions
diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py
index 62acab84c..bbb77f525 100644
--- a/module/plugins/hoster/MultishareCz.py
+++ b/module/plugins/hoster/MultishareCz.py
@@ -1,18 +1,18 @@
# -*- coding: utf-8 -*-
+import random
import re
-from random import random
-
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class MultishareCz(SimpleHoster):
__name__ = "MultishareCz"
__type__ = "hoster"
- __version__ = "0.36"
+ __version__ = "0.40"
- __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+).*'
+ __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
__description__ = """MultiShare.cz hoster plugin"""
__license__ = "GPLv3"
@@ -21,47 +21,34 @@ class MultishareCz(SimpleHoster):
SIZE_REPLACEMENTS = [('&nbsp;', '')]
- MULTI_HOSTER = True
+ 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.info['pattern']['ID'])
-
+ def handleFree(self, pyfile):
+ self.download("http://www.multishare.cz/html/download_free.php", get={'ID': self.info['pattern']['ID']})
- def handlePremium(self):
- if not self.checkCredit():
- self.logWarning(_("Not enough credit left to download file"))
- self.resetAccount()
- self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.info['pattern']['ID'])
+ def handlePremium(self, pyfile):
+ self.download("http://www.multishare.cz/html/download_premium.php", get={'ID': self.info['pattern']['ID']})
- def handleMulti(self):
- self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": self.pyfile.url}, decode=True)
+ def handleMulti(self, pyfile):
+ self.html = self.load('http://www.multishare.cz/html/mms_ajax.php', post={"link": pyfile.url}, decode=True)
self.checkInfo()
- if not self.checkCredit():
+ if not self.checkTrafficLeft():
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}
-
- 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']
+ self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random.random() * 10000 * random.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)