diff options
author | geneticdrift <geneticdrift@iotide.com> | 2012-06-27 09:26:00 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-06-27 09:41:15 +0200 |
commit | 16e91baa799e579aa0bad78d7f4291aec8ab7a05 (patch) | |
tree | 9e9fc0fa73b9683f3321a559fb7bfdccfbbe1f01 /src/command.c | |
parent | f2536445f78389da0a3c68f3526968e47d658e98 (diff) | |
download | mpd-16e91baa799e579aa0bad78d7f4291aec8ab7a05.tar.gz mpd-16e91baa799e579aa0bad78d7f4291aec8ab7a05.tar.xz mpd-16e91baa799e579aa0bad78d7f4291aec8ab7a05.zip |
New command searchadd similar to command findadd.
Diffstat (limited to '')
-rw-r--r-- | src/command.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c index 7d4403399..b5671412a 100644 --- a/src/command.c +++ b/src/command.c @@ -854,6 +854,31 @@ handle_search(struct client *client, int argc, char *argv[]) } static enum command_return +handle_searchadd(struct client *client, int argc, char *argv[]) +{ + struct locate_item_list *list = + locate_item_list_parse(argv + 1, argc - 1); + + if (list == NULL || list->length == 0) { + if (list != NULL) + locate_item_list_free(list); + + command_error(client, ACK_ERROR_ARG, "incorrect arguments"); + return COMMAND_RETURN_ERROR; + } + + GError *error = NULL; + enum command_return ret = search_add_songs(client->player_control, + "", list, &error) + ? COMMAND_RETURN_OK + : print_error(client, error); + + locate_item_list_free(list); + + return ret; +} + +static enum command_return handle_count(struct client *client, int argc, char *argv[]) { struct locate_item_list *list = @@ -2002,6 +2027,7 @@ static const struct command commands[] = { { "rm", PERMISSION_CONTROL, 1, 1, handle_rm }, { "save", PERMISSION_CONTROL, 1, 1, handle_save }, { "search", PERMISSION_READ, 2, -1, handle_search }, + { "searchadd", PERMISSION_READ, 2, -1, handle_searchadd }, { "seek", PERMISSION_CONTROL, 2, 2, handle_seek }, { "seekcur", PERMISSION_CONTROL, 1, 1, handle_seekcur }, { "seekid", PERMISSION_CONTROL, 2, 2, handle_seekid }, |