Sha256: 67ac6922f0e489670e633e75811bc5934934b5ae1afefb5b8034de6484b2ed0e

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env ruby
# Copyright (C) 2013-2014, Eric Wong <e@80x24.org> and all contributors
# License: GPLv3 or later (https://www.gnu.org/licenses/gpl-3.0.txt)
require 'yaml'
require 'optparse'
require 'dtas/splitfx'
usage = "#$0 [-n|--dry-run][-j [JOBS]][-s|--silent] SPLITFX_FILE.yml [TARGET]"
overrides = {} # FIXME: not tested
opts = { jobs: 1 }
jobs = 1
OptionParser.new('', 24, '  ') do |op|
  op.banner = usage
  op.on('-n', '--dry-run') { opts[:dryrun] = true }
  op.on('-j', '--jobs [JOBS]', Integer) { |val| opts[:jobs] = val }
  op.on('-s', '--quiet', '--silent') { |val| opts[:silent] = true }
  op.on('-D', '--no-dither') { |val| opts[:no_dither] = true }
  op.parse!(ARGV)
end

args = []
ARGV.each do |arg|
  case arg
  when %r{\A(\w+)=(.*)\z}
    key, val = $1, $2
    # only one that makes sense is infile=another_file
    overrides[key] = YAML.load(val)
  when %r{\A(\w+)\.(\w+)=(.*)\z}
    # comments.ARTIST='blah'
    top, key, val = $1, $2, $3
    hsh = overrides[top] ||= {}
    hsh[key] = val
  else
    args << arg
  end
end

file = args.shift or abort usage
target = args.shift || "flac"
splitfx = DTAS::SplitFX.new
splitfx.import(YAML.load(File.read(file)), overrides)
splitfx.run(target, opts)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dtas-0.9.0 bin/dtas-splitfx
dtas-0.8.0 bin/dtas-splitfx