summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/XFileSharingPro.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hooks/XFileSharingPro.py')
-rw-r--r--module/plugins/hooks/XFileSharingPro.py44
1 files changed, 11 insertions, 33 deletions
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py
index a1ee7f5ef..78e14c179 100644
--- a/module/plugins/hooks/XFileSharingPro.py
+++ b/module/plugins/hooks/XFileSharingPro.py
@@ -2,10 +2,10 @@
import re
-from module.plugins.Hook import Hook
+from pyload.plugin.Addon import Addon
-class XFileSharingPro(Hook):
+class XFileSharingPro(Addon):
__name__ = "XFileSharingPro"
__type__ = "hook"
__version__ = "0.31"
@@ -45,20 +45,14 @@ class XFileSharingPro(Hook):
# self.loadPattern()
- #@TODO: Remove in 0.4.10
- def initPeriodical(self):
- pass
-
-
- def coreReady(self):
+ def activate(self):
self.loadPattern()
def loadPattern(self):
use_builtin_list = self.getConfig('use_builtin_list')
- for type, plugin in (("hoster", "XFileSharingPro"),
- ("crypter", "XFileSharingProFolder")):
+ for type in ("hoster", "crypter"):
every_plugin = not self.getConfig("use_%s_list" % type)
if every_plugin:
@@ -75,7 +69,7 @@ class XFileSharingPro(Hook):
if not plugin_set:
self.logInfo(_("No %s to handle") % type)
- self._unload(type, plugin)
+ self._unload(type)
return
match_list = '|'.join(sorted(plugin_set))
@@ -88,39 +82,23 @@ class XFileSharingPro(Hook):
pattern = self.regexp[type][1] % match_list.replace('.', '\.')
- dict = self.core.pluginManager.plugins[type][plugin]
+ dict = self.core.pluginManager.plugins[type]["XFileSharingPro"]
dict['pattern'] = pattern
dict['re'] = re.compile(pattern)
self.logDebug("Loaded %s pattern: %s" % (type, pattern))
- def _unload(self, type, plugin):
- dict = self.core.pluginManager.plugins[type][plugin]
+ def _unload(self, type):
+ dict = self.core.pluginManager.plugins[type]["XFileSharingPro"]
dict['pattern'] = r'^unmatchable$'
dict['re'] = re.compile(dict['pattern'])
- def unload(self):
+ def deactivate(self):
# self.unloadHoster("BasePlugin")
- for type, plugin in (("hoster", "XFileSharingPro"),
- ("crypter", "XFileSharingProFolder")):
- self._unload(type, plugin)
-
-
- def unloadHoster(self, hoster):
- hdict = self.core.pluginManager.hosterPlugins[hoster]
- if "new_name" in hdict and hdict['new_name'] == "XFileSharingPro":
- if "module" in hdict:
- hdict.pop('module', None)
-
- if "new_module" in hdict:
- hdict.pop('new_module', None)
- hdict.pop('new_name', None)
-
- return True
- else:
- return False
+ for type in ("hoster", "crypter"):
+ self._unload(type, "XFileSharingPro")
# def downloadFailed(self, pyfile):