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
This commit is contained in:
Warren Dukes 2004-06-02 01:42:09 +00:00
parent efe8a04c70
commit 24b7ce4f3b
1 changed files with 11 additions and 10 deletions

View File

@ -783,6 +783,16 @@ int currentSongInPlaylist(FILE * fp) {
return 0; 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) { int nextSongInPlaylist(FILE * fp) {
if(playlist_state!=PLAYLIST_STATE_PLAY) return 0; if(playlist_state!=PLAYLIST_STATE_PLAY) return 0;
@ -798,22 +808,13 @@ int nextSongInPlaylist(FILE * fp) {
return playPlaylistOrderNumber(fp,0); return playPlaylistOrderNumber(fp,0);
} }
else { else {
incrPlaylistCurrent();
return stopPlaylist(fp);; return stopPlaylist(fp);;
} }
return 0; 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() { void playPlaylistIfPlayerStopped() {
if(getPlayerState()==PLAYER_STATE_STOP) { if(getPlayerState()==PLAYER_STATE_STOP) {
int error = getPlayerError(); int error = getPlayerError();