diff options
Diffstat (limited to 'backend.js')
-rw-r--r-- | backend.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/backend.js b/backend.js index e8601c5..d3e0db7 100644 --- a/backend.js +++ b/backend.js @@ -374,7 +374,7 @@ class QueuePlayer extends EventEmitter { } this.playingTrack = item - this.emit('playing', this.playingTrack, oldTrack) + this.emit('playing', this.playingTrack, oldTrack, this) await this.player.kill() if (this.playedTrackToEnd) { @@ -455,7 +455,7 @@ class QueuePlayer extends EventEmitter { const oldTrack = this.playingTrack this.playingTrack = null this.timeData = null - this.emit('playing', null, oldTrack) + this.emit('playing', null, oldTrack, this) } } @@ -574,6 +574,13 @@ class Backend extends EventEmitter { return queuePlayer } + removeQueuePlayer(queuePlayer) { + if (this.queuePlayers.length > 1) { + this.queuePlayers.splice(this.queuePlayers.indexOf(queuePlayer), 1) + this.emit('removed queue player', queuePlayer) + } + } + async readMetadata() { try { return JSON.parse(await readFile(this.metadataPath)) |