diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-12 23:30:34 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-12 23:30:34 +0200 |
commit | 818ae3ce2c5ee6f47da2f508c786c3e2ab20ad45 (patch) | |
tree | 329bacf70c43a83a3e1878addd6c0b428ee26e7f /module/plugins | |
parent | [YoutubeBatch] Fix API_KEY (diff) | |
download | pyload-818ae3ce2c5ee6f47da2f508c786c3e2ab20ad45.tar.xz |
[XFileSharingPro] Match option
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/hooks/XFileSharingPro.py | 79 | ||||
-rw-r--r-- | module/plugins/internal/XFSPHoster.py | 5 |
2 files changed, 51 insertions, 33 deletions
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 44f2f544a..7b1b12549 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,52 +8,74 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.14" __config__ = [("activated", "bool", "Activated", True), - ("load_default", "bool", "Include default (built-in) hoster list", True), + ("match", "Always;Always except excluded;Listed only", "Match", "Always except excluded"), + ("load_default", "bool", "Include built-in hoster list", True), ("include_hosters", "str", "Include hosters (comma separated)", ""), ("exclude_hosters", "str", "Exclude hosters (comma separated)", "")] __description__ = """XFileSharingPro hook plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + event_list = ["pluginConfigChanged"] + + + def pluginConfigChanged(self, plugin, name, value): + if name != "activated": + self.loadPattern() def coreReady(self): - self.loadPattern() + self.pluginConfigChanged(self.__name__, "coreReady", None) def loadPattern(self): hoster_list = self.getConfigSet('include_hosters') exclude_list = self.getConfigSet('exclude_hosters') - if self.getConfig('load_default'): - hoster_list |= set(( - #WORKING HOSTERS: - "eyesfile.co", "eyesfile.com", "fileband.com", "filedwon.com", "hostingbulk.com", "linestorage.com", - "ravishare.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", - #NOT TESTED: - "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", - "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", - "vidbull.com", "zalaa.com", "zomgupload.com", - #NOT WORKING: - "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com" - )) - - hoster_list -= (exclude_list) - hoster_list -= set(('', u'')) - - if not hoster_list: - self.unload() - return - - regexp = r'http://(?:[^/]*\.)?(%s)/(?:embed-)?\w{12}' % ('|'.join(sorted(hoster_list)).replace('.', '\.')) + if self.getConfig("match") != "Listed only": + if self.getConfig("match") == "Always": + match_list = "" + else: + match_list = '|'.join(sorted(exclude_list)) + self.logDebug("Excluding %d hosters" % len(exclude_list), match_list.replace('|', ', ')) + + regexp = r'https?://(?!(?:www\.)?(?:%s))(?:www\.)?([\w^_]+(?:\.[a-zA-Z])+(?:\:\d+)?)/(?:embed-)?\w{12}' % match_list.replace('.', '\.') + + else: + if self.getConfig('load_default'): + hoster_list |= set(( + #WORKING HOSTERS: + "eyesfile.co", "eyesfile.com", "fileband.com", "filedwon.com", "hostingbulk.com", "linestorage.com", + "ravishare.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + #NOT TESTED: + "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", + "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", + "vidbull.com", "zalaa.com", "zomgupload.com", + #NOT WORKING: + "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com" + )) + + hoster_list -= (exclude_list) + hoster_list -= set(('', u'')) + + if not hoster_list: + self.unload() + return + + match_list = '|'.join(sorted(hoster_list)) + regexp = r'https?://(?:[^/]*\.)?(%s)/(?:embed-)?\w{12}' % match_list.replace('.', '\.') + self.logDebug("Handling %d hosters" % len(hoster_list), match_list.replace('|', ', ')) dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] dict['pattern'] = regexp dict['re'] = re.compile(regexp) - self.logDebug("Pattern loaded - handling %d hosters" % len(hoster_list)) + self.logDebug("Pattern loaded") def getConfigSet(self, option): @@ -62,6 +84,7 @@ class XFileSharingPro(Hook): def unload(self): + regexp = r'^unmatchable$' dict = self.core.pluginManager.hosterPlugins['XFileSharingPro'] - dict['pattern'] = r'^unmatchable$' - dict['re'] = re.compile(r'^unmatchable$') + dict['pattern'] = regexp + dict['re'] = re.compile(regexp) diff --git a/module/plugins/internal/XFSPHoster.py b/module/plugins/internal/XFSPHoster.py index 228a55c82..40bf26cfa 100644 --- a/module/plugins/internal/XFSPHoster.py +++ b/module/plugins/internal/XFSPHoster.py @@ -14,11 +14,6 @@ from module.utils import html_unescape class XFSPHoster(SimpleHoster): - """ - Common base for XFileSharingPro hosters like EasybytezCom, CramitIn, FiledinoCom... - Some hosters may work straight away when added to __pattern__ - However, most of them will NOT work because they are either down or running a customized version - """ __name__ = "XFSPHoster" __type__ = "hoster" __version__ = "0.02" |