From a55e2dda6b7cd2e413445964f44a98a8a07058a7 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 17 Jul 2021 20:37:08 -0300 Subject: fix playOrSeek messing with queue order --- backend.js | 14 +++++++++++++- todo.txt | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/backend.js b/backend.js index 51419da..e2213d5 100644 --- a/backend.js +++ b/backend.js @@ -511,10 +511,22 @@ class QueuePlayer extends EventEmitter { } async playOrSeek(item, time) { + if (!isTrack(item)) { + // This only makes sense to call with individual tracks! + return + } + if (item === this.playingTrack) { this.seekTo(time) } else { - this.queue(item, this.playingTrack) + // Queue the track, but only if it's not already in the queue, so that we + // respect an existing queue order. + const queue = this.queueGrouplike + const queueIndex = queue.items.indexOf(item) + if (queueIndex === -1) { + this.queue(item, this.playingTrack) + } + this.play(item, time) } } diff --git a/todo.txt b/todo.txt index f41609b..ad1ebac 100644 --- a/todo.txt +++ b/todo.txt @@ -601,3 +601,4 @@ TODO: Automatically expand/collapse timestamp lists in the queue sidebar! TODO: Apparently, seeking to a timestamp under a previous track in the queue doesn't respect the current queue order (i.e. it sticks the track after the current track). Definitely a bug! + (Done - fixed!) -- cgit 1.3.0-6-gf8a5