[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby-mp3info

Sergio Ruiz

7/26/2006 8:05:00 PM

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!

--
Posted via http://www.ruby-....

3 Answers

Tim Hoolihan

7/26/2006 8:10:00 PM

0

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!
>

Justin Collins

7/26/2006 8:11:00 PM

0

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

Use require 'rubygems' first.

-Justin

Sergio Ruiz

7/26/2006 8:29:00 PM

0


> Use require 'rubygems' first.
>
> -Justin

got it! thanks!

i tried that, mixed with other stuff i found via google.. with no luck..

the winning combo is:

require "rubygems"
require "mp3info"

thanks again..

--
Posted via http://www.ruby-....