From df99d463242a30e863a3c84253549a18e2170d45 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 18 Jul 2021 20:00:24 -0300 Subject: miscellaneous improvements to selection restoring --- backend.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'backend.js') diff --git a/backend.js b/backend.js index e2213d5..e38fe2f 100644 --- a/backend.js +++ b/backend.js @@ -85,8 +85,9 @@ class QueuePlayer extends EventEmitter { this.player.on('printStatusLine', data => { if (this.playingTrack) { + const oldTimeData = this.timeData this.timeData = data - this.emit('received time data', data, this) + this.emit('received time data', data, oldTimeData, this) } }) @@ -368,7 +369,7 @@ class QueuePlayer extends EventEmitter { } - async play(item, startTime) { + async play(item, startTime = 0) { if (this.player === null) { throw new Error('Attempted to play before a player was loaded') } @@ -415,7 +416,7 @@ class QueuePlayer extends EventEmitter { this.timeData = null this.playingTrack = item - this.emit('playing', this.playingTrack, oldTrack, this) + this.emit('playing', this.playingTrack, oldTrack, startTime, this) await this.player.kill() if (this.playedTrackToEnd) { @@ -536,7 +537,7 @@ class QueuePlayer extends EventEmitter { const oldTrack = this.playingTrack this.playingTrack = null this.timeData = null - this.emit('playing', null, oldTrack, this) + this.emit('playing', null, oldTrack, 0, this) } } -- cgit 1.3.0-6-gf8a5