« get me outta code hell

Change the way playlist updating works, and show track paths when I is pressed - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/loop-play.js
diff options
context:
space:
mode:
authorliam4 <towerofnix@gmail.com>2017-07-19 12:15:21 -0300
committerliam4 <towerofnix@gmail.com>2017-07-19 12:15:21 -0300
commita1bc37389a063e95328987385fb8b5c77ed05488 (patch)
tree5a3ab4e1890879798140bcc48b4779a5ea116b2e /src/loop-play.js
parentb39407787e36128e63cf3387c1cfd9b480af4dfa (diff)
Change the way playlist updating works, and show track paths when I is pressed
Diffstat (limited to 'src/loop-play.js')
-rw-r--r--src/loop-play.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/loop-play.js b/src/loop-play.js
index f36f1fb..7457b41 100644
--- a/src/loop-play.js
+++ b/src/loop-play.js
@@ -4,6 +4,7 @@ const { spawn } = require('child_process')
 const FIFO = require('fifo-js')
 const EventEmitter = require('events')
 const { getDownloaderFor } = require('./downloaders')
+const { getItemPathString } = require('./playlist-utils')
 
 class DownloadController extends EventEmitter {
   waitForDownload() {
@@ -228,16 +229,22 @@ class PlayController {
   }
 
   logTrackInfo() {
+    const getMessage = t => {
+      let path = getItemPathString(t)
+
+      return (
+        `\x1b[1m${t.name} \x1b[0m@ ${path} \x1b[2m${t.downloaderArg}\x1b[0m`
+      )
+    }
+
     if (this.currentTrack) {
-      const t = this.currentTrack
-      console.log(`Playing: \x1b[1m${t.name} \x1b[2m${t.downloaderArg}\x1b[0m`)
+      console.log(`Playing: ${getMessage(this.currentTrack)}`)
     } else {
       console.log("No song currently playing.")
     }
 
     if (this.nextTrack) {
-      const t = this.nextTrack
-      console.log(`Up next: \x1b[1m${t.name} \x1b[2m${t.downloaderArg}\x1b[0m`)
+      console.log(`Up next: ${getMessage(this.nextTrack)}`)
     } else {
       console.log("No song up next.")
     }