From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 208.118.235.0/24 X-Spam-Status: No, score=-2.2 required=3.0 tests=AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: dtas-all@80x24.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id B35A61F4F6 for ; Sun, 17 May 2015 02:20:57 +0000 (UTC) Received: from localhost ([::1]:35830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtoCH-0000mr-0n for dtas-all@80x24.org; Sat, 16 May 2015 22:20:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtoCE-0000ml-Ew for dtas-all@nongnu.org; Sat, 16 May 2015 22:20:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YtoCB-0001DQ-8X for dtas-all@nongnu.org; Sat, 16 May 2015 22:20:54 -0400 Received: from dcvr.yhbt.net ([64.71.152.64]:58447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YtoCB-0001Cw-3I for dtas-all@nongnu.org; Sat, 16 May 2015 22:20:51 -0400 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 1E3BC1F4F6; Sun, 17 May 2015 02:20:50 +0000 (UTC) From: Eric Wong To: Subject: [PATCH] dtas-splitfx: support --trim argument Date: Sun, 17 May 2015 02:20:48 +0000 Message-Id: <1431829248-2826-1-git-send-email-e@80x24.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.71.152.64 Cc: Eric Wong X-BeenThere: dtas-all@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dtas-all-bounces+dtas-all=80x24.org@nongnu.org Sender: dtas-all-bounces+dtas-all=80x24.org@nongnu.org It can often be useful to expose only part of a track for quick inspection. This lets us do that. --- Documentation/dtas-splitfx.txt | 8 ++++++++ bin/dtas-splitfx | 1 + lib/dtas/splitfx.rb | 9 +++++++++ 3 files changed, 18 insertions(+) diff --git a/Documentation/dtas-splitfx.txt b/Documentation/dtas-splitfx.txt index 049371f..2a599ea 100644 --- a/Documentation/dtas-splitfx.txt +++ b/Documentation/dtas-splitfx.txt @@ -51,6 +51,14 @@ to use ecasound(1), too. -b, \--bits BITS : Override the output bit depth in the specified TARGET +-t, \--trim POSITION +: Passes a POSITION argument to the sox "trim" effect to allow + limiting output to only process a portion of the original. + This bypasses the "tracks" section and of the YAML file and + outputs the result as a single file with the TRACKNUMBER + of "000". For ease-of-typing, commas in this command-line + argument are automatically expanded to spaces when passed to sox. + # FILE FORMAT * infile - string, the pathname of the original audio file diff --git a/bin/dtas-splitfx b/bin/dtas-splitfx index a764cb3..d28cc5d 100755 --- a/bin/dtas-splitfx +++ b/bin/dtas-splitfx @@ -18,6 +18,7 @@ OptionParser.new('', 24, ' ') do |op| op.on('-C', '--compression FACTOR') { |val| opts[:compression] = val } op.on('-r', '--rate RATE') { |val| opts[:rate] = val } op.on('-b', '--bits RATE', Integer) { |val| opts[:bits] = val } + op.on('-t', '--trim POSITION') { |val| opts[:trim] = val.tr(',', ' ') } op.parse!(ARGV) end diff --git a/lib/dtas/splitfx.rb b/lib/dtas/splitfx.rb index e4997cc..b657179 100644 --- a/lib/dtas/splitfx.rb +++ b/lib/dtas/splitfx.rb @@ -16,6 +16,14 @@ class DTAS::SplitFX # :nodoc: include DTAS::XS attr_reader :infile, :env + class UTrim + attr_reader :env, :comments + def initialize(trim_arg, env, comments) + @env = env.merge("TRIMFX" => "trim #{trim_arg}") + @comments = comments.merge('TRACKNUMBER' => '000') + end + end + class Skip < Struct.new(:tbeg) # :nodoc: def commit(_) # noop @@ -353,6 +361,7 @@ class DTAS::SplitFX # :nodoc: @compression = opts[:compression] @rate = opts[:rate] @bits = opts[:bits] + trim = opts[:trim] and @tracks = [ UTrim.new(trim, @env, @comments) ] fails = [] tracks = @tracks.dup -- EW