I've been writing some simple music collection management scripts in ruby lately, and it seems to be going well. I found ruby id3 with a google search, it while not perfect it seems to meet my needs. However, I can't seem to find any ruby library/class that will help me get information out of mp3/ogg/etc. files that is not ID3. For example I would like to examine any mp3 file and determine its bitrate and playtime. Is there a utility to give me this functionality or am I going to have to write a wrapper for a C library?
Thanks,
Scott
Scott Rubin wrote:
I've been writing some simple music collection management scripts in ruby lately, and it seems to be going well. I found ruby id3 with a google search, it while not perfect it seems to meet my needs. However, I can't seem to find any ruby library/class that will help me get information out of mp3/ogg/etc. files that is not ID3. For example I would like to examine any mp3 file and determine its bitrate and playtime. Is there a utility to give me this functionality or am I going to have to write a wrapper for a C library?
i've already written a wrapper which might suit your needs. it is
rather new and it's also the first time i mention it here.
it wraps xine (http://xine.sf.net), a media player library you might
heard of and can be found here:
http://xiron.sourceforge.net/
only a cvs module (xiron-new) is available for now, it is not yet
released. you may also need the latest cvs of xine-lib since xiron may
trigger some bugs in lastest released version.
you can retrieve information about _any_ media file xine supports:
stefan@droopy data $ irb -r xiron
irb(main):001:0> s = Stream.new VideoPort.none, AudioPort.none
=> #<Stream:0x40715de4>
irb(main):002:0> s.open "ogg_vorbis.ogg"
=> true
irb(main):003:0> s.length
=> 10.011
irb(main):004:0> s.title
=> "Matrix XP Soundtrack"
irb(main):005:0> s.bitrate
=> 110734
irb(main):006:0> s.open "xvid.avi"
=> true
irb(main):007:0> s.length
=> 120.0
irb(main):008:0>
you can also play these files of course.
but there are also a few catches:
- xine has a relatively large memory footprint which might be too blown
for your needs
- the tag informations are only readible for now
- only tested on linux, might also work on other unix-derivates
RY
Stefan
Scott Rubin wrote:
I've been writing some simple music collection management scripts in ruby lately, and it seems to be going well. I found ruby id3 with a google search, it while not perfect it seems to meet my needs. However, I can't seem to find any ruby library/class that will help me get information out of mp3/ogg/etc. files that is not ID3. For example I would like to examine any mp3 file and determine its bitrate and playtime. Is there a utility to give me this functionality or am I going to have to write a wrapper for a C library?
Here's a little bit of Ruby code a friend of me wrote -- it will not do everything you want and might even fail at some times, but it should at least get you started.
meta.rb (5.37 KB)
Stefan,
Yeah, I know all about xine, I run gentoo
But as you said, this is definitely too much for what I need. However, it will very much come in handy in the future for other projects. I'll keep an eye out for stable releases. Any other options?
-Scott
Stefan Holst wrote:
···
Scott Rubin wrote:
I've been writing some simple music collection management scripts in ruby lately, and it seems to be going well. I found ruby id3 with a google search, it while not perfect it seems to meet my needs. However, I can't seem to find any ruby library/class that will help me get information out of mp3/ogg/etc. files that is not ID3. For example I would like to examine any mp3 file and determine its bitrate and playtime. Is there a utility to give me this functionality or am I going to have to write a wrapper for a C library?
i've already written a wrapper which might suit your needs. it is
rather new and it's also the first time i mention it here.
it wraps xine (http://xine.sf.net), a media player library you might
heard of and can be found here:
http://xiron.sourceforge.net/
only a cvs module (xiron-new) is available for now, it is not yet
released. you may also need the latest cvs of xine-lib since xiron may
trigger some bugs in lastest released version.
you can retrieve information about _any_ media file xine supports:
stefan@droopy data $ irb -r xiron
irb(main):001:0> s = Stream.new VideoPort.none, AudioPort.none
=> #<Stream:0x40715de4>
irb(main):002:0> s.open "ogg_vorbis.ogg"
=> true
irb(main):003:0> s.length
=> 10.011
irb(main):004:0> s.title
=> "Matrix XP Soundtrack"
irb(main):005:0> s.bitrate
=> 110734
irb(main):006:0> s.open "xvid.avi"
=> true
irb(main):007:0> s.length
=> 120.0
irb(main):008:0>
you can also play these files of course.
but there are also a few catches:
- xine has a relatively large memory footprint which might be too blown
for your needs
- the tag informations are only readible for now
- only tested on linux, might also work on other unix-derivates
RY
Stefan
Totally awesome, that's perfect. Thanks!
Florian Groß wrote:
···
Scott Rubin wrote:
I've been writing some simple music collection management scripts in ruby lately, and it seems to be going well. I found ruby id3 with a google search, it while not perfect it seems to meet my needs. However, I can't seem to find any ruby library/class that will help me get information out of mp3/ogg/etc. files that is not ID3. For example I would like to examine any mp3 file and determine its bitrate and playtime. Is there a utility to give me this functionality or am I going to have to write a wrapper for a C library?
Here's a little bit of Ruby code a friend of me wrote -- it will not do everything you want and might even fail at some times, but it should at least get you started.