sticker: don't use classes Directory and Song

Don't depend on the "simple" database plugin.  This fixes an assertion
failure / crash and allows using stickers with other plugins.
This commit is contained in:
Max Kellermann
2014-01-29 17:45:07 +01:00
parent 667481c371
commit ff87145537
3 changed files with 21 additions and 22 deletions

View File

@@ -124,24 +124,17 @@ handle_sticker_song(Client &client, int argc, char *argv[])
/* find song dir key */
} else if (argc == 5 && strcmp(argv[1], "find") == 0) {
/* "sticker find song a/directory name" */
const char *const base_uri = argv[3];
bool success;
struct sticker_song_find_data data = {
client,
argv[4],
};
db_lock();
Directory *directory = db_get_directory(argv[3]);
if (directory == nullptr) {
db_unlock();
command_error(client, ACK_ERROR_NO_EXIST,
"no such directory");
return CommandResult::ERROR;
}
success = sticker_song_find(*directory, data.name,
success = sticker_song_find(base_uri, data.name,
sticker_song_find_print_cb, &data);
db_unlock();
if (!success) {
command_error(client, ACK_ERROR_SYSTEM,
"failed to set search sticker database");