diff options
author | Florrie <towerofnix@gmail.com> | 2019-09-22 12:43:34 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2019-09-22 12:43:34 -0300 |
commit | 88dd9466e513bb562e242d152765ec204e2e2b2d (patch) | |
tree | c6affeba6dac72ee7a15d48552944b4f5a7cc2fd /backend.js | |
parent | 571026560ec61e26c4498f3d7e9a982c9b5aa68e (diff) |
Basic multiple player UI
Currently uses meta+(c, x, n, p, up, down) keys as the only interaction method, but that'll change soon!
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)) |