From 48fce96444f720263409ec548d66dfbae53dcc6b Mon Sep 17 00:00:00 2001 From: Florrie Date: Thu, 5 Jul 2018 10:28:09 -0300 Subject: Shift+Q to play next --- README.md | 3 ++- todo.txt | 1 + ui.js | 9 +++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ae072ac..5951628 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,8 @@ playlist.json file (usually generated by http-music or downloaded from online). * Enter - if the selected item is a group, enter it; otherwise play it * Backspace - leave the current group (if in one) * q - queue the selected track or group to play after any other items in the queue (usually after the current track) - * Q (shift+Q) - queue the selected group, but shuffled + * Q (shift+Q) on a group - queue the selected group, but shuffled + * Q (shift+Q) on a track - queue the selected track to play immediately after what's currently playing * d - download the selected track (but don't play it) * **In the queue listing:** * s - shuffle the queue diff --git a/todo.txt b/todo.txt index 62b9ec4..636a804 100644 --- a/todo.txt +++ b/todo.txt @@ -14,6 +14,7 @@ TODO: A way to jump to an item with a particular name. Probably press "/". TODO: "Queue to play next"... maybe also a cursor in the queue list, which would tell after what track to place newly-queued items? + (Done!) TODO: Scroll to the selected track once it starts playing when selected from the queue. diff --git a/ui.js b/ui.js index 4228650..4b64017 100644 --- a/ui.js +++ b/ui.js @@ -107,6 +107,7 @@ class AppElement extends FocusElement { () => handleSelectFromMain(item))) grouplikeListing.on('queue', item => this.queueGrouplikeItem(item)) grouplikeListing.on('queue (shuffled)', item => this.shuffleQueueGrouplikeItem(item)) + grouplikeListing.on('queue (play next)', item => this.queueGrouplikeItem(item, true, this.playingTrack)) const handleSelectFromPathElement = item => { this.form.selectInput(grouplikeListing) @@ -633,7 +634,7 @@ class GrouplikeListingElement extends FocusElement { if (this.grouplike.items.length) { for (const item of this.grouplike.items) { const itemElement = new GrouplikeItemElement(item, this.recordStore) - for (const evtName of ['download', 'remove', 'select (space)', 'select (enter)', 'queue', 'queue (shuffled)']) { + for (const evtName of ['download', 'remove', 'select (space)', 'select (enter)', 'queue', 'queue (shuffled)', 'queue (play next)']) { itemElement.on(evtName, () => this.emit(evtName, item)) } form.addInput(itemElement) @@ -788,7 +789,11 @@ class GrouplikeItemElement extends Button { if (keyBuf[0] === 'q'.charCodeAt(0)) { this.emit('queue') } else { - this.emit('queue (shuffled)') + if (isGroup(this.item)) { + this.emit('queue (shuffled)') + } else { + this.emit('queue (play next)') + } } } else if (telc.isBackspace(keyBuf)) { this.emit('remove') -- cgit 1.3.0-6-gf8a5