From 741bb52962c874ddc5ad72bdac8a183e49c8abe9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 24 May 2015 08:08:29 +0000 Subject: splitfx: allow -p/--sox-pipe option This allows splitfx YAML files to operate more seamlessly with external commands such as play(1) especially when combined with the -t/--trim option. --- bin/dtas-splitfx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bin/dtas-splitfx') diff --git a/bin/dtas-splitfx b/bin/dtas-splitfx index d363ab9..fc8cc69 100755 --- a/bin/dtas-splitfx +++ b/bin/dtas-splitfx @@ -6,8 +6,8 @@ require 'optparse' require 'dtas/splitfx' usage = "#$0 [-n|--dry-run][-j [JOBS]][-s|--silent] SPLITFX_FILE.yml [TARGET]" overrides = {} # FIXME: not tested +default_target = "flac" opts = { jobs: 1 } -jobs = 1 OptionParser.new('', 24, ' ') do |op| op.banner = usage op.on('-n', '--dry-run') { opts[:dryrun] = true } @@ -19,6 +19,10 @@ OptionParser.new('', 24, ' ') do |op| 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.on('-p', '--sox-pipe') do + opts[:sox_pipe] = true + default_target = 'sox' + end op.parse!(ARGV) end @@ -39,8 +43,9 @@ ARGV.each do |arg| end end +trap(:INT) { exit 130 } file = args.shift or abort usage -target = args.shift || "flac" +target = args.shift || default_target splitfx = DTAS::SplitFX.new splitfx.import(YAML.load(File.read(file)), overrides) splitfx.run(target, opts) -- cgit v1.2.3-24-ge0c7