diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-09-24 23:54:50 +0200 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-09-24 23:54:50 +0200 |
commit | b65c4091d5c5e793d8a9df17a46657d45c3a1292 (patch) | |
tree | 40a420e5213d28634b75408059a2dc3687e461d1 /module/plugins/hooks | |
parent | update hellshare/hellspy patterns (diff) | |
download | pyload-b65c4091d5c5e793d8a9df17a46657d45c3a1292.tar.xz |
multihosters - closed #618, store http/ftp accounts, add uptobox.com premium
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/AlldebridCom.py | 17 | ||||
-rw-r--r-- | module/plugins/hooks/Checksum.py | 53 | ||||
-rw-r--r-- | module/plugins/hooks/EasybytezCom.py | 24 | ||||
-rw-r--r-- | module/plugins/hooks/MultishareCz.py | 16 | ||||
-rw-r--r-- | module/plugins/hooks/Premium4Me.py | 15 | ||||
-rw-r--r-- | module/plugins/hooks/PremiumizeMe.py | 19 | ||||
-rw-r--r-- | module/plugins/hooks/RealdebridCom.py | 17 | ||||
-rw-r--r-- | module/plugins/hooks/RehostTo.py | 2 | ||||
-rw-r--r-- | module/plugins/hooks/ZeveraCom.py | 22 |
9 files changed, 71 insertions, 114 deletions
diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index f9657ed8c..91a0a6e5b 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" - __version__ = "0.11" + __version__ = "0.12" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), @@ -19,21 +19,8 @@ class AlldebridCom(MultiHoster): __author_name__ = ("Andy, Voigt") __author_mail__ = ("spamsales@online.de") - replacements = [("freakshare.net", "freakshare.com")] - def getHoster(self): https = "https" if self.getConfig("https") else "http" page = getURL(https + "://www.alldebrid.com/api.php?action=get_host").replace("\"","").strip() - hosters = set([x.strip() for x in page.split(",") if x.strip()]) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - else: - hosters -= configList - - return list(hosters) + return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py index aec4bd0d7..b290838bb 100644 --- a/module/plugins/hooks/Checksum.py +++ b/module/plugins/hooks/Checksum.py @@ -19,7 +19,8 @@ from __future__ import with_statement import hashlib, zlib from os import remove -from os.path import getsize, isfile +from os.path import getsize, isfile, splitext +import re from module.utils import save_join, fs_encode from module.plugins.Hook import Hook @@ -50,7 +51,7 @@ def computeChecksum(local_file, algorithm): class Checksum(Hook): __name__ = "Checksum" - __version__ = "0.06" + __version__ = "0.07" __description__ = "Verify downloaded file size and checksum (enable in general preferences)" __config__ = [("activated", "bool", "Activated", True), ("action", "fail;retry;nothing", "What to do if check fails?", "retry"), @@ -58,12 +59,19 @@ class Checksum(Hook): __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") + methods = { 'sfv':'crc32', 'crc': 'crc32', 'hash': 'md5'} + regexps = { 'sfv': r'^(?P<name>[^;].+)\s+(?P<hash>[0-9A-Fa-f]{8})$', + 'md5': r'^(?P<name>[0-9A-Fa-f]{32}) (?P<file>.+)$', + 'crc': r'filename=(?P<name>.+)\nsize=(?P<size>\d+)\ncrc32=(?P<hash>[0-9A-Fa-f]{8})$', + 'default': r'^(?P<hash>[0-9A-Fa-f]+)\s+\*?(?P<name>.+)$' } + def setup(self): - self.algorithms = sorted(getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse = True) - self.algorithms.extend(["crc32", "adler32"]) - if not self.config['general']['checksum']: - self.logInfo("Checksum validation is disabled in general configuration") + self.logInfo("Checksum validation is disabled in general configuration") + + self.algorithms = sorted(getattr(hashlib, "algorithms", ("md5", "sha1", "sha224", "sha256", "sha384", "sha512")), reverse = True) + self.algorithms.extend(["crc32", "adler32"]) + self.formats = self.algorithms + ['sfv', 'crc', 'hash'] def downloadFinished(self, pyfile): """ @@ -127,4 +135,35 @@ class Checksum(Hook): elif action == "retry": if local_file: remove(local_file) - pyfile.plugin.retry(reason = msg, max_tries = self.getConfig("max_tries"))
\ No newline at end of file + pyfile.plugin.retry(reason = msg, max_tries = self.getConfig("max_tries")) + + + def packageFinished(self, pypack): + download_folder = save_join(self.config['general']['download_folder'], pypack.folder, "") + + for link in pypack.getChildren().itervalues(): + file_type = splitext(link["name"])[1][1:].lower() + #self.logDebug(link, file_type) + + if file_type not in self.formats: + continue + + hash_file = fs_encode(save_join(download_folder, link["name"])) + if not isfile(hash_file): + self.logWarning("File not found: %s" % link["name"]) + continue + + with open(hash_file) as f: + text = f.read() + + for m in re.finditer(self.regexps.get(file_type, self.regexps['default']), text): + data = m.groupdict() + self.logDebug(link["name"], data) + + local_file = fs_encode(save_join(download_folder, data["name"])) + algorithm = self.methods.get(file_type, file_type) + checksum = computeChecksum(local_file, algorithm) + if checksum == data["hash"]: + self.logInfo('File integrity of "%s" verified by %s checksum (%s).' % (data["name"], algorithm, checksum)) + else: + self.logWarning("%s checksum for file %s does not match (%s != %s)" % (algorithm, data["name"], checksum, data["hash"]))
\ No newline at end of file diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 21a988555..22b9050b4 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -11,7 +11,7 @@ def getConfigSet(option): class EasybytezCom(MultiHoster): __name__ = "EasybytezCom" - __version__ = "0.02" + __version__ = "0.03" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), @@ -21,16 +21,16 @@ class EasybytezCom(MultiHoster): __author_mail__ = ("zoidberg@mujmail.cz") def getHoster(self): - - hoster = set(['2shared.com', 'easy-share.com', 'filefactory.com', 'fileserve.com', 'filesonic.com', 'hotfile.com', 'mediafire.com', 'megaupload.com', 'netload.in', 'rapidshare.com', 'uploading.com', 'wupload.com', 'oron.com', 'uploadstation.com', 'ul.to', 'uploaded.to']) + self.account = self.core.accountManager.getAccountPlugin(self.__name__) + user = self.account.selectAccount()[0] - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hoster &= configList - else: - hoster -= configList + try: + req = self.account.getAccountRequest(user) + page = req.load("http://www.easybytez.com") - return list(hoster)
\ No newline at end of file + found = re.search(r'</textarea>\s*Supported sites:(.*)', page) + return found.group(1).split(',') + except Exception, e: + self.logDebug(e) + self.logWarning("Unable to load supported hoster list, using last known") + return ['bitshare.com', 'crocko.com', 'ddlstorage.com', 'depositfiles.com', 'extabit.com', 'hotfile.com', 'mediafire.com', 'netload.in', 'rapidgator.net', 'rapidshare.com', 'uploading.com', 'uload.to', 'uploaded.to']
\ No newline at end of file diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index a00c6cb2b..f8fa9290a 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -11,7 +11,7 @@ def getConfigSet(option): class MultishareCz(MultiHoster): __name__ = "MultishareCz" - __version__ = "0.03" + __version__ = "0.04" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), @@ -20,21 +20,9 @@ class MultishareCz(MultiHoster): __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - replacements = [("share-rapid.cz", "sharerapid.com")] HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*?alt="([^"]+)"></td>\s*<td class="stav">[^>]*?alt="OK"' def getHoster(self): page = getURL("http://www.multishare.cz/monitoring/") - hosters = set(h.lower().strip() for h in re.findall(self.HOSTER_PATTERN, page)) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - elif configMode == "unlisted": - hosters -= configList - - return list(hosters)
\ No newline at end of file + return re.findall(self.HOSTER_PATTERN, page)
\ No newline at end of file diff --git a/module/plugins/hooks/Premium4Me.py b/module/plugins/hooks/Premium4Me.py index fc3ce2343..b49eb41a9 100644 --- a/module/plugins/hooks/Premium4Me.py +++ b/module/plugins/hooks/Premium4Me.py @@ -15,23 +15,10 @@ class Premium4Me(MultiHoster): __author_name__ = ("RaNaN", "zoidberg")
__author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
- replacements = [("freakshare.net", "freakshare.com")]
-
def getHoster(self):
page = getURL("http://premium4.me/api/hosters.php?authcode=%s" % self.account.authcode)
- hosters = set([x.strip() for x in page.replace("\"", "").split(";")])
-
- configMode = self.getConfig('hosterListMode')
- if configMode in ("listed", "unlisted"):
- configList = set(self.getConfig('hosterList').strip().lower().replace(',','|').split('|'))
- configList.discard(u'')
- if configMode == "listed":
- hosters &= configList
- elif configMode == "unlisted":
- hosters -= configList
-
- return list(hosters)
+ return [x.strip() for x in page.replace("\"", "").split(";")]
def coreReady(self):
diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index 3825e9219..37905c23e 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -5,7 +5,7 @@ from module.network.RequestFactory import getURL class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" - __version__ = "0.1" + __version__ = "0.11" __type__ = "hook" __description__ = """Premiumize.Me hook plugin""" @@ -16,8 +16,6 @@ class PremiumizeMe(MultiHoster): __author_name__ = ("Florian Franzen") __author_mail__ = ("FlorianFranzen@gmail.com") - replacements = [("freakshare.net", "freakshare.com")] - interval = 0 # Disable periodic calls, we dont use them anyway def getHoster(self): @@ -38,20 +36,7 @@ class PremiumizeMe(MultiHoster): return [] # Extract hosters from json file - hosters = set(data['result']['hosterlist']) - - - # Read config to check if certain hosters should not be handled - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - else: - hosters -= configList - - return list(hosters) + return data['result']['hosterlist'] def coreReady(self): # Get account plugin and check if there is a valid account available diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py index bd3179673..0f06d14bc 100644 --- a/module/plugins/hooks/RealdebridCom.py +++ b/module/plugins/hooks/RealdebridCom.py @@ -5,7 +5,7 @@ from module.plugins.internal.MultiHoster import MultiHoster class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" - __version__ = "0.41" + __version__ = "0.42" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), @@ -16,21 +16,8 @@ class RealdebridCom(MultiHoster): __author_name__ = ("Devirex, Hazzard") __author_mail__ = ("naibaf_11@yahoo.de") - replacements = [("freakshare.net", "freakshare.com")] - def getHoster(self): https = "https" if self.getConfig("https") else "http" page = getURL(https + "://real-debrid.com/api/hosters.php").replace("\"","").strip() - hosters = set([x.strip() for x in page.split(",") if x.strip()]) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - else: - hosters -= configList - - return list(hosters) + return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index b16987f5c..8903bd07f 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -14,8 +14,6 @@ class RehostTo(MultiHoster): __author_name__ = ("RaNaN") __author_mail__ = ("RaNaN@pyload.org") - replacements = [("freakshare.net", "freakshare.com")] - def getHoster(self): page = getURL("http://rehost.to/api.php?cmd=get_supported_och_dl&long_ses=%s" % self.long_ses) diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py index 46c752c21..cadf60069 100644 --- a/module/plugins/hooks/ZeveraCom.py +++ b/module/plugins/hooks/ZeveraCom.py @@ -5,29 +5,15 @@ from module.plugins.internal.MultiHoster import MultiHoster class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" - __version__ = "0.01" + __version__ = "0.02" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), ("hosterList", "str", "Hoster list (comma separated)", "")] __description__ = """Real-Debrid.com hook plugin""" - __author_name__ = ("Devirex, Hazzard") - __author_mail__ = ("naibaf_11@yahoo.de") - - replacements = [("freakshare.net", "freakshare.com"), ("2shared.com", "twoshared.com"), ("4shared.com", "fourshared.com"), - ("easy-share.com", "crocko.com"), ("hellshare.com", "hellshare.cz")] + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") def getHoster(self): page = getURL("http://www.zevera.com/jDownloader.ashx?cmd=gethosters") - hosters = set([x.strip() for x in page.replace("\"", "").split(",")]) - - configMode = self.getConfig('hosterListMode') - if configMode in ("listed", "unlisted"): - configList = set(self.getConfig('hosterList').strip().lower().replace('|',',').replace(';',',').split(',')) - configList.discard(u'') - if configMode == "listed": - hosters &= configList - else: - hosters -= configList - - return list(hosters)
\ No newline at end of file + return [x.strip() for x in page.replace("\"", "").split(",")]
\ No newline at end of file |