diff options
author | Walter Purcaro <vuolter@gmail.com> | 2015-02-02 00:33:17 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2015-02-02 00:33:17 +0100 |
commit | e265a18ec18c4260531f977c98ebb13d2074380b (patch) | |
tree | a18a4662a923970ed37466d048629522376417ba /module | |
parent | [XdadevelopersCom] Cleanup (diff) | |
download | pyload-e265a18ec18c4260531f977c98ebb13d2074380b.tar.xz |
[JustPremium] Cleanup
Diffstat (limited to 'module')
-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 99af95e38..b70d8dd2c 100644 --- a/module/plugins/hooks/JustPremium.py +++ b/module/plugins/hooks/JustPremium.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class JustPremium(Hook): __name__ = "JustPremium" __type__ = "hook" - __version__ = "0.20" + __version__ = "0.21" __config__ = [("excluded", "str", "Exclude hosters (comma separated)", "")] @@ -23,18 +23,23 @@ 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) - multihoster = set(hoster for hoster in self.core.pluginManager.hosterPlugins if 'new_name' in self.core.pluginManager.hosterPlugins[hoster]) - + hosterdict = self.core.pluginManager.hosterPlugins + linkdict = self.core.api.checkURLs(links) + + premiumplugins = set(account.type for account in self.core.api.getAccounts(False) \ + if account.valid and account.premium) + multihosters = set(hoster for hoster in self.core.pluginManager.hosterPlugins \ + 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 | 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('|')) - for pluginname in set(linkdict.keys()) - (premiumplugins | set(excluded) | multihoster): + for pluginname in set(linkdict.keys()) - (premiumplugins | multihosters).union(excluded): self.logInfo(_("Remove links of plugin: %s") % pluginname) for link in linkdict[pluginname]: self.logDebug("Remove link: %s" % link) |