summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Jens Hörnlein <jens.hoernlein@googlemail.com> 2015-02-01 01:42:00 +0100
committerGravatar Jens Hörnlein <jens.hoernlein@googlemail.com> 2015-02-01 01:42:00 +0100
commit63651d0c9b32c85c1a55dbf6b5299881170dccff (patch)
tree716d9d09efa6746d90178405f3626e97d13c237f /module/plugins
parent[ExtractArchive] Fix http://forum.pyload.org/viewtopic.php?f=10&t=3990 (diff)
downloadpyload-63651d0c9b32c85c1a55dbf6b5299881170dccff.tar.xz
[JustPremium] Added Multi-Hosters recognition
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/hooks/JustPremium.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py
index 1b0ed4196..99af95e38 100644
--- a/module/plugins/hooks/JustPremium.py
+++ b/module/plugins/hooks/JustPremium.py
@@ -8,14 +8,15 @@ from module.plugins.Hook import Hook
class JustPremium(Hook):
__name__ = "JustPremium"
__type__ = "hook"
- __version__ = "0.19"
+ __version__ = "0.20"
__config__ = [("excluded", "str", "Exclude hosters (comma separated)", "")]
__description__ = """Remove all not premium links from urls added"""
__license__ = "GPLv3"
__authors__ = [("mazleu", "mazleica@gmail.com"),
- ("Walter Purcaro", "vuolter@gmail.com")]
+ ("Walter Purcaro", "vuolter@gmail.com"),
+ ("immenz", "immenz@gmx.net")]
event_list = ["linksAdded"]
@@ -24,15 +25,16 @@ class JustPremium(Hook):
def linksAdded(self, links, pid):
linkdict = self.core.api.checkURLs(links)
premiumplugins = set(account.type for account in self.core.api.getAccounts(False) if account.valid and account.premium)
-
- #: Found at least one hoster with account
- if not any(True for pluginname in linkdict if pluginname in premiumplugins):
+ multihoster = set(hoster for hoster in self.core.pluginManager.hosterPlugins if 'new_name' in self.core.pluginManager.hosterPlugins[hoster])
+
+ #: Found at least one hoster with account or multihoster
+ if not any(True for pluginname in linkdict if pluginname in premiumplugins | multihoster):
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('|'))
- for pluginname in set(linkdict.keys()) - premiumplugins.union(excluded):
+ for pluginname in set(linkdict.keys()) - (premiumplugins | set(excluded) | multihoster):
self.logInfo(_("Remove links of plugin: %s") % pluginname)
for link in linkdict[pluginname]:
self.logDebug("Remove link: %s" % link)