implements the smartstop feature
The smartstop feature is a way to tell mpd to stop playing after current song. This patche provides: - 'state' command returns 'smartstop' state (1 or 0) - 'smartstop' can activate or not the smartstop state - when song is terminated, mpd stops playing and smartstop is set to 0
This commit is contained in:
@@ -261,6 +261,12 @@ getPlaylistRandomStatus(const struct playlist *playlist)
|
||||
return playlist->queue.random;
|
||||
}
|
||||
|
||||
bool
|
||||
getPlaylistSmartstopStatus(const struct playlist *playlist)
|
||||
{
|
||||
return playlist->queue.smartstop;
|
||||
}
|
||||
|
||||
void setPlaylistRepeatStatus(struct playlist *playlist, bool status)
|
||||
{
|
||||
if (status == playlist->queue.repeat)
|
||||
@@ -286,6 +292,18 @@ static void orderPlaylist(struct playlist *playlist)
|
||||
queue_restore_order(&playlist->queue);
|
||||
}
|
||||
|
||||
void setPlaylistSmartstopStatus(struct playlist *playlist, bool status)
|
||||
{
|
||||
playlist->queue.smartstop = status;
|
||||
|
||||
/* if the last song is currently being played, the "next song"
|
||||
might change when repeat mode is toggled */
|
||||
playlist_update_queued_song(playlist,
|
||||
playlist_get_queued_song(playlist));
|
||||
|
||||
idle_add(IDLE_OPTIONS);
|
||||
}
|
||||
|
||||
void setPlaylistRandomStatus(struct playlist *playlist, bool status)
|
||||
{
|
||||
const struct song *queued;
|
||||
@@ -341,6 +359,8 @@ int getPlaylistNextSong(const struct playlist *playlist)
|
||||
{
|
||||
if (playlist->current >= 0)
|
||||
{
|
||||
if (playlist->queue.smartstop == 1)
|
||||
return -1;
|
||||
if (playlist->current + 1 < (int)queue_length(&playlist->queue))
|
||||
return queue_order_to_position(&playlist->queue,
|
||||
playlist->current + 1);
|
||||
|
Reference in New Issue
Block a user