From: Stefan Holst Date: 2005-02-16T19:16:52+09:00 Subject: Re: Reading mp3 files 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 => # 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