From 68248f809d1cad27c10bac1e84afb52d5bf49ed0 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Sat, 10 Dec 2011 00:12:58 +0100 Subject: megaupload #451, uploadedto #443 --- module/plugins/accounts/MultishareCz.py | 2 +- module/plugins/accounts/UploadedTo.py | 8 +++++--- module/plugins/hoster/MegauploadCom.py | 23 +++++++++++------------ module/plugins/hoster/MultishareCz.py | 26 +++++++++----------------- 4 files changed, 26 insertions(+), 33 deletions(-) diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 6b5402c08..cc3e430af 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -39,7 +39,7 @@ class MultishareCz(Account): html = req.load("http://www.multishare.cz/profil/", decode = True) found = re.search(self.TRAFFIC_LEFT_PATTERN, html) - trafficleft = parseFileSize(found.group('S'), found.group('U')) if found else 0 + trafficleft = parseFileSize(found.group('S'), found.group('U')) / 1024 if found else 0 self.premium = True if trafficleft else False html = req.load("http://www.multishare.cz/", decode = True) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index 0bc7c2fd0..b4d194396 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -23,7 +23,7 @@ from time import time class UploadedTo(Account): __name__ = "UploadedTo" - __version__ = "0.2" + __version__ = "0.21" __type__ = "account" __description__ = """ul.to account plugin""" __author_name__ = ("mkaay") @@ -45,8 +45,10 @@ class UploadedTo(Account): if raw_valid == "unlimited": validuntil = -1 else: - raw_valid = re.findall(r"\d+", raw_valid) - validuntil = time() + 24 * 60 * 60 * int(raw_valid[0]) + 60 * 60 * int(raw_valid[1]) + raw_valid = re.findall(r"(\d+) (weeks|days|hours)", raw_valid) + validuntil = time() + for n, u in raw_valid: + validuntil += 3600 * int(n) * {"weeks": 168, "days": 24, "hours": 1}[u] return {"validuntil":validuntil, "trafficleft":traffic, "maxtraffic":50*1024*1024} else: diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 87ac3f7f9..100553ebf 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -65,13 +65,15 @@ class MegauploadCom(Hoster): __name__ = "MegauploadCom" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?(megaupload)\.com/.*?(\?|&)d=(?P[0-9A-Za-z]+)" - __version__ = "0.27" + __version__ = "0.28" __description__ = """Megaupload.com Download Hoster""" __author_name__ = ("spoob") __author_mail__ = ("spoob@pyload.org") API_URL = "http://megaupload.com/mgr_linkcheck.php" - API_STATUS_MAPPING = {"0": statusMap['online'], "1": statusMap['offline'], "3": statusMap['temp. offline']} + API_STATUS_MAPPING = {"0": statusMap['online'], "1": statusMap['offline'], "3": statusMap['temp. offline']} + + FILE_URL_PATTERN = r'\d+).*" + __version__ = "0.34" __description__ = """MultiShare.cz""" __author_name__ = ("zoidberg") - FILE_ID_PATTERN = r'/stahnout/(?P\d+)/' FILE_INFO_PATTERN = ur'(?:
  • Název|Soubor): (?P[^<]+)<(?:/li>Velikost: (?P[^<]+)' FILE_OFFLINE_PATTERN = ur'

    Stáhnout soubor

    Požadovaný soubor neexistuje.

    ' FILE_SIZE_REPLACEMENTS = [(' ', '')] def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): + msurl = re.match(self.__pattern__, pyfile.url) + if msurl: + self.fileID = msurl.group('ID') self.html = self.load(pyfile.url, decode = True) - self.getFileInfo() + self.getFileInfo() + if self.premium: self.handlePremium() else: @@ -45,18 +47,14 @@ class MultishareCz(SimpleHoster): self.handleOverriden() def handleFree(self): - self.download("http://www.multishare.cz/html/download_free.php", get={ - "ID": self.getFileID() - }) + 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.download("http://www.multishare.cz/html/download_premium.php", get={ - "ID": self.getFileID() - }) + self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.fileID) def handleOverriden(self): if not self.premium: @@ -73,12 +71,6 @@ class MultishareCz(SimpleHoster): self.logDebug(url, params) self.download(url, get = params) - def getFileID(self): - found = re.search(self.FILE_ID_PATTERN, self.pyfile.url) - if not found: self.fail("Parse error (ID)") - - return found.group('ID') - 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)) -- cgit v1.2.3