문제

I'm trying to read the duration out of an mp3 file using ruby-mp3info and my test.rb file currently looks like this:

require "rubygems"
require "mp3info"

# read and display infos & tags
Mp3Info.open("audiofile.mp3") do |mp3info|
  puts mp3info
end

However, when I run ruby test.rb I get the error:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- mp3info (LoadError)

I'm on a Mac running Snow Leopard, and other that running sudo gem install ruby-mp3info this is a pretty basic install. id3lib-ruby looks like a possible alternative, however the Mac install seems a bit more involved.

Is there an easy way to fix the mp3info install or otherwise get the duration of an mp3 file?

Thanks! Peter

도움이 되었습니까?

해결책

Try running gem install ruby-mp3info without the sudo.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top