From 24b7ce4f3b5eeadc7cdbc994d538288d93872491 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Wed, 2 Jun 2004 01:42:09 +0000 Subject: when at the end of the playlist with and not repeat, on next, set current = -1 git-svn-id: https://svn.musicpd.org/mpd/trunk@1290 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/playlist.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/playlist.c') diff --git a/src/playlist.c b/src/playlist.c index cb9314661..4c0737d1b 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -783,6 +783,16 @@ int currentSongInPlaylist(FILE * fp) { return 0; } +void incrPlaylistCurrent() { + if(playlist.current >= playlist.length || (!playlist.repeat && + playlist.current == playlist.length-1)) + { + playlist.current = -1; + } + else if(playlist.current == playlist.length-1) playlist.current = 0; + else if(playlist.current >= 0) playlist.current++; +} + int nextSongInPlaylist(FILE * fp) { if(playlist_state!=PLAYLIST_STATE_PLAY) return 0; @@ -798,22 +808,13 @@ int nextSongInPlaylist(FILE * fp) { return playPlaylistOrderNumber(fp,0); } else { + incrPlaylistCurrent(); return stopPlaylist(fp);; } return 0; } -void incrPlaylistCurrent() { - if(playlist.current >= playlist.length || (!playlist.repeat && - playlist.current == playlist.length-1)) - { - playlist.current = -1; - } - else if(playlist.current == playlist.length-1) playlist.current = 0; - else if(playlist.current >= 0) playlist.current++; -} - void playPlaylistIfPlayerStopped() { if(getPlayerState()==PLAYER_STATE_STOP) { int error = getPlayerError(); -- cgit v1.2.3