'failed to allocate memory' with Mp3Info module

F

firejdl

Hey all:

I'm pretty new to Ruby [this is my second script], but I'm trying to
write a little playlist generator script to scan a few directories every
once in a while [probably in a cron job], and update a .m3u playlist
based on what it finds. I like having info in my playlist so it loads
automatically with the playlist, so I'm trying to use the Mp3Info
module. I've got my list of files in an array called files. Here's the
code I'm using to test things out:

i = 0
files.each do |f|
Mp3Info.open(f) do |info|
puts f
i += 1
end
end

i is just to see how far it's getting, and puts f is just to see what
the particular song is.

It runs just fine, up to i=32. At that point, it errors out, with:
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:280:in
`read': failed to allocate memory (NoMemoryError)
from
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:280:in
`add_value_to_tag2'
from
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:231:in
`read_id3v2_3_frames'
from
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:220:in
`read_id3v2_3_frames'
from
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info/id3v2.rb:135:in
`from_io'
from
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info.rb:420:in
`parse_tags'
from
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info.rb:179:in
`initialize'
from
/usr/lib64/ruby/gems/1.8/gems/ruby-mp3info-0.5/lib/mp3info.rb:279:in
`open'
from ./playlistgen.rb:48
from ./playlistgen.rb:47

Am I doing things wrong? Or is it just running out of memory? If it's
the latter, is there any way to expand the amount of memory for
Ruby/Mp3Info to use?

All I really want to do is get the song length, artist and title...is
there any better way to do it?

Thanks!
~Joey

PS. I'm using Ruby 1.8.3 and Mp3Info 0.5 on AMD64 with the patch at
http://rubyforge.org/tracker/index.php?func=detail&aid=3157&group_id=62&atid=325
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top