diff options
author | Jens Hörnlein <jens.hoernlein@googlemail.com> | 2015-03-01 14:14:32 +0100 |
---|---|---|
committer | Jens Hörnlein <jens.hoernlein@googlemail.com> | 2015-03-01 14:28:07 +0100 |
commit | 5eb1729ab45fcdb4862f2b4e54bdb79d7f59a6a7 (patch) | |
tree | d92853f607728e047531b8d3f642318f05c1ca9d /module/plugins/hooks | |
parent | Spare code cosmetics (diff) | |
download | pyload-5eb1729ab45fcdb4862f2b4e54bdb79d7f59a6a7.tar.xz |
[JustPremium] Include hoster to remove
Diffstat (limited to 'module/plugins/hooks')
-rw-r--r-- | module/plugins/hooks/JustPremium.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py index 30a72c70f..daefbc30f 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -8,9 +8,10 @@ from module.plugins.Hook import Hook class JustPremium(Hook): __name__ = "JustPremium" __type__ = "hook" - __version__ = "0.21" + __version__ = "0.22" - __config__ = [("excluded", "str", "Exclude hosters (comma separated)", "")] + __config__ = [("excluded", "str", "Exclude hosters (comma separated)", ""), + ("included", "str", "Include hosters (comma separated)", "")] __description__ = """Remove not-premium links from added urls""" __license__ = "GPLv3" @@ -32,14 +33,18 @@ class JustPremium(Hook): if 'new_name' in hosterdict[hoster] \ and hosterdict[hoster]['new_name'] in premiumplugins) - #: Found at least one hoster with account or multihoster - if not any(True for pluginname in linkdict if pluginname in premiumplugins | multihosters): - return - excluded = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), self.getConfig('excluded').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) + included = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'), + self.getConfig('included').replace(' ', '').replace(',', '|').replace(';', '|').split('|')) + + hosterlist = (premiumplugins | multihosters).union(excluded).difference(included) + + #: Found at least one hoster with account or multihoster + if not any( True for pluginname in linkdict if pluginname in hosterlist ): + return - for pluginname in set(linkdict.keys()) - (premiumplugins | multihosters).union(excluded): + for pluginname in set(linkdict.keys()) - hosterlist: self.logInfo(_("Remove links of plugin: %s") % pluginname) for link in linkdict[pluginname]: self.logDebug("Remove link: %s" % link) |