From: Eric Wong <e@80x24.org>
To: dtas-all@nongnu.org
Subject: [PATCH] dtas-splitfx: add --stats/-S switch
Date: Sat, 27 Jan 2024 22:17:21 +0000 [thread overview]
Message-ID: <20240127221721.3153512-1-e@80x24.org> (raw)
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
reply other threads:[~2024-01-27 22:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://80x24.org/dtas/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240127221721.3153512-1-e@80x24.org \
--to=e@80x24.org \
--cc=dtas-all@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/dtas.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).