diff options
author | Max Kellermann <max@duempel.org> | 2009-10-17 22:58:19 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-10-17 22:58:19 +0200 |
commit | bddb6b42738c8637000896d867e89691d3a57c3e (patch) | |
tree | f3eb6ee1c580a1264d33507ab7684402d2a19a55 /src/command.c | |
parent | 7ec32704f9b0cd22f7bde1654a5e80bb28ee9e22 (diff) | |
download | mpd-bddb6b42738c8637000896d867e89691d3a57c3e.tar.gz mpd-bddb6b42738c8637000896d867e89691d3a57c3e.tar.xz mpd-bddb6b42738c8637000896d867e89691d3a57c3e.zip |
command: allow changing replay gain mode on-the-fly
The new command "replay_gain_mode" allows the user to switch the
replay gain mode on-the-fly. No more mpd.conf editing.
Diffstat (limited to '')
-rw-r--r-- | src/command.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c index 9a34093b6..0c6538ca9 100644 --- a/src/command.c +++ b/src/command.c @@ -44,6 +44,7 @@ #include "client.h" #include "tag_print.h" #include "path.h" +#include "replay_gain.h" #include "idle.h" #include "config.h" @@ -1522,6 +1523,28 @@ handle_listplaylists(struct client *client, } static enum command_return +handle_replay_gain_mode(struct client *client, + G_GNUC_UNUSED int argc, char *argv[]) +{ + if (!replay_gain_set_mode_string(argv[1])) { + command_error(client, ACK_ERROR_ARG, + "Unrecognized replay gain mode"); + return COMMAND_RETURN_ERROR; + } + + return COMMAND_RETURN_OK; +} + +static enum command_return +handle_replay_gain_status(struct client *client, + G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) +{ + client_printf(client, "replay_gain_mode: %s\n", + replay_gain_get_mode_string()); + return COMMAND_RETURN_OK; +} + +static enum command_return handle_idle(struct client *client, G_GNUC_UNUSED int argc, G_GNUC_UNUSED char *argv[]) { @@ -1765,6 +1788,10 @@ static const struct command commands[] = { { "random", PERMISSION_CONTROL, 1, 1, handle_random }, { "rename", PERMISSION_CONTROL, 2, 2, handle_rename }, { "repeat", PERMISSION_CONTROL, 1, 1, handle_repeat }, + { "replay_gain_mode", PERMISSION_CONTROL, 1, 1, + handle_replay_gain_mode }, + { "replay_gain_status", PERMISSION_READ, 0, 0, + handle_replay_gain_status }, { "rescan", PERMISSION_ADMIN, 0, 1, handle_rescan }, { "rm", PERMISSION_CONTROL, 1, 1, handle_rm }, { "save", PERMISSION_CONTROL, 1, 1, handle_save }, |