From 53c76bcdd0afb688289079515deb292dc4ba6c96 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 27 Jan 2024 22:17:21 +0000 Subject: dtas-splitfx: add --stats/-S switch 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 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 via SOX_OPTS. Write the contents of C. This is useful for capturing the per-track output of the L C effect when -combined with parallel C<--jobs>. +combined with parallel C<--jobs>. Recommended for use with the +L 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 -- cgit v1.2.3-24-ge0c7