Code

release v0.29
[ncmpc.git] / src / lyrics.c
1 /* ncmpc (Ncurses MPD Client)
2  * (c) 2004-2017 The Music Player Daemon Project
3  * Project homepage: http://musicpd.org
4  *
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.
9  *
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.
14  *
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.
18  */
20 #include "lyrics.h"
21 #include "config.h"
23 #include <assert.h>
25 static struct plugin_list empty, plugins;
27 void lyrics_init(void)
28 {
29         plugin_list_init(&empty);
30         plugin_list_init(&plugins);
31         plugin_list_load_directory(&plugins, LYRICS_PLUGIN_DIR);
32 }
34 void lyrics_deinit(void)
35 {
36         plugin_list_deinit(&empty);
37         plugin_list_deinit(&plugins);
38 }
40 struct plugin_cycle *
41 lyrics_load(const char *artist, const char *title,
42             plugin_callback_t callback, void *data)
43 {
44         const char *args[3] = { artist, title, NULL };
46         if (artist == NULL || title == NULL)
47                 return plugin_run(&empty, args, callback, data);
49         return plugin_run(&plugins, args, callback, data);
50 }