aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-12-24 11:20:02 +0100
committerMax Kellermann <max@duempel.org>2011-12-24 11:20:02 +0100
commit99949c8f6fad1e2ef6aec5b742c8048d67b8280c (patch)
tree24449ca309778f02f29fb943765dc3b39d192904 /src/command.c
parent78c4351e04629d701a3652da9af98b080fd9f2b8 (diff)
downloadmpd-99949c8f6fad1e2ef6aec5b742c8048d67b8280c.tar.gz
mpd-99949c8f6fad1e2ef6aec5b742c8048d67b8280c.tar.xz
mpd-99949c8f6fad1e2ef6aec5b742c8048d67b8280c.zip
command: new command "seekcur"
For simpler seeking within current song.
Diffstat (limited to 'src/command.c')
-rw-r--r--src/command.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c
index eb2b9ae4f..e6bf36ac9 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1532,6 +1532,21 @@ handle_seekid(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
}
static enum command_return
+handle_seekcur(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
+{
+ const char *p = argv[1];
+ bool relative = *p == '+' || *p == '-';
+ int seek_time;
+ if (!check_int(client, &seek_time, p, check_integer, p))
+ return COMMAND_RETURN_ERROR;
+
+ enum playlist_result result =
+ playlist_seek_current(&g_playlist, client->player_control,
+ seek_time, relative);
+ return print_playlist_result(client, result);
+}
+
+static enum command_return
handle_listallinfo(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
{
const char *directory = "";
@@ -2159,6 +2174,7 @@ static const struct command commands[] = {
{ "save", PERMISSION_CONTROL, 1, 1, handle_save },
{ "search", PERMISSION_READ, 2, -1, handle_search },
{ "seek", PERMISSION_CONTROL, 2, 2, handle_seek },
+ { "seekcur", PERMISSION_CONTROL, 1, 1, handle_seekcur },
{ "seekid", PERMISSION_CONTROL, 2, 2, handle_seekid },
{ "sendmessage", PERMISSION_CONTROL, 2, 2, handle_send_message },
{ "setvol", PERMISSION_CONTROL, 1, 1, handle_setvol },