def get_enabled_plugin_flows_for_plugin_type(plugin_type, library_id): """ Fetch all enabled plugin flows for a plugin type :param plugin_type: :param library_id: :return: """ plugin_handler = PluginsHandler() return plugin_handler.get_enabled_plugin_flows_for_plugin_type( plugin_type, library_id)
def export(library_id): from unmanic.libs.plugins import PluginsHandler # Read the library library_config = Library(library_id) # Get list of enabled plugins with their settings enabled_plugins = [] for enabled_plugin in library_config.get_enabled_plugins( include_settings=True): enabled_plugins.append({ 'plugin_id': enabled_plugin.get('plugin_id'), 'has_config': enabled_plugin.get('has_config'), 'settings': enabled_plugin.get('settings'), }) # Create plugin flow plugin_flow = {} plugin_handler = PluginsHandler() for plugin_type in plugin_handler.get_plugin_types_with_flows(): plugin_flow[plugin_type] = [] flow = plugin_handler.get_enabled_plugin_flows_for_plugin_type( plugin_type, library_id) for f in flow: plugin_flow[plugin_type].append(f.get('plugin_id')) return { "plugins": { "enabled_plugins": enabled_plugins, "plugin_flow": plugin_flow, }, "library_config": { "name": library_config.get_name(), "path": library_config.get_path(), 'enable_remote_only': library_config.get_enable_remote_only(), 'enable_scanner': library_config.get_enable_scanner(), 'enable_inotify': library_config.get_enable_inotify(), 'tags': library_config.get_tags(), }, }