diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/BoltsharingCom.py | 12 | ||||
-rw-r--r-- | module/plugins/accounts/HellshareCz.py | 28 | ||||
-rw-r--r-- | module/plugins/hoster/BoltsharingCom.py | 15 | ||||
-rw-r--r-- | module/plugins/hoster/HellshareCz.py | 21 | ||||
-rw-r--r-- | module/plugins/hoster/XFileSharingPro.py | 4 |
5 files changed, 55 insertions, 25 deletions
diff --git a/module/plugins/accounts/BoltsharingCom.py b/module/plugins/accounts/BoltsharingCom.py new file mode 100644 index 000000000..678591d1d --- /dev/null +++ b/module/plugins/accounts/BoltsharingCom.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class BoltsharingCom(XFSPAccount): + __name__ = "BoltsharingCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """Boltsharing.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + MAIN_PAGE = "http://boltsharing.com/" diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index 312b1e76b..c7a918dec 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -19,16 +19,17 @@ from module.plugins.Account import Account import re +import time class HellshareCz(Account): __name__ = "HellshareCz" - __version__ = "0.13" + __version__ = "0.14" __type__ = "account" __description__ = """hellshare.cz account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+)</th>' + CREDIT_LEFT_PATTERN = r'<div class="credit-link">\s*<table>\s*<tr>\s*<th>(\d+|\d\d\.\d\d\.)</th>' def loadAccountInfo(self, user, req): self.relogin(user) @@ -36,13 +37,30 @@ class HellshareCz(Account): found = re.search(self.CREDIT_LEFT_PATTERN, html) if found is None: - credits = 0 + trafficleft = None + validuntil = None premium = False else: - credits = int(found.group(1)) * 1024 + credit = found.group(1) premium = True + try: + if "." in credit: + #Time-based account + vt = [int(x) for x in credit.split('.')[:2]] + lt = time.localtime() + year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] == lt.tm_mon and vt[0] < lt.tm_mday)) + validuntil = time.mktime(time.strptime("%s%d 23:59:59" % (credit,year), "%d.%m.%Y %H:%M:%S")) + trafficleft = -1 + else: + #Traffic-based account + trafficleft = int(credit) * 1024 + validuntil = -1 + except Exception, e: + self.logError('Unable to parse credit info', e) + validuntil = -1 + trafficleft = -1 - return {"validuntil": -1, "trafficleft": credits, "premium": premium} + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} def login(self, user, data, req): html = req.load('http://www.hellshare.com/') diff --git a/module/plugins/hoster/BoltsharingCom.py b/module/plugins/hoster/BoltsharingCom.py new file mode 100644 index 000000000..2f42c8b23 --- /dev/null +++ b/module/plugins/hoster/BoltsharingCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class BoltsharingCom(XFileSharingPro): + __name__ = "BoltsharingCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)*?boltsharing.com/\w{12}" + __version__ = "0.01" + __description__ = """Boltsharing.com hoster plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + HOSTER_NAME = "boltsharing.com" + +getInfo = create_getInfo(BoltsharingCom) diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index fd9f2ac32..aa494e34e 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -25,17 +25,13 @@ class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" __pattern__ = r"(http://(?:.*\.)*hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+).*" - __version__ = "0.81" + __version__ = "0.82" __description__ = """Hellshare.cz - premium only""" __author_name__ = ("zoidberg") - PREMIUM_URL_PATTERN = r"launchFullDownload\('([^']*)'\);" FILE_NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' FILE_SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[0-9.]*) (?P<U>[kKMG])i?B</strong>' FILE_OFFLINE_PATTERN = r'<h1>File not found.</h1>' - #FILE_CREDITS_PATTERN = r'<strong class="filesize">(\d+) MB</strong>' - CREDIT_LEFT_PATTERN = r'<th>(\d+)</th><td>credits' - DOWNLOAD_AGAIN_PATTERN = r'<p>This file you downloaded already and re-download is for free. </p>' SHOW_WINDOW_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' def setup(self): @@ -47,25 +43,14 @@ class HellshareCz(SimpleHoster): pyfile.url = re.search(self.__pattern__, pyfile.url).group(1) self.html = self.load(pyfile.url, decode = True) self.getFileInfo() + if not self.checkTrafficLeft(): + self.fail("Not enough traffic left for user %s." % self.user) found = re.search(self.SHOW_WINDOW_PATTERN, self.html) if not found: self.parseError('SHOW WINDOW') self.url = "http://www.hellshare.com" + found.group(1) self.logDebug("DOWNLOAD URL: " + self.url) - # check credit - if self.DOWNLOAD_AGAIN_PATTERN in self.html: - self.logInfo("Downloading again for free") - else: - found = re.search(self.CREDIT_LEFT_PATTERN, self.html) - credits_left = int(found.group(1)) if found else (self.account.getAccountInfo(self.user, True)["trafficleft"] / 1024) - file_credits = ceil(self.pyfile.size / float(1024 ** 2)) - - if credits_left < file_credits: - self.fail("Not enough credit left for user %s: %d (%d needed)." % (self.user, credits_left, file_credits)) - else: - self.logInfo("Downloading file for %d credits, %d credits left" % (file_credits, credits_left)) - self.download(self.url) getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index d58a7073e..0bf7618c8 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -34,7 +34,7 @@ class XFileSharingPro(SimpleHoster): __name__ = "XFileSharingPro" __type__ = "hoster" __pattern__ = r"^unmatchable$" - __version__ = "0.14" + __version__ = "0.15" __description__ = """XFileSharingPro common hoster base""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -94,7 +94,7 @@ class XFileSharingPro(SimpleHoster): if not hasattr(self, "HOSTER_NAME"): self.HOSTER_NAME = re.search(self.__pattern__, self.pyfile.url).group(1) if not hasattr(self, "DIRECT_LINK_PATTERN"): - self.DIRECT_LINK_PATTERN = r'(http://(\w+\.%s|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\d+/\w+/)[^"\'<]+)' % self.HOSTER_NAME + self.DIRECT_LINK_PATTERN = r'(http://([^/]*?%s|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\d+/\w+/)[^"\'<]+)' % self.HOSTER_NAME self.captcha = self.errmsg = None self.passwords = self.getPassword().splitlines() |