Skip to content

Commit 41e0d33

Browse files
committed
Do not shuffle one song
1 parent 57260a1 commit 41e0d33

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

core/src/main/java/xyz/gianlu/librespot/player/tracks/PlaylistProvider.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ private static int[] getShuffleExchanges(int size, long seed) {
4343
}
4444

4545
public void shuffleTracks(@NotNull Random random, boolean fully) {
46+
if (state.getTrackCount() <= 1)
47+
return;
48+
4649
shuffleSeed = random.nextLong();
4750

4851
List<Spirc.TrackRef> tracks = new ArrayList<>(state.getTrackList());
@@ -67,6 +70,9 @@ public void shuffleTracks(@NotNull Random random, boolean fully) {
6770
}
6871

6972
public void unshuffleTracks() {
73+
if (state.getTrackCount() <= 1)
74+
return;
75+
7076
if (shuffleSeed == 0 && !conf.defaultUnshuffleBehaviour() && state.hasContextUri()) {
7177
List<Remote3Track> tracks;
7278
try {

0 commit comments

Comments
 (0)