From cde4cb944ebcc5b4db46afa5458a5d0a728c4866 Mon Sep 17 00:00:00 2001 From: Vladimir S Eremin Date: Sun, 8 Feb 2009 06:21:00 +0100 Subject: playlist: provide information about "next song" In random mode, this patch allows clients to see the "next song" in the queue. --- src/playlist.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/playlist.c') 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) { -- cgit v1.2.3