diff options
Diffstat (limited to 'module/plugins/hooks/MultishareCz.py')
-rw-r--r-- | module/plugins/hooks/MultishareCz.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index a934f43ef..a00c6cb2b 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -11,26 +11,30 @@ def getConfigSet(option): class MultishareCz(MultiHoster): __name__ = "MultishareCz" - __version__ = "0.01" + __version__ = "0.03" __type__ = "hook" __config__ = [("activated", "bool", "Activated", "False"), - ("includeHoster", "str", "Use only for downloads from (bar-separated hosters)", ""), - ("excludeHoster", "str", "Do not use for downloads from (bar-separated hosters)", "rapidshare.com|uloz.to")] + ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), + ("hosterList", "str", "Hoster list (comma separated)", "uloz.to")] __description__ = """MultiShare.cz hook plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - #replacements = [("freakshare.net", "freakshare.com")] - HOSTER_PATTERN = r'<img class="logo-shareserveru"[^>]*alt="([^"]+)"></td>\s*<td class="stav"><img src="/img/loga/ok.png" alt="OK">' + 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/") - hoster = set(m.group(1).lower() for m in re.finditer(self.HOSTER_PATTERN, page)) + hosters = set(h.lower().strip() for h in re.findall(self.HOSTER_PATTERN, page)) - option = self.getConfig('includeHoster').strip() - if option: hoster &= getConfigSet(option) - option = self.getConfig('excludeHoster').strip() - if option: hoster -= getConfigSet(option) + 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(hoster)
\ No newline at end of file + return list(hosters)
\ No newline at end of file |