Package musicbrainz2 :: Module model :: Class Disc
[frames | no frames]

Type Disc

object --+
         |
        Disc


Represents an Audio CD.

This class represents an Audio CD. A disc can have an ID (the MusicBrainz DiscID), which is calculated from the CD's table of contents (TOC). There may also be data from the TOC like the length of the disc in sectors, as well as position and length of the tracks.

Note that different TOCs, maybe due to different pressings, lead to different DiscIDs. Conversely, if two different discs have the same TOC, they also have the same DiscID (which is unlikely but not impossible). DiscIDs are always 28 characters long and look like this: 'J68I_CDcUFdCRCIbHSEbTBCbooA-'. Sometimes they are also referred to as CDIndex IDs.

The MusicBrainz web service only returns the DiscID and the number of sectors. The DiscID calculation function musicbrainz2.disc.readDisc, however, can retrieve the other attributes of Disc from an Audio CD in the disc drive.
Method Summary
  __init__(self, id_)
Constructor.
  addTrack(self, track)
Adds a track to the list.
  getFirstTrackNum(self)
Returns the number of the first track on this disc.
  getId(self)
Returns the MusicBrainz DiscID.
  getLastTrackNum(self)
Returns the number of the last track on this disc.
  getSectors(self)
Returns the length of the disc in sectors.
  getTracks(self)
Returns the sector offset and length of this disc.
  setFirstTrackNum(self, trackNum)
Sets the number of the first track on this disc.
  setId(self, id_)
Sets the MusicBrainz DiscId.
  setLastTrackNum(self, trackNum)
Sets the number of the last track on this disc.
  setSectors(self, sectors)
Sets the length of the disc in sectors.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Property Summary
  firstTrackNum: The number of the first track on this disc.
  id: The MusicBrainz DiscID.
  lastTrackNum: The number of the last track on this disc.
  sectors: The length of the disc in sectors.
  tracks: Sector offset and length of all tracks.

Method Details

__init__(self, id_=None)
(Constructor)

Constructor.
Parameters:
id_ - a string containing a 28-character DiscID
Overrides:
__builtin__.object.__init__

addTrack(self, track)

Adds a track to the list.

This method adds an (offset, length) tuple to the list of tracks. The leadout track must not be added. The total length of the disc can be set using setSectors.
Parameters:
track - an (offset, length) tuple (values are ints)

See Also: getTracks

getFirstTrackNum(self)

Returns the number of the first track on this disc.
Returns:
an int containing the track number, or None

getId(self)

Returns the MusicBrainz DiscID.
Returns:
a string containing a 28-character DiscID

getLastTrackNum(self)

Returns the number of the last track on this disc.
Returns:
an int containing the track number, or None

getSectors(self)

Returns the length of the disc in sectors.
Returns:
the length in sectors as an integer, or None

getTracks(self)

Returns the sector offset and length of this disc.

This method returns a list of tuples containing the track offset and length in sectors for all tracks on this disc. The track offset is measured from the beginning of the disc, the length is relative to the track's offset. Note that the leadout track is not included.
Returns:
a list of (offset, length) tuples (values are ints)

setFirstTrackNum(self, trackNum)

Sets the number of the first track on this disc.
Parameters:
trackNum - an int containing the track number, or None

setId(self, id_)

Sets the MusicBrainz DiscId.
Parameters:
id_ - a string containing a 28-character DiscID

setLastTrackNum(self, trackNum)

Sets the number of the last track on this disc.
Parameters:
trackNum - an int containing the track number, or None

setSectors(self, sectors)

Sets the length of the disc in sectors.
Parameters:
sectors - the length in sectors as an integer

Property Details

firstTrackNum

The number of the first track on this disc.
Get Method:
getFirstTrackNum(self)
Set Method:
setFirstTrackNum(self, trackNum)

id

The MusicBrainz DiscID.
Get Method:
getId(self)
Set Method:
setId(self, id_)

lastTrackNum

The number of the last track on this disc.
Get Method:
getLastTrackNum(self)
Set Method:
setLastTrackNum(self, trackNum)

sectors

The length of the disc in sectors.
Get Method:
getSectors(self)
Set Method:
setSectors(self, sectors)

tracks

Sector offset and length of all tracks.
Get Method:
getTracks(self)

Generated by Epydoc 2.1 on Sat Aug 26 18:34:31 2006 http://epydoc.sf.net