diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-06-02 01:42:09 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-06-02 01:42:09 +0000 |
commit | 24b7ce4f3b5eeadc7cdbc994d538288d93872491 (patch) | |
tree | 35d803a18a6a4a8dd65c669006a1d1265ee01371 /src/playlist.c | |
parent | efe8a04c70f1dde3c62e88f514433515631db858 (diff) |
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
Diffstat (limited to 'src/playlist.c')
-rw-r--r-- | src/playlist.c | 21 |
1 files changed, 11 insertions, 10 deletions
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(); |