adamwiggins (owner)

Revisions

gist: 74617 Download_button fork
public
Public Clone URL: git://gist.github.com/74617.git
Embed All Files: show embed
mp3tags.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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)