« get me outta code hell

show timestamp hours column whenever appropriate - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/combine-album.js
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-08-14 00:44:47 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-08-14 00:44:47 -0300
commit39732bd31e13c9a785eac1fc724bc9fc768be2ab (patch)
tree2a40a9227f65832a202706cf2e9a1132e4024cd7 /combine-album.js
parentc047b8c57d4e5012578c072420d2b73dd5b59c4c (diff)
show timestamp hours column whenever appropriate
Diffstat (limited to 'combine-album.js')
-rw-r--r--combine-album.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/combine-album.js b/combine-album.js
index 9fd9cf0..946c4c1 100644
--- a/combine-album.js
+++ b/combine-album.js
@@ -3,7 +3,7 @@
 // too lazy to use import syntax :)
 const { readdir, readFile, stat, writeFile } = require('fs/promises')
 const { spawn } = require('child_process')
-const { promisifyProcess, parseOptions } = require('./general-util')
+const { getTimeStringsFromSec, parseOptions, promisifyProcess } = require('./general-util')
 const { musicExtensions } = require('./crawlers')
 const path = require('path')
 const shellescape = require('shell-escape')
@@ -164,13 +164,15 @@ async function main() {
     return 1
   }
 
+  const duration = tsData[tsData.length - 1].timestampEnd
+
   let tsText
   switch (opts.format) {
     case 'json':
       tsText = JSON.stringify(tsData) + '\n'
       break
     case 'txt':
-      tsText = tsData.map(t => `${t.timestamp} ${t.comment}`).join('\n') + '\n'
+      tsText = tsData.map(t => `${getTimeStringsFromSec(t.timestamp, duration, true).timeDone} ${t.comment}`).join('\n') + '\n'
       break
   }
 
@@ -197,7 +199,7 @@ async function main() {
 
     const concatListPath = opts['concat-list'] || `/tmp/combine-album-concat.txt`
     try {
-      await writeFile(concatListPath, files.map(file => `file ${path.resolve(shellescape([file]))}`).join('\n') + '\n')
+      await writeFile(concatListPath, files.map(file => `file ${shellescape([path.resolve(file)])}`).join('\n') + '\n')
       console.log(`Generated ffmpeg concat list at ${concatListPath}`)
       console.log(`# To concat:`)
       console.log(`ffmpeg -f concat -safe 0 -i ${shellescape([concatListPath])} -c copy ${shellescape([concatOutput])}`)