1 /* ncmpc (Ncurses MPD Client)
2 * (c) 2004-2009 The Music Player Daemon Project
3 * Project homepage: http://musicpd.org
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 * A list of registered plugins.
34 * When a plugin cycle is finished, this function is called. In any
35 * case, plugin_stop() has to be called to free all memory.
37 * @param result the plugin's output (stdout) on success; summary of all error
38 * messages on failure as determined by success
39 * @param success result of the plugin cycle; true if result is meaningful
40 * output, false if result contains error messages
41 * @param data the caller defined pointer passed to plugin_run()
43 typedef void (*plugin_callback_t
)(const GString
*result
, const bool success
,
47 * This object represents a cycle through all available plugins, until
48 * a plugin returns a positive result.
53 * Initialize an empty plugin_list structure.
56 plugin_list_init(struct plugin_list
*list
)
58 list
->plugins
= g_ptr_array_new();
62 * Load all plugins (executables) in a directory.
65 plugin_list_load_directory(struct plugin_list
*list
, const char *path
);
68 * Frees all memory held by the plugin_list object (but not the
71 void plugin_list_deinit(struct plugin_list
*list
);
74 * Run plugins in this list, until one returns success (or until the
75 * plugin list is exhausted).
77 * @param list the plugin list
78 * @param args NULL terminated command line arguments passed to the
80 * @param callback the callback function which will be called when a
82 * @param callback_data caller defined pointer which is passed to the
86 plugin_run(struct plugin_list
*list
, const char *const*args
,
87 plugin_callback_t callback
, void *callback_data
);
90 * Stops the plugin cycle and frees resources. This can be called to
91 * abort the current cycle, or after the plugin_callback_t has been
95 plugin_stop(struct plugin_cycle
*invocation
);