diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2022-06-01 23:35:03 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2022-06-01 23:35:03 -0300 |
commit | e8a55f10dd9749ad240b165e318db0a1d2f00a9a (patch) | |
tree | 1d36d40f24d2c423caff0e31341ccb45bf7d39a7 /backend.js | |
parent | d8fbd7f8005cab072d85ff01612e618f986a8ee5 (diff) |
miscellaneous improvements to queue looping
Diffstat (limited to 'backend.js')
-rw-r--r-- | backend.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/backend.js b/backend.js index 36344be..59c4a48 100644 --- a/backend.js +++ b/backend.js @@ -338,9 +338,11 @@ class QueuePlayer extends EventEmitter { } } - shuffleQueue() { + shuffleQueue(pastPlayingTrackOnly = true) { const queue = this.queueGrouplike - const index = queue.items.indexOf(this.playingTrack) + 1 // This is 0 if no track is playing + const index = (pastPlayingTrackOnly + ? queue.items.indexOf(this.playingTrack) + 1 // This is 0 if no track is playing + : 0) const initialItems = queue.items.slice(0, index) const remainingItems = queue.items.slice(index) const newItems = initialItems.concat(shuffleArray(remainingItems)) @@ -517,8 +519,7 @@ class QueuePlayer extends EventEmitter { this.playFirst() return true case 'shuffle': - this.clearPlayingTrack() - this.shuffleQueue() + this.shuffleQueue(false) this.playFirst() return true case 'end': |