diff options
author | Eric Wong <e@80x24.org> | 2022-01-07 05:35:41 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2022-01-11 18:21:58 +0000 |
commit | e6ca961fd5fe69afeec6c024dfbf9f12a3decde1 (patch) | |
tree | a48156f58e96407bc498687ccc25626f64c58bc7 | |
parent | 9316971d0da241c59637635c18c2e6fea4be493b (diff) | |
download | dtas-e6ca961fd5fe69afeec6c024dfbf9f12a3decde1.tar.gz |
The default "Processed by SoX" comment is pointless, and I often want to archive + tag something in one step to reduce FS I/O.
-rwxr-xr-x | bin/dtas-archive | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/dtas-archive b/bin/dtas-archive index dd3b537..c88873e 100755 --- a/bin/dtas-archive +++ b/bin/dtas-archive @@ -29,6 +29,7 @@ repeat = 1 stats = false keep_going = false compression = [] +comment = [] OptionParser.new('', 24, ' ') do |op| op.banner = usage @@ -36,6 +37,7 @@ OptionParser.new('', 24, ' ') do |op| op.on('-C', '--compression [FACTOR]', 'compression factor for sox') { |c| compression = [ '-C', c ] } + op.on('--comment=TEXT', String) { |c| comment.push('--comment', c) } op.on('-j', '--jobs [JOBS]', Integer) { |j| jobs = j } op.on('-S', '--stats', 'save stats on the file') { stats = true } op.on('-k', '--keep-going', 'continue after error') { keep_going = true } @@ -53,6 +55,8 @@ OptionParser.new('', 24, ' ') do |op| op.parse!(ARGV) end +comment.push('--comment', '') if comment.empty? + dst = ARGV.pop src = ARGV.dup @@ -137,7 +141,7 @@ thrs = jobs.times.map do |i| if dry_run || !silent names = job.map { |x| Shellwords.escape(x) } - cmd = [ 'sox', *names ] + cmd = [ 'sox', names[0], *compression, *comment, names[1] ] if stats cmd << 'stats' cmd << "2>#{Shellwords.escape(stats_out)}" @@ -151,7 +155,7 @@ thrs = jobs.times.map do |i| end end - cmd = [ 'sox', input, *compression, output ] + cmd = [ 'sox', input, *compression, *comment, output ] if stats cmd << 'stats' cmd = [ *cmd, { err: stats_out } ] |