Skip to content

Instantly share code, notes, and snippets.

@adamwiggins
Created March 5, 2009 22:50
Show Gist options
  • Save adamwiggins/74617 to your computer and use it in GitHub Desktop.
Save adamwiggins/74617 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'rubygems'
def mp3tags(fname)
require 'mp3info'
Mp3Info.open(fname) { |mp3info| mp3info }
end
def oggtags(fname)
require 'ogginfo'
OggInfo.open(fname) { |ogg| ogg }
end
def flactags(fname)
require 'flacinfo'
FlacInfo.new(fname).tags
end
def tags(fname)
case fname.split('.').last.downcase
when 'mp3' then mp3tags(fname)
when 'ogg' then oggtags(fname)
when 'flac' then flactags(fname)
end
end
puts tags(ARGV.shift)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment