diff options
author | Florrie <towerofnix@gmail.com> | 2018-10-11 13:14:43 -0300 |
---|---|---|
committer | Florrie <towerofnix@gmail.com> | 2018-10-11 13:16:04 -0300 |
commit | 68ca78ee4b6e0a84d1b39257a395365a636d6a0f (patch) | |
tree | 667c99a6aec56cf59aefb538a11c9c9c5555aa74 | |
parent | 4207cf479f91d4cad9cad5583d069efc8fd24c31 (diff) |
Play up next group containing current track nicely
-rw-r--r-- | ui.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/ui.js b/ui.js index 6965331..15c0d34 100644 --- a/ui.js +++ b/ui.js @@ -115,7 +115,9 @@ class AppElement extends FocusElement { afterItem = this.playingTrack } - this.queueGrouplikeItem(item, afterItem) + this.queueGrouplikeItem(item, afterItem, { + movePlayingTrack: !shuffle + }) if (play) { this.playGrouplikeItem(item) @@ -436,7 +438,7 @@ class AppElement extends FocusElement { this.player.kill() } - async queueGrouplikeItem(topItem, afterItem = null) { + async queueGrouplikeItem(topItem, afterItem = null, {movePlayingTrack = true} = {}) { const newTrackIndex = this.queueGrouplike.items.length const recursivelyAddTracks = item => { @@ -458,6 +460,12 @@ class AppElement extends FocusElement { // is needed to fix the display, but then you end up with a new object // that doesn't work with indexOf).) if (items.includes(item)) { + // HOWEVER, if the "moveCurrentTrack" option is false, and that item + // is the one that's currently playing, we won't do anything with it + // at all. + if (!movePlayingTrack && item === this.playingTrack) { + return + } items.splice(items.indexOf(item), 1) } |