diff options
Diffstat (limited to '')
-rw-r--r-- | src/command.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c index 1b8c45f26..82b088587 100644 --- a/src/command.c +++ b/src/command.c @@ -59,6 +59,7 @@ #define COMMAND_STATUS_VOLUME "volume" #define COMMAND_STATUS_STATE "state" #define COMMAND_STATUS_REPEAT "repeat" +#define COMMAND_STATUS_SMARTSTOP "smartstop" #define COMMAND_STATUS_RANDOM "random" #define COMMAND_STATUS_PLAYLIST "playlist" #define COMMAND_STATUS_PLAYLIST_LENGTH "playlistlength" @@ -469,6 +470,7 @@ handle_status(struct client *client, COMMAND_STATUS_VOLUME ": %i\n" COMMAND_STATUS_REPEAT ": %i\n" COMMAND_STATUS_RANDOM ": %i\n" + COMMAND_STATUS_SMARTSTOP ": %i\n" COMMAND_STATUS_PLAYLIST ": %li\n" COMMAND_STATUS_PLAYLIST_LENGTH ": %i\n" COMMAND_STATUS_CROSSFADE ": %i\n" @@ -476,6 +478,7 @@ handle_status(struct client *client, volume_level_get(), getPlaylistRepeatStatus(&g_playlist), getPlaylistRandomStatus(&g_playlist), + getPlaylistSmartstopStatus(&g_playlist), getPlaylistVersion(&g_playlist), getPlaylistLength(&g_playlist), (int)(getPlayerCrossFade() + 0.5), @@ -1093,6 +1096,24 @@ handle_repeat(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) } static enum command_return +handle_smartstop(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) +{ + int status; + + if (!check_int(client, &status, argv[1], need_integer)) + return COMMAND_RETURN_ERROR; + + if (status != 0 && status != 1) { + command_error(client, ACK_ERROR_ARG, + "\"%i\" is not 0 or 1", status); + return COMMAND_RETURN_ERROR; + } + + setPlaylistSmartstopStatus(&g_playlist, status); + return COMMAND_RETURN_OK; +} + +static enum command_return handle_random(struct client *client, G_GNUC_UNUSED int argc, char *argv[]) { int status; @@ -1602,6 +1623,7 @@ static const struct command commands[] = { { "seekid", PERMISSION_CONTROL, 2, 2, handle_seekid }, { "setvol", PERMISSION_CONTROL, 1, 1, handle_setvol }, { "shuffle", PERMISSION_CONTROL, 0, 1, handle_shuffle }, + { "smartstop", PERMISSION_CONTROL, 1, 1, handle_smartstop }, { "stats", PERMISSION_READ, 0, 0, handle_stats }, { "status", PERMISSION_READ, 0, 0, handle_status }, #ifdef ENABLE_SQLITE |