|
|
- import pluginInterfaces as pi
-
- from yapsy.PluginManager import PluginManagerSingleton
-
-
- class Help(pi.IInterfacePlugin):
- """
- The help plugin print the usage information of prismedia’s plugins.
- Use it by simply calling `prismedia help <plugin_name>`.
- For example `prismedia help help` bring this help.
- """
-
- def prepare_options(self, video, options):
- pluginManager = PluginManagerSingleton.get()
-
- if options["<parameters>"]:
- parameters = options["<parameters>"]
- else:
- parameters = ["help"]
-
- for p in parameters:
- plugin = pluginManager.getPluginByName(p, pi.PluginTypes.ALL)
- if plugin is None:
- # TODO: log instead to warning? error?
- print("No plugin was found with name:", p)
- continue
-
- print(plugin.name + "\t" + plugin.description)
- print("Usage:", plugin.plugin_object.__doc__)
-
- if p == "help":
- print("The plugins are stored in the following folders:", pluginManager.getPluginLocator().plugins_places)
-
- print("Category:", pi.PluginTypes.INTERFACE.value)
- for plugin in pluginManager.getPluginsOfCategory(pi.PluginTypes.INTERFACE):
- print("\t" + plugin.name)
-
- print("Category:", pi.PluginTypes.PLATFORM.value)
- for plugin in pluginManager.getPluginsOfCategory(pi.PluginTypes.PLATFORM):
- print("\t" + plugin.name)
-
- print("Category:", pi.PluginTypes.CONSUMER.value)
- for plugin in pluginManager.getPluginsOfCategory(pi.PluginTypes.CONSUMER):
- print("\t" + plugin.name)
-
- # Print a line break between each plugin help.
- print()
-
- return False
|