aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorVladimir S Eremin <me@hidded.name>2009-02-08 06:21:00 +0100
committerMax Kellermann <max@duempel.org>2009-02-09 10:38:03 +0100
commitcde4cb944ebcc5b4db46afa5458a5d0a728c4866 (patch)
tree35a6ad35be59d1ca323c575ff1cd32a4eca5dc33 /src/playlist.c
parentb35896296043fb5612ea52f0fadda48479aca860 (diff)
downloadmpd-cde4cb944ebcc5b4db46afa5458a5d0a728c4866.tar.gz
mpd-cde4cb944ebcc5b4db46afa5458a5d0a728c4866.tar.xz
mpd-cde4cb944ebcc5b4db46afa5458a5d0a728c4866.zip
playlist: provide information about "next song"
In random mode, this patch allows clients to see the "next song" in the queue.
Diffstat (limited to 'src/playlist.c')
-rw-r--r--src/playlist.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 3b9c33ce8..ed430bf6e 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -334,6 +334,21 @@ int getPlaylistCurrentSong(const struct playlist *playlist)
return -1;
}
+int getPlaylistNextSong(const struct playlist *playlist)
+{
+ if (playlist->current >= 0)
+ {
+ if (queue_length(&playlist->queue) > 1)
+ return queue_order_to_position(&playlist->queue,
+ playlist->current + 1);
+ else if (playlist->queue.repeat == 1)
+ return queue_order_to_position(&playlist->queue,
+ playlist->current);
+ }
+
+ return -1;
+}
+
unsigned long
getPlaylistVersion(const struct playlist *playlist)
{