From 2efec475218b90411d92688b5d69247571340a96 Mon Sep 17 00:00:00 2001 From: Florrie Date: Sat, 2 Sep 2017 11:52:59 -0300 Subject: Tie in delete-up-next a little nicer --- src/loop-play.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/loop-play.js b/src/loop-play.js index c95c1c4..24134b0 100644 --- a/src/loop-play.js +++ b/src/loop-play.js @@ -350,10 +350,12 @@ class PlayController extends EventEmitter { }) } - startNextDownload() { + startNextDownload(moveTimelineIndex = true) { this.isDownloading = true - const picked = this.historyController.getNextTrack() + const picked = (moveTimelineIndex + ? this.historyController.getNextTrack() + : this.historyController.currentTrack) this.nextTrack = picked if (!picked) { @@ -413,8 +415,13 @@ class PlayController extends EventEmitter { await safeUnlink(this.nextFile, this.playlist) } + // The timeline is always one index ahead. + const tl = this.historyController.timeline + tl.splice(this.historyController.timelineIndex - 1, 1) + this.historyController.fillTimeline() + this.downloadController.cancel() - return this.startNextDownload() + return this.startNextDownload(false) } async stop() { -- cgit 1.3.0-6-gf8a5