Bug 394333 - Better shuffle
Summary: Better shuffle
Alias: None
Product: Elisa
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Matthieu Gallien
Depends on:
Reported: 2018-05-16 15:05 UTC by Diego Gangl
Modified: 2020-03-08 02:12 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 20.04.0


Note You need to log in before you can comment on or make changes to this bug.
Description Diego Gangl 2018-05-16 15:05:05 UTC
Right now when shuffle is enabled Elisa seems to pick a random song every time we skip/finish playing a track.

The problem with this is that sometimes we end up with the same song twice in a row (or more), or the same song being played multiple times in a short span of time. Another problem is that if we accidentally skipped a song we wanted to hear, we can't go back because the previous button picks a new song.

A better solution would be to pre-shuffle the list internally and then play it in sequence. That ensures that songs are only played once per playlist playthrough and we can go back to previous songs. When the end of the list is reached, re-shuffle it and start again (if repeat is enabled).
Comment 1 Nickolas Grigoriadis 2018-08-29 08:40:40 UTC
Could Elisa please also have the capability to shuffle a random album, play it in full and then choose a new random album?

And to complete the requirement, add a shortcut key to automatically skip to a next album?
Comment 2 Michael D 2018-08-31 08:39:45 UTC
If elisa "pre-shuffles" (permutes) the playlist it would have to do so after each modification of the playlist. Perhaps it is better to just ensure that the next track is not the current track (or any of the tracks in a saved history of e.g. 10 of the last tracks played)?
Comment 3 Matthieu Gallien 2018-09-13 21:13:08 UTC
I am currently using a music player on my smart phone that allow to enqueue tracks with a random order. This way, one can know what will come next and also go back to the previous track. What do you think ?
Comment 4 Alexander Stippich 2020-03-07 09:25:18 UTC
Git commit 3c925162ec8c9d4a4f9a9d173c3c7dbe6576c66c by Alexander Stippich.
Committed on 07/03/2020 at 09:25.
Pushed by astippich into branch 'master'.

New shuffle mode for playlist

This implements a new shuffle mode for the playlist with a proxy model that shuffles the available data.
he following features are implemented:

each track is selected exactly once in shuffle mode
the shuffle mode and order are fully visible to the user
full history with going back and forth

Interfacing with the QML code is now done with the proxy model.

M  +15   -0    autotests/CMakeLists.txt
C  +4314 -4870 autotests/mediaplaylistproxymodeltest.cpp [from: autotests/mediaplaylisttest.cpp - 052% similarity]
C  +48   -72   autotests/mediaplaylistproxymodeltest.h [from: autotests/mediaplaylisttest.h - 078% similarity]
M  +682  -4887 autotests/mediaplaylisttest.cpp
M  +19   -83   autotests/mediaplaylisttest.h
M  +15   -15   autotests/trackslistenertest.cpp
M  +2    -1    src/CMakeLists.txt
M  +31   -14   src/elisaapplication.cpp
M  +11   -0    src/elisaapplication.h
M  +2    -0    src/elisaqmlplugin.cpp
M  +4    -0    src/manageheaderbar.cpp
M  +2    -0    src/manageheaderbar.h
M  +27   -626  src/mediaplaylist.cpp
M  +7    -157  src/mediaplaylist.h
A  +838  -0    src/mediaplaylistproxymodel.cpp     [License: LGPL (v3+)]
A  +266  -0    src/mediaplaylistproxymodel.h     [License: LGPL (v3+)]
M  +5    -5    src/models/abstractmediaproxymodel.cpp
M  +5    -5    src/models/abstractmediaproxymodel.h
M  +5    -5    src/models/filebrowserproxymodel.cpp
M  +5    -5    src/models/filebrowserproxymodel.h
M  +2    -2    src/mpris2/mediaplayer2player.cpp
M  +3    -3    src/mpris2/mediaplayer2player.h
M  +3    -3    src/mpris2/mpris2.cpp
M  +5    -5    src/mpris2/mpris2.h
M  +3    -3    src/qml/DataGridView.qml
M  +5    -5    src/qml/DataListView.qml
M  +10   -10   src/qml/ElisaMainWindow.qml
M  +6    -5    src/qml/FileBrowserView.qml
M  +1    -1    src/qml/HeaderBar.qml
M  +15   -15   src/qml/MediaPlayListView.qml
M  +2    -2    src/qml/PlayListBasicView.qml