Class: Freedb

Class Freedb |
In: | lib/freedb.rb
Parent: | Object

Methods

close, fetch, fetch_cgi, fetch_disk, fetch_net, get_result, new, submit, submit_http, submit_mail,

Attributes

[RW] | artist | artist of the CD, must not be empty
[RW] | category | freedb category, must be one of `Freedb::VALID_CATEGORIES`
[R] | discid | cddbid of the CD
[RW] | ext_infos | extended infos of the CD
[RW] | genre | arbitraty string for the genre
[R] | length | total length of the CD
[R] | query | the complete string used to query the database
[R] | raw_response | string containing raw entry from freedb database
[R] | results | an array with all possible results for this CD
[RW] | title | title of the CD, must not be empty
[RW] | tracks | an array of hashs containing following keys: "title" (must not be empty), "length", "ext" (for extended infos)
[RW] | year | year of the cd (0 if not known)

Public Class methods

new(param = "/dev/cdrom", is_query = false) src

If `is_query` is false, the discid of the CD in `param` is dumped. Else `param` is considered as a valid freedb query string and is used directly.

Public Instance methods

fetch_net(server = "freedb.org", port = 8880) src

Query database using network Fill the `results` array with multiple results. return nil if no match found

fetch(server = "freedb.org", port = 8880)

Alias for fetch_net

fetch_cgi(server = "www.freedb.org", port = 80, proxy = nil, proxy_port = nil, path = "/~cddb/cddb.cgi") src

Query database using CGI (HTTP) method. Fill the `results` array with multiple results. return nil if no match found

fetch_disk(directory, win_format = false) src

Query database using local directory. Set `win_format` to true if the database has windows format (see freedb howto in "misc/" for details) return nil if no match found

submit_http(from = "user@localhost", server = "freedb.org", port = 80, path = "/~cddb/submit.cgi", submit_mode = "submit") src

submit the current Freedb object using http `from` is an email adress used to return submissions errors `submit_mode` can be set to "test" to check submission validity (for developpers) return nil

submit(from = "user@localhost", server = "freedb.org", port = 80, path = "/~cddb/submit.cgi", submit_mode = "submit")

Alias for submit_http

submit_mail(smtp_server, from = "localuser@localhost", port = 25, to = "freedb-submit@freedb.org") src

submit the current Freedb object using smtp return `nil`

get_result(index) src

Retrieve full result from the database. If `index` is a Fixnum, get the `index`'th result in the `result` array If `index` is a String, `index` is the freedb category

close() src

close all pending connections