From a2281aa3a11a4f1083d4694e82c6c0b237b5beba Mon Sep 17 00:00:00 2001 From: candle Date: Mon, 13 Nov 2023 17:09:07 +0000 Subject: [PATCH] queue clear command --- src/server/playback.ts | 7 +++++++ src/server/server.ts | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/server/playback.ts b/src/server/playback.ts index a839fcd5..1ad0e9ca 100644 --- a/src/server/playback.ts +++ b/src/server/playback.ts @@ -67,6 +67,13 @@ export class Playback extends EventEmitter { } } + clear() { + while (this.queue.length > 0) { + this.unqueue(this.queue[0]); + } + this.clearMedia(); + } + get playing() { return this.remainingTime > 0; } diff --git a/src/server/server.ts b/src/server/server.ts index d522da8e..81baaee7 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -594,6 +594,9 @@ export function host( } }) ); + authCommands.set('queue-clear', (admin) => { + playback.clear(); + }); return { save, sendAll, zone, playback }; }