Tim Hoolihan
7/26/2006 8:10:00 PM
I wrote the following to test mp3info when I first started working with
it, I hope it helps:
require 'rubygems'
require 'mp3info'
require "rbconfig"
include Config
class OS
def OS.type?(os)
CONFIG["host"].include?(os)
end
end
def processdir(d)
d+=(OS.type?("win32") ? "\\" : "/") if (d[-1]!="/" or d[-1]!="\\")
puts "Opening #{d}-"
Dir.entries(d).each do |f|
next unless f=~/.mp3/ and !File.directory?(d+f)
puts " examining #{f}"
begin
pfile(d+f)
rescue
puts "Error getting tag from #{f}",$!
end
end
end
def pfile(f)
Mp3Info.open(f) do |mp3|
mp3.tag.each{|k,v| puts "\t#{k}:#{v}"}
end
end
d=ARGV[0]
puts d
File.directory?(d) ? processdir(d) : pfile(d)
Sergio Ruiz wrote:
> i have checked around on the net, but have not found anything.. i also
> can't get the search to work on this site either, so i decided to try
> here..
>
> i am trying to get this package to work.. installed the gem..
>
> then did this..
>
> require "mp3info"
>
> Mp3Info.open("myfile.mp3")
>
>
> and all i get is this:
>
> mp3.rb:4: uninitialized constant Mp3Info (NameError)
>
> i am sure i am doing something really stupid.. but i am stumped..
>
> any ideas?
>
> thanks!
>