[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] dtas-splitfx: add --stats/-S switch
From: |
Eric Wong |
Subject: |
[PATCH] dtas-splitfx: add --stats/-S switch |
Date: |
Sat, 27 Jan 2024 22:17:21 +0000 |
Similar to the switch in dtas-archive(1), I got tired of having
to manually add stats to all the rips I was tracking out.
---
Documentation/dtas-splitfx.pod | 9 ++++++++-
bin/dtas-splitfx | 1 +
lib/dtas/splitfx.rb | 4 +++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/Documentation/dtas-splitfx.pod b/Documentation/dtas-splitfx.pod
index f8de59b..6f8d9ed 100644
--- a/Documentation/dtas-splitfx.pod
+++ b/Documentation/dtas-splitfx.pod
@@ -37,6 +37,12 @@ Print, but do not run the commands to be executed
Silent operation, commands are not printed as executed
+=item -S, --stats
+
+Add the sox "stats" effect to the end of the effects chain,
+use this with L</--err-suffix> to get a C<.stats> file with
+every track output
+
=item -D, --no-dither
Disable automatic setting of the DITHERFX env. This also passes
@@ -46,7 +52,8 @@ the option to L<sox(1)> via SOX_OPTS.
Write the contents of C<stderr>. This is useful for capturing
the per-track output of the L<sox(1)> C<stats> effect when
-combined with parallel C<--jobs>.
+combined with parallel C<--jobs>. Recommended for use with the
+L</--stats> switch.
=item -O, --outdir OUTDIR
diff --git a/bin/dtas-splitfx b/bin/dtas-splitfx
index d0afc7b..17d915d 100755
--- a/bin/dtas-splitfx
+++ b/bin/dtas-splitfx
@@ -13,6 +13,7 @@
op.on('-n', '--dry-run') { opts[:dryrun] = true }
op.on('-j', '--jobs [JOBS]', Integer) { |val| opts[:jobs] = val } # nil==inf
op.on('-s', '--quiet', '--silent') { opts[:silent] = true }
+ op.on('-S', '--stats', 'run stats every track') { opts[:stats] = true }
op.on('-f', '--filter FILTER') { |val| (opts[:filter] ||= []) << val }
op.on('-D', '--no-dither') { opts[:no_dither] = true }
op.on('-O', '--outdir OUTDIR') { |val| opts[:outdir] = val }
diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb
index bb31ab5..1150ee0 100644
--- a/lib/dtas/splitfx.rb
+++ b/lib/dtas/splitfx.rb
@@ -10,7 +10,8 @@
# Unlike the stuff for dtas-player, dtas-splitfx is fairly tied to sox
# (but we may still pipe to ecasound or anything else)
class DTAS::SplitFX # :nodoc:
- CMD = 'sox "$INFILE" $COMMENTS $OUTFMT $OUTDST $TRIMFX $FX $RATEFX $DITHERFX'
+ CMD = 'sox "$INFILE" $COMMENTS $OUTFMT $OUTDST $TRIMFX $FX' \
+ ' $RATEFX $DITHERFX $STATS'
include DTAS::Process
attr_reader :infile, :env, :command
@@ -204,6 +205,7 @@ def splitfx_spawn(target, t, opts)
elsif outfmt.bits && outfmt.bits <= 16
env["DITHERFX"] = "dither -s"
end
+ env['STATS'] = 'stats' if opts[:stats]
comments = Tempfile.new(%W(dtas-splitfx-#{t.comments["TRACKNUMBER"]} .txt))
t.comments.each do |k,v|
env[k] = v.to_s
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] dtas-splitfx: add --stats/-S switch,
Eric Wong <=