$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
- CD-ROM access under Win32
Changelog
[0.5 07/02/2003]
- submission (http or mail) added
- fetching from disk in Unix or Windows format added
- "raw_response" attribute added (raw response from the server)
[Fernando Arbeiza <arbeizaf@ono.com>]
- "tracks" removed (however it can be redefined with
'tracks.collect { |h| h["title"] }'
- "tracks_ext" renamed to "tracks"
- "genre" renamed to "category"
- "exact_genre" renamed to "genre"
- "get_result(index)": index
can be a String that represents the freedb category
- FetchCGI: does not rely on cgi.rb anymore
- documentation written with "rdoc"
[0.4.2 10/01/2003]
- Fixed a bug in track length computation [Fernando Arbeiza
<arbeizaf@ono.com>]
[0.4.1 13/10/2002]
- Improved cddb parser [Akinori MUSHA <knu@iDaemons.org>]
- Many bugs fixed in freedb_cdrom.c [Akinori MUSHA <knu@iDaemons.org>]
[0.4 28/09/2002]
- length attribute added
- tracks_ext attribute added
- fixed a bug in discid computation [Akinori MUSHA <knu@iDaemons.org>]
- protocol level handling
- test suite
- code refactoring
- file renaming (change nothing for end users)
[0.3.1 30/08/2002]
- genre read-only attribute added,
- fixes syntax error due to a change in the Ruby interpreter. [Akinori MUSHA
<knu@iDaemons.org>]
- debianization
[0.3 07/04/2002]
- fetch() replaced by fetch_net() however i created
an alias to fetch()
- fetch_cgi() added
- discid read-only attribute added
- free() bug on FreeBSD fixed in get_cdrom() [Stephane D'Alu
<sdalu@loria.fr>]
- get_cdrom() buffer overrun fixed [OGAWA Takaya
<t-ogawa@triaez.kaisei.org>]
[0.2 19/01/2002]
- Big cleaning of code.
- Minimum code ( just the CDROM access ) written in C. Other is in pure Ruby.
- Module now called 'freedb' instead of 'Freedb'.
- Deleted specific exceptions. There is only one now (FreedbError).
[0.1 18/12/2001]