aboutsummaryrefslogtreecommitdiffstats
path: root/src/playlist.c
diff options
context:
space:
mode:
authorRomain Bignon <romain@peerfuse.org>2009-03-27 15:28:49 +0100
committerRomain Bignon <romain@peerfuse.org>2009-03-27 15:28:49 +0100
commite7519829ac588e4b261c1832bb0e7d6ffbd47322 (patch)
treeec9ab205b3a4344b76dcd60dddc8496ed8357cde /src/playlist.c
parente46722b2ebe05fce63bc7b86100c159b5cadd297 (diff)
downloadmpd-e7519829ac588e4b261c1832bb0e7d6ffbd47322.tar.gz
mpd-e7519829ac588e4b261c1832bb0e7d6ffbd47322.tar.xz
mpd-e7519829ac588e4b261c1832bb0e7d6ffbd47322.zip
renamed smartstop to single and changed behavior
When single mode is enabled, after current song it stops playback, or it replay same song if repeat mode is activated.
Diffstat (limited to '')
-rw-r--r--src/playlist.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 0ec46492a..776308db0 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -262,9 +262,9 @@ getPlaylistRandomStatus(const struct playlist *playlist)
}
bool
-getPlaylistSmartstopStatus(const struct playlist *playlist)
+getPlaylistSingleStatus(const struct playlist *playlist)
{
- return playlist->queue.smartstop;
+ return playlist->queue.single;
}
void setPlaylistRepeatStatus(struct playlist *playlist, bool status)
@@ -292,12 +292,15 @@ static void orderPlaylist(struct playlist *playlist)
queue_restore_order(&playlist->queue);
}
-void setPlaylistSmartstopStatus(struct playlist *playlist, bool status)
+void setPlaylistSingleStatus(struct playlist *playlist, bool status)
{
- playlist->queue.smartstop = status;
+ if (status == playlist->queue.single)
+ return;
+
+ playlist->queue.single = status;
/* if the last song is currently being played, the "next song"
- might change when repeat mode is toggled */
+ might change when single mode is toggled */
playlist_update_queued_song(playlist,
playlist_get_queued_song(playlist));
@@ -359,8 +362,14 @@ int getPlaylistNextSong(const struct playlist *playlist)
{
if (playlist->current >= 0)
{
- if (playlist->queue.smartstop == 1)
- return -1;
+ if (playlist->queue.single == 1)
+ {
+ if (playlist->queue.repeat == 1)
+ return queue_order_to_position(&playlist->queue,
+ playlist->current);
+ else
+ return -1;
+ }
if (playlist->current + 1 < (int)queue_length(&playlist->queue))
return queue_order_to_position(&playlist->queue,
playlist->current + 1);