« get me outta code hell

http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/loop-play.js7
-rwxr-xr-xsrc/play.js12
-rw-r--r--todo.txt8
3 files changed, 21 insertions, 6 deletions
diff --git a/src/loop-play.js b/src/loop-play.js
index 66de65a..585414b 100644
--- a/src/loop-play.js
+++ b/src/loop-play.js
@@ -367,6 +367,8 @@ class PlayController extends EventEmitter {
 
         this.startNextDownload()
       })
+
+    return picked
   }
 
   playFile(file) {
@@ -374,6 +376,9 @@ class PlayController extends EventEmitter {
   }
 
   async skip() {
+    // TODO: It would be nice if this returned the next track, but that
+    // probably isn't possible with the current play/loop-setup.
+
     await this.player.kill()
     this.currentTrack = null
   }
@@ -384,7 +389,7 @@ class PlayController extends EventEmitter {
     }
 
     this.downloadController.cancel()
-    this.startNextDownload()
+    return this.startNextDownload()
   }
 
   async stop() {
diff --git a/src/play.js b/src/play.js
index 680e326..1416420 100755
--- a/src/play.js
+++ b/src/play.js
@@ -393,12 +393,14 @@ async function main(args) {
 
       if (Buffer.from([0x7f]).equals(data)) {
         clearConsoleLine()
-        console.log(
-          "Skipping the track that's up next. " +
-          "(Press I for track info!)"
-        )
+        console.log("Skipping the track that's up next.")
 
-        playController.skipUpNext()
+        playController.skipUpNext().then(nextTrack => {
+          console.log(
+            `New track up next: ${nextTrack.name || '(Unnamed)'}` +
+            " (Press I for track info!)"
+          )
+        })
       }
 
       if (equalsChar('i') || equalsChar('t')) {
diff --git a/todo.txt b/todo.txt
index ae04c07..534d1ee 100644
--- a/todo.txt
+++ b/todo.txt
@@ -292,3 +292,11 @@ TODO: More selectors! No-loop/loop options of ordered and shuffled would be
 
 TODO: Magically watching for the play/pause keyboard button being pressed
       would be fun. (This would definitely be togglable via option!)
+
+TODO: Show the new up-next song when delete-up-next (backspace) is pressed.
+      (Done!)
+
+TODO: safeUnlink probably shouldn't throw/reject if it fails to delete its
+      given file (e.g. if a temporary file was automatically purged by the
+      system before safeUnlink). Having a warning might be better? (Since
+      *most* of the time it's probably a bug.)