diff options
author | Thomas Jansen <mithi@mithi.net> | 2009-01-09 17:06:44 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-10 16:50:34 +0100 |
commit | 6f0781f0396ab5e4bc8aece6986381dac8f03081 (patch) | |
tree | d20b32323c25d86c81f43af106952efbbdd5d3bb /src/command.c | |
parent | 8ed3cf3e6b31e48369a2007da8c95d686c62d184 (diff) | |
download | mpd-6f0781f0396ab5e4bc8aece6986381dac8f03081.tar.gz mpd-6f0781f0396ab5e4bc8aece6986381dac8f03081.tar.xz mpd-6f0781f0396ab5e4bc8aece6986381dac8f03081.zip |
command: playlistinfo now uses a range argument rather than just a song id
Loosely based on a patch provided by lesion in bug #1766. The playlistinfo
command can now retrieve ranges of the playlist. The new argument indicates
which entry is the last one that will be displayed. The number of displayed
entries may be smaller than expected if the end of the playlist is reached.
Previous usage:
playlistinfo [start]
New usage:
playlistinfo [start[:end]]
Diffstat (limited to 'src/command.c')
-rw-r--r-- | src/command.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/command.c b/src/command.c index 652d3b3b0..076bc2055 100644 --- a/src/command.c +++ b/src/command.c @@ -79,6 +79,7 @@ struct command { /* this should really be "need a non-negative integer": */ static const char need_positive[] = "need a positive integer"; /* no-op */ +static const char need_range[] = "need a range"; /* FIXME: redundant error messages */ static const char check_integer[] = "\"%s\" is not a integer"; @@ -389,7 +390,7 @@ handle_currentsong(struct client *client, if (song < 0) return COMMAND_RETURN_OK; - result = playlistInfo(client, song); + result = playlistInfo(client, song, song); return print_playlist_result(client, result); } @@ -742,13 +743,13 @@ handle_plchangesposid(struct client *client, G_GNUC_UNUSED int argc, char *argv[ static enum command_return handle_playlistinfo(struct client *client, int argc, char *argv[]) { - int song = -1; + int song = -1, max = -1; enum playlist_result result; - if (argc == 2 && !check_int(client, &song, argv[1], need_positive)) + if (argc == 2 && !check_range(client, &song, &max, argv[1], need_range)) return COMMAND_RETURN_ERROR; - result = playlistInfo(client, song); + result = playlistInfo(client, song, max); return print_playlist_result(client, result); } |