File
freedb.rb
Path: lib/freedb.rb
Modified: Thu Feb 13 16:52:04 CET 2003

$Id: freedb.rb,v 1.22 2003/02/13 15:52:04 moumar Exp $

Description

ruby-freedb is a Ruby library who provide access to cddb/freedb servers as well as local database, can dump the "discid" from a CD and submit new entries to the freedb database.

Download

get tar.gz and debian packages at davedd.free.fr/ruby-freedb/download/

Installation

CAUTION: Some files have changed since 0.4, please clean up your old ruby-freedb (0.3.1 and older) installation before installing this one by deleting our freedb_misc.rb and freedb.so.

  $ ruby extconf.rb
  $ make
  $ make install

Examples

see examples/ directory for more advanced examples

get all possible matches for CD in "/dev/cdrom"

  freedb = Freedb.new("/dev/cdrom")
  freedb.fetch
  freedb.results.each { |r| puts r }

getting full description

  # get "rock" match for this cd
  freedb.get_result("rock")

make something with your freedb object

  puts freedb.title                   # disc's title
  puts freedb.artist                  # disc's artist
  puts freedb.length                  # disc's length in seconds
  puts freedb.tracks.size             # number of tracks on the CD
  puts freedb.tracks[3]["title"]      # title of the track 4
                                      # (indexing begin at 0)
  puts freedb.tracks[5]["length"]     # length of track 6 in seconds

Testing

In order to run all tests, you have to burn the "freedb CD Test" at www.freedb.org/software/freedb_testcd.zip and you must be connected to internet.

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

  $ cd test/
  $ ruby test_all.rb

ToDo

Changelog

[0.5 07/02/2003]

[0.4.2 10/01/2003]

[0.4.1 13/10/2002]

[0.4 28/09/2002]

[0.3.1 30/08/2002]

[0.3 07/04/2002]

[0.2 19/01/2002]

[0.1 18/12/2001]

License:GPL
Author:Guillaume Pierronnet (moumar@netcourrier.com)
Website:davedd.free.fr/ruby-freedb/
Required files

freedb_cdrom net/http net/smtp
Classes and Modules

Class Freedb
Class FreedbError