Sha256: c2680fbac6f3c6286e9bb0d6c4b2db1451b2d32dc29dbf2a8f4baee121efae67
Contents?: true
Size: 1.64 KB
Versions: 4
Compression:
Stored size: 1.64 KB
Contents
#!/usr/bin/env ruby # # Created on 2007-12-6. # Copyright (c) 2007. All rights reserved. begin require 'rubygems' rescue LoadError # no rubygems to load, so we fail silently end require 'optparse' require 'flac2mp3' OPTIONS = {} MANDATORY_OPTIONS = %w[] meta = false parser = OptionParser.new do |opts| opts.banner = <<BANNER Usage: #{File.basename($0)} [filename] Options are: BANNER opts.separator '' opts.on('-v', '--version', "Show the #{File.basename($0)} version number and exit") { require 'flac2mp3/version'; puts "flac2mp3 #{Flac2mp3::VERSION::STRING}"; exit } opts.on('-d', '--[no-]delete', "Delete the original file after conversion") { |delete| OPTIONS[:delete] = delete } opts.on('-s', '--silent', "Don't show progress") { |silent| OPTIONS[:silent] = silent } opts.on('-e', '--encoding=ENCODING', String, "Set lame encoding options", "Default: #{Flac2mp3.default_encoding}") { |encoding| OPTIONS[:encoding] = encoding } opts.on('-m', '--meta', 'Convert metadata (requires a second filename)') { meta = true } opts.on('-h', '--help', 'Show this help message.') { puts opts; exit } opts.parse!(ARGV) if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? } puts opts; exit end end # do stuff filename = ARGV[0] if meta mp3file = ARGV[1] unless filename and mp3file puts "Usage: #{File.basename($0)} --meta [filename] [mp3file]" exit end Flac2mp3.convert_metadata(filename, mp3file) else unless filename puts "Usage: #{File.basename($0)} [filename]" exit end Flac2mp3.convert(filename, OPTIONS) end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
flac2mp3-0.4.2 | bin/flac2mp3 |
flac2mp3-0.4.1 | bin/flac2mp3 |
flac2mp3-0.4.0 | bin/flac2mp3 |
flac2mp3-0.3.2 | bin/flac2mp3 |