about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-01-27 22:17:21 +0000
committerEric Wong <e@80x24.org>2024-02-01 08:02:26 +0000
commit53c76bcdd0afb688289079515deb292dc4ba6c96 (patch)
tree7f15bde28d3692f5656a6fa22a5c01bd862e9940
parente4ec1f8ec7cc770368ce71c3136c6a4829411980 (diff)
downloaddtas-master.tar.gz
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.
-rw-r--r--Documentation/dtas-splitfx.pod9
-rwxr-xr-xbin/dtas-splitfx1
-rw-r--r--lib/dtas/splitfx.rb4
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 @@ OptionParser.new('', 24, '  ') do |op|
   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 @@ require 'tempfile'
 # 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 @@ class DTAS::SplitFX # :nodoc:
     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