« get me outta code hell

WIP(?) metadata processing tool - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/download-playlist.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-01-05 23:20:58 -0400
committerFlorrie <towerofnix@gmail.com>2018-01-05 23:20:58 -0400
commit18435f58f82849dcc86ab2042491828b2873b39a (patch)
tree07c912b688ba979b2ba96bdb3f17f7b390642cec /src/download-playlist.js
parent6f640a0b8e8e5b26a266f4680a626a629d3c7944 (diff)
WIP(?) metadata processing tool
Diffstat (limited to 'src/download-playlist.js')
-rwxr-xr-xsrc/download-playlist.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/download-playlist.js b/src/download-playlist.js
index b41c240..852cb64 100755
--- a/src/download-playlist.js
+++ b/src/download-playlist.js
@@ -12,6 +12,7 @@ const {
 } = require('./playlist-utils')
 
 const { getDownloaderFor, makePowerfulDownloader } = require('./downloaders')
+const { showTrackProcessStatus } = require('./general-util')
 const { promisify } = require('util')
 const { spawn } = require('child_process')
 
@@ -24,12 +25,8 @@ async function downloadCrawl(playlist, topOut = './out/') {
   const flat = flattenGrouplike(playlist)
   let doneCount = 0
 
-  const showStatus = function() {
-    const total = flat.items.length
-    const percent = Math.trunc(doneCount / total * 10000) / 100
-    console.log(
-      `\x1b[1mDownload crawler - ${percent}% completed ` +
-      `(${doneCount}/${total} tracks)\x1b[0m`)
+  const showStatus = () => {
+    showTrackProcessStatus(flat.items.length, doneCount)
   }
 
   // First off, we go through all tracks and see which are already downloaded.