« get me outta code hell

http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/http-music.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/http-music.js')
-rwxr-xr-xsrc/http-music.js23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/http-music.js b/src/http-music.js
index 863d170..e926e5d 100755
--- a/src/http-music.js
+++ b/src/http-music.js
@@ -2,14 +2,12 @@
 
 'use strict'
 
-const fs = require('fs')
-
 const { promisify } = require('util')
+const fs = require('fs')
+const pickers = require('./pickers')
 const loopPlay = require('./loop-play')
 const processArgv = require('./process-argv')
 
-const pickers = require('./pickers')
-
 const {
   filterPlaylistByPathString, removeGroupByPathString, getPlaylistTreeString
 } = require('./playlist-utils')
@@ -259,7 +257,10 @@ Promise.resolve()
         return
       }
 
-      const play = loopPlay(picker, playOpts)
+      const {
+        promise: playPromise,
+        controller: play
+      } = loopPlay(picker, playOpts)
 
       // We're looking to gather standard input one keystroke at a time.
       process.stdin.setRawMode(true)
@@ -303,11 +304,11 @@ Promise.resolve()
         }
 
         if (Buffer.from('s').equals(data)) {
-          // clearConsoleLine()
-          // console.log(
-          //   "Skipping the track that's currently playing. " +
-          //   "(Press I for track info!)"
-          // )
+          clearConsoleLine()
+          console.log(
+            "Skipping the track that's currently playing. " +
+            "(Press I for track info!)"
+          )
 
           play.skipCurrent()
         }
@@ -331,7 +332,7 @@ Promise.resolve()
         }
       })
 
-      return play.promise
+      return playPromise
     } else {
       return activePlaylist
     }