From 39732bd31e13c9a785eac1fc724bc9fc768be2ab Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 14 Aug 2021 00:44:47 -0300 Subject: show timestamp hours column whenever appropriate --- combine-album.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'combine-album.js') 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])}`) -- cgit 1.3.0-6-gf8a5