Class MusicBrainz::DiscID
In: lib/mb-discid.rb
ext/mb_discid.c
Parent: Object

Initialize the DiscID class and make it available in Ruby.

Methods

Classes and Modules

Class MusicBrainz::DiscID::TrackInfo

Public Class methods

Returns a device string for the default device for this platform.

Construct a new DiscID object.

As an optional argument the name of the device to read the ID from may be given. If you don‘t specify a device here you can later read the ID with the read method.

Raises:ArgumentError, TypeError, Exception

Converts sectors to seconds.

According to the red book standard 75 sectors are one second.

Public Instance methods

Return the number of the first track on this disc (usually 1).

Returns nil if no ID was yet read.

Returns a FreeDB DiscID as a string.

Returns nil if no ID was yet read.

Returns the DiscID as a string.

Returns nil if no ID was yet read.

Returns the International Standard Recording Code (ISRC) for the track.

Requires libdiscid >= 0.3. If not supported this method will always return nil.

Returns always nil if no ID was yet read.

Return the number of the last track on this disc.

Returns nil if no ID was yet read.

Return the media catalogue number of the release, if present.

Requires libdiscid >= 0.3. If not supported this method will always return nil.

Returns nil if no ID was yet read.

Set the TOC information directly instead of reading it from a device.

Use this instead of read if the TOC information was already read elsewhere and you want to recalculate the ID. Throws an Exception if the CD‘s TOC can not be read.

Parameters:

first_track
The number of the first track on the disc (usually 1).
sectors
The total number of sectors on the disc.
offsets
Array of all track offsets. The number of tracks must not exceed 99.
Raises:Exception

Read the disc ID from the given device.

If no device is given the default device of the platform will be used. Throws an Exception if the CD‘s TOC can not be read.

Raises:ArgumentError, TypeError, Exception

Return the length of the disc in sectors.

Returns nil if no ID was yet read.

Return the length of the disc in sectors.

Returns nil if no ID was yet read.

Returns a submission URL for the DiscID as a string.

Returns nil if no ID was yet read.

DiscID to String conversion. Same as calling the method id but guaranteed to return a string.

Returns an array of TrackInfo objects. Each TrackInfo object contains detailed information about the track.

If a block is given this method returns nil and instead iterates over the block calling the block with one argument |track_info|.

Returns always nil if no ID was yet read. The block won‘t be called in this case.

Returns an array of [offset, length] tuples for each track.

Offset and length are both integer values representing sectors. If a block is given this method returns nil and instead iterates over the block calling the block with two arguments |offset, length|.

Returns always nil if no ID was yet read. The block won‘t be called in this case.

You may want to use the method track_details instead of this method to retrieve more detailed information about the tracks.

Return an URL for retrieving CD information from MusicBrainz’ web service

The URL provides the CD information in XML. See musicbrainz.org/development/mmd for details.

Returns nil if no ID was yet read.

[Validate]