#!/usr/bin/env ruby # # omptagger # http://github.com/omp/omptagger # Modify and display metadata of audio files. # # Copyright 2007-2010 David Vazgenovich Shakaryan # Distributed under the terms of the GNU General Public License v3. # See http://www.gnu.org/licenses/gpl.txt for the full license text. require 'getoptlong' actions = Array.new options = Array.new scheme = '%a - %t' GetoptLong.new( ['--view', '-v', GetoptLong::NO_ARGUMENT], ['--view-tag', '-t', GetoptLong::REQUIRED_ARGUMENT], ['--set-tag', '-s', GetoptLong::REQUIRED_ARGUMENT], ['--remove', '-r', GetoptLong::NO_ARGUMENT], ['--remove-tag', '-d', GetoptLong::REQUIRED_ARGUMENT], ['--generate', '-g', GetoptLong::NO_ARGUMENT], ['--rename', '-m', GetoptLong::NO_ARGUMENT], ['--scheme', '-n', GetoptLong::REQUIRED_ARGUMENT], ['--pretend', '-p', GetoptLong::NO_ARGUMENT], ['--list', '-l', GetoptLong::NO_ARGUMENT], ['--help', '-h', GetoptLong::NO_ARGUMENT] ).each do |option, argument| option = option.delete('-').intern case option when :scheme scheme = argument when :help, :list, :pretend options << option when :viewtag, :settag, :removetag actions << [option, argument] when :generate, :rename actions << [option, scheme] else actions << option end end