« get me outta code hell

Shift+Q to play next - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-07-05 10:28:09 -0300
committerFlorrie <towerofnix@gmail.com>2018-07-05 10:28:25 -0300
commit48fce96444f720263409ec548d66dfbae53dcc6b (patch)
treee32718375657e4cf2ca38ca8ffd246f8689e3fdc
parentfe4db4e4f093697b8b35cd63c80c16695fedb2ca (diff)
Shift+Q to play next
-rw-r--r--README.md3
-rw-r--r--todo.txt1
-rw-r--r--ui.js9
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).
   * <kbd>Enter</kbd> - if the selected item is a group, enter it; otherwise play it
   * <kbd>Backspace</kbd> - leave the current group (if in one)
   * <kbd>q</kbd> - queue the selected track or group to play after any other items in the queue (usually after the current track)
-  * <kbd>Q</kbd> (shift+Q) - queue the selected group, but shuffled
+  * <kbd>Q</kbd> (shift+Q) on a group - queue the selected group, but shuffled
+  * <kbd>Q</kbd> (shift+Q) on a track - queue the selected track to play immediately after what's currently playing
   * <kbd>d</kbd> - download the selected track (but don't play it)
 * **In the queue listing:**
   * <kbd>s</kbd> - 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')