summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/JustPremium.py
diff options
context:
space:
mode:
authorGravatar lazlev <lazlev@yopmail.com> 2015-08-09 00:50:54 +0200
committerGravatar lazlev <lazlev@yopmail.com> 2015-08-09 00:50:54 +0200
commitb0ef3f1673e1930916604bb1264ca3a38414bc8d (patch)
treec97936e4d2a4cd6eb1072c65c8a08a7d18816b18 /module/plugins/hooks/JustPremium.py
parent[XFileSharingPro][XFileSharingProFolder] Added default __pattern__ (diff)
parentFix https://github.com/pyload/pyload/issues/1707 (diff)
downloadpyload-b0ef3f1673e1930916604bb1264ca3a38414bc8d.tar.xz
Merge pull request #1 from pyload/stable
sync with stable
Diffstat (limited to 'module/plugins/hooks/JustPremium.py')
-rw-r--r--module/plugins/hooks/JustPremium.py33
1 files changed, 15 insertions, 18 deletions
diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py
index f66747f82..69a6a851b 100644
--- a/module/plugins/hooks/JustPremium.py
+++ b/module/plugins/hooks/JustPremium.py
@@ -2,13 +2,14 @@
import re
-from module.plugins.Hook import Hook
+from module.plugins.internal.Addon import Addon
-class JustPremium(Hook):
+class JustPremium(Addon):
__name__ = "JustPremium"
__type__ = "hook"
- __version__ = "0.22"
+ __version__ = "0.24"
+ __status__ = "testing"
__config__ = [("excluded", "str", "Exclude hosters (comma separated)", ""),
("included", "str", "Include hosters (comma separated)", "")]
@@ -20,28 +21,24 @@ class JustPremium(Hook):
("immenz" , "immenz@gmx.net" )]
- interval = 0 #@TODO: Remove in 0.4.10
+ def init(self):
+ self.event_map = {'linksAdded': "links_added"}
- def setup(self):
- self.info = {} #@TODO: Remove in 0.4.10
- self.event_list = ["linksAdded"]
+ def links_added(self, links, pid):
+ hosterdict = self.pyload.pluginManager.hosterPlugins
+ linkdict = self.pyload.api.checkURLs(links)
-
- def linksAdded(self, links, pid):
- hosterdict = self.core.pluginManager.hosterPlugins
- linkdict = self.core.api.checkURLs(links)
-
- premiumplugins = set(account.type for account in self.core.api.getAccounts(False) \
+ premiumplugins = set(account.type for account in self.pyload.api.getAccounts(False) \
if account.valid and account.premium)
- multihosters = set(hoster for hoster in self.core.pluginManager.hosterPlugins \
+ multihosters = set(hoster for hoster in self.pyload.pluginManager.hosterPlugins \
if 'new_name' in hosterdict[hoster] \
and hosterdict[hoster]['new_name'] in premiumplugins)
excluded = map(lambda domain: "".join(part.capitalize() for part in re.split(r'(\.|\d+)', domain) if part != '.'),
- self.getConfig('excluded').replace(' ', '').replace(',', '|').replace(';', '|').split('|'))
+ self.get_config('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('|'))
+ self.get_config('included').replace(' ', '').replace(',', '|').replace(';', '|').split('|'))
hosterlist = (premiumplugins | multihosters).union(excluded).difference(included)
@@ -50,7 +47,7 @@ class JustPremium(Hook):
return
for pluginname in set(linkdict.keys()) - hosterlist:
- self.logInfo(_("Remove links of plugin: %s") % pluginname)
+ self.log_info(_("Remove links of plugin: %s") % pluginname)
for link in linkdict[pluginname]:
- self.logDebug("Remove link: %s" % link)
+ self.log_debug("Remove link: %s" % link)
links.remove(link)