[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] archive: support comments, default to none
From: |
Eric Wong |
Subject: |
[PATCH 1/4] archive: support comments, default to none |
Date: |
Fri, 7 Jan 2022 05:35:41 +0000 |
The default "Processed by SoX" comment is pointless, and I often
want to archive + tag something in one step to reduce FS I/O.
---
bin/dtas-archive | 8 ++++++--
1 file 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 @@
stats = false
keep_going = false
compression = []
+comment = []
OptionParser.new('', 24, ' ') do |op|
op.banner = usage
@@ -36,6 +37,7 @@
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 @@
op.parse!(ARGV)
end
+comment.push('--comment', '') if comment.empty?
+
dst = ARGV.pop
src = ARGV.dup
@@ -137,7 +141,7 @@
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 @@
end
end
- cmd = [ 'sox', input, *compression, output ]
+ cmd = [ 'sox', input, *compression, *comment, output ]
if stats
cmd << 'stats'
cmd = [ *cmd, { err: stats_out } ]
[PATCH 4/4] dtas-console: add 'i' toggle to show comments (metadata), Eric Wong, 2022/01/07
[PATCH 5/4] splitfx: fix track_zpad with integer arg, Eric Wong, 2022/01/07
[PATCH 6/4] doc: drop ordered map from examples, Eric Wong, 2022/01/07