diff options
| author | 2013-11-22 23:00:43 +0100 | |
|---|---|---|
| committer | 2013-11-22 23:00:43 +0100 | |
| commit | 7a386102e272abf12fc8a03733538421b2711045 (patch) | |
| tree | 4d1f1ef511bf3e3b3d95f78d35067885deffc01e /pyload/api | |
| parent | fixed and improved last pull request (diff) | |
| download | pyload-7a386102e272abf12fc8a03733538421b2711045.tar.xz | |
improved addonManager, new property to expose addon information, new functionality to interact with addons
Diffstat (limited to 'pyload/api')
| -rw-r--r-- | pyload/api/AddonApi.py | 36 | 
1 files changed, 30 insertions, 6 deletions
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  | 
