From 7a386102e272abf12fc8a03733538421b2711045 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 22 Nov 2013 23:00:43 +0100 Subject: improved addonManager, new property to expose addon information, new functionality to interact with addons --- pyload/api/AddonApi.py | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'pyload/api/AddonApi.py') diff --git a/pyload/api/AddonApi.py b/pyload/api/AddonApi.py index 12d3170d7..ea1e3ce6e 100644 --- a/pyload/api/AddonApi.py +++ b/pyload/api/AddonApi.py @@ -5,25 +5,49 @@ from pyload.Api import Api, RequirePerm, Permission from ApiComponent import ApiComponent - +# TODO: multi user class AddonApi(ApiComponent): """ Methods to interact with addons """ + @RequirePerm(Permission.Interaction) def getAllInfo(self): """Returns all information stored by addon plugins. Values are always strings - :return: {"plugin": {"name": value } } + :return: """ - return self.core.addonManager.getAllInfo() + # TODO + @RequirePerm(Permission.Interaction) def getInfoByPlugin(self, plugin): - """Returns information stored by a specific plugin. + """Returns public information associated with specific plugin. - :param plugin: pluginname - :return: dict of attr names mapped to value {"name": value} + :param plugin: pluginName + :return: list of :class:`AddonInfo` """ return self.core.addonManager.getInfo(plugin) + @RequirePerm(Permission.Interaction) + def getAddonHandler(self): + """ Lists all available addon handler + + :return: dict of plugin name to list of :class:`AddonService` + """ + handler = {} + for name, data in self.core.addonManager.iterAddons(): + if data.handler: + handler[name] = data.handler + return handler + + @RequirePerm(Permission.Interaction) + def callAddon(self, plugin, func, arguments): + """ Calls any function exposed by an addon """ + pass + + @RequirePerm(Permission.Interaction) + def callAddonHandler(self, plugin, func, pid_or_fid): + """ Calls an addon handler registered to work with packages or files """ + pass + if Api.extend(AddonApi): del AddonApi \ No newline at end of file -- cgit v1.2.3