mp3info.rb

Path: lib/mp3info.rb
Last Update: Sun Jun 20 11:13:28 UTC 2004

$Id: mp3info.rb,v 1.4 2004/06/20 10:41:43 moumar Exp $

Description

ruby-mp3info gives you access to low level informations on mp3 files (bitrate, length, samplerate, etc…). It can read, write, remove id3v1 tag and read id3v2. It is written in pure ruby.

Download

get tar.gz at rubyforge.org/projects/ruby-mp3info/

Installation

  $ ruby install.rb config
  $ ruby install.rb setup
  # ruby install.rb install

Example

  require "mp3info"

  mp3info = Mp3Info.new("myfile.mp3")
  puts mp3info

Testing

Test::Unit library is used for tests. see testunit.talbott.ws/

 $ ruby test.rb

ToDo

  • adding write support for ID3v2 tags
  • adding a test for id3v2
  • encoder detection

Changelog

[0.3 04/05/2004]

  • massive changes of most of the code to make it easier to read & hopefully run faster
  • ID2TAGS hash is just informative now, no use of it in the code. id3v2 tag fields are read in directly
  • added support for id3 v2.2 and v2.4 (0.2.1 only supported v2.3)
  • much improved vbr duration guessing
  • made Mp3Info#to_s output to be prettier
  • moved hastag1? and hastag2? to be class booleans instead of functions (now named hastag1 and hastag2)
  • fixed a bug on computing "error_protection" attribute
  • new attribute "tag", which is a sort of "universal" tag, regardless of the tag version, 1 or 2, with the same keys as @tag1
  • new method hastag?, which test the presence of any tag

[0.2.1 04/09/2003]

  • filename attribute added
  • mp3 files are opened read-only now [Alan Davies <alan__DOT_davies__AT__thomson.com>]
  • Mp3Info#initialize: bugfixes [Alan Davies <alan__DOT_davies__AT__thomson.com>]
  • put NULLs in year field in id3v1 tags instead of zeros [Alan Davies <alan__DOT_davies__AT__thomson.com>]
  • Mp3Info#gettag1: remove null at end of strings [Alan Davies <alan__DOT_davies__AT__thomson.com>]
  • Mp3Info#extract_infos_from_head(): some brackets missed [Alan Davies <alan__DOT_davies__AT__thomson.com>]

[0.2 18/08/2003]

  • writing, reading and removing of id3v1 tags
  • reading of id3v2 tags
  • test suite improved
  • to_s method added
  • length attribute is a Float now

[0.1 17/03/2003]

  • Initial version
License:Ruby
Author:Guillaume Pierronnet (moumar_AT__rubyforge_DOT_org)
Website:ruby-mp3info.rubyforge.org/

[Validate]