diff options
author | Max Kellermann <max@duempel.org> | 2013-10-26 16:13:35 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-10-26 16:13:35 +0200 |
commit | a577944ab5a1f4d688e5901fa3efaf7cd1673588 (patch) | |
tree | 5404e650f399191ca8a2f9a7b28c266e5c98d7d6 /src | |
parent | 17ec3b0c2d83da9cae3dc0e649cef2568d20e7c1 (diff) |
command: new commands "findin", "searchin" with base URI
Diffstat (limited to 'src')
-rw-r--r-- | src/command/AllCommands.cxx | 2 | ||||
-rw-r--r-- | src/command/DatabaseCommands.cxx | 21 | ||||
-rw-r--r-- | src/command/DatabaseCommands.hxx | 6 |
3 files changed, 25 insertions, 4 deletions
diff --git a/src/command/AllCommands.cxx b/src/command/AllCommands.cxx index 0ab5953d0..94aa9f335 100644 --- a/src/command/AllCommands.cxx +++ b/src/command/AllCommands.cxx @@ -91,6 +91,7 @@ static const struct command commands[] = { { "enableoutput", PERMISSION_ADMIN, 1, 1, handle_enableoutput }, { "find", PERMISSION_READ, 2, -1, handle_find }, { "findadd", PERMISSION_READ, 2, -1, handle_findadd}, + { "findin", PERMISSION_READ, 3, -1, handle_find_in }, { "idle", PERMISSION_READ, 0, -1, handle_idle }, { "kill", PERMISSION_ADMIN, -1, -1, handle_kill }, { "list", PERMISSION_READ, 1, -1, handle_list }, @@ -142,6 +143,7 @@ static const struct command commands[] = { { "search", PERMISSION_READ, 2, -1, handle_search }, { "searchadd", PERMISSION_ADD, 2, -1, handle_searchadd }, { "searchaddpl", PERMISSION_CONTROL, 3, -1, handle_searchaddpl }, + { "searchin", PERMISSION_READ, 3, -1, handle_search_in }, { "seek", PERMISSION_CONTROL, 2, 2, handle_seek }, { "seekcur", PERMISSION_CONTROL, 1, 1, handle_seekcur }, { "seekid", PERMISSION_CONTROL, 2, 2, handle_seekid }, diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx index b86cbdae7..16e10b4de 100644 --- a/src/command/DatabaseCommands.cxx +++ b/src/command/DatabaseCommands.cxx @@ -55,7 +55,8 @@ handle_lsinfo2(Client &client, int argc, char *argv[]) } static CommandResult -handle_match(Client &client, int argc, char *argv[], bool fold_case) +handle_match(Client &client, int argc, char *argv[], + const char *uri, bool fold_case) { SongFilter filter; if (!filter.Parse(argc - 1, argv + 1, fold_case)) { @@ -63,7 +64,7 @@ handle_match(Client &client, int argc, char *argv[], bool fold_case) return CommandResult::ERROR; } - const DatabaseSelection selection("", true, &filter); + const DatabaseSelection selection(uri, true, &filter); Error error; return db_selection_print(client, selection, true, error) @@ -74,13 +75,25 @@ handle_match(Client &client, int argc, char *argv[], bool fold_case) CommandResult handle_find(Client &client, int argc, char *argv[]) { - return handle_match(client, argc, argv, false); + return handle_match(client, argc, argv, "", false); +} + +CommandResult +handle_find_in(Client &client, int argc, char *argv[]) +{ + return handle_match(client, argc - 1, argv + 1, argv[1], false); } CommandResult handle_search(Client &client, int argc, char *argv[]) { - return handle_match(client, argc, argv, true); + return handle_match(client, argc, argv, "", true); +} + +CommandResult +handle_search_in(Client &client, int argc, char *argv[]) +{ + return handle_match(client, argc - 1, argv + 1, argv[1], true); } static CommandResult diff --git a/src/command/DatabaseCommands.hxx b/src/command/DatabaseCommands.hxx index c60caf246..fa23c5492 100644 --- a/src/command/DatabaseCommands.hxx +++ b/src/command/DatabaseCommands.hxx @@ -31,12 +31,18 @@ CommandResult handle_find(Client &client, int argc, char *argv[]); CommandResult +handle_find_in(Client &client, int argc, char *argv[]); + +CommandResult handle_findadd(Client &client, int argc, char *argv[]); CommandResult handle_search(Client &client, int argc, char *argv[]); CommandResult +handle_search_in(Client &client, int argc, char *argv[]); + +CommandResult handle_searchadd(Client &client, int argc, char *argv[]); CommandResult |