Commit 1c698b3a authored by Michael Pyne's avatar Michael Pyne
Browse files

playlist: Play whole album when playback started in album-random mode.

Previously, the track the user double-clicked would be played, then
album random playback would start with the next track and succeeding
tracks after.
parent ced3ffb6
Pipeline #55268 passed with stage
in 11 minutes and 3 seconds
......@@ -724,6 +724,18 @@ void Playlist::refillRandomList()
[](PlaylistItem *a, PlaylistItem *b) {
return a->file().tag()->album() < b->file().tag()->album();
});
// If there is an item playing from our playlist already, move its
// album to the front
const auto wasPlaying = playingItem();
if(wasPlaying && wasPlaying->playlist() == this) {
const auto playingAlbum = wasPlaying->file().tag()->album();
std::stable_partition(randomItems.begin(), randomItems.end(),
[playingAlbum](const PlaylistItem *item) {
return item->file().tag()->album() == playingAlbum;
});
}
}
std::swap(m_randomSequence, randomItems);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment