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

Type Track

object --+    
         |    
    Entity --+
             |
            Track


Represents a track.

This class represents a track which may appear on one or more releases. A track may be associated with exactly one artist (the main artist).

Using getReleases, you can find out on which releases this track appears. To get the track number, too, use the Release.getTracksOffset method.

Note: Currently, the MusicBrainz server doesn't support tracks to be on more than one release.

See Also: Release, Artist

Method Summary
  __init__(self, id_, title)
Constructor.
  addPuid(self, puid)
Add a PUID to this track.
  addRelease(self, release)
Add a release on which this track appears.
  getArtist(self)
Returns the main artist of this track.
  getDuration(self)
Returns the duration of this track in milliseconds.
  getDurationSplit(self)
Returns the duration as a (minutes, seconds) tuple.
  getPuids(self)
Returns the PUIDs associated with this track.
  getReleases(self)
Returns the list of releases this track appears on.
  getTitle(self)
Returns the track's title.
  setArtist(self, artist)
Sets this track's main artist.
  setDuration(self, duration)
Sets the duration of this track in milliseconds.
  setTitle(self, title)
Sets the track's title.
    Inherited from Entity
  addRelation(self, relation)
Adds a relation.
  getId(self)
Returns a MusicBrainz ID.
  getRelations(self, targetType, relationType)
Returns a list of relations.
  getRelationTargetTypes(self)
Returns a list of target types available for this entity.
  setId(self, value)
Sets a MusicBrainz ID.
    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
  artist: The track's main artist.
  duration: The duration in milliseconds.
  puids: The list of associated PUIDs.
  releases: The releases on which this track appears.
  title: The track's title.
    Inherited from Entity
  id: The MusicBrainz ID.

Method Details

__init__(self, id_=None, title=None)
(Constructor)

Constructor.
Parameters:
id_ - a string containing an absolute URI
title - a string containing the title
Overrides:
musicbrainz2.model.Entity.__init__

addPuid(self, puid)

Add a PUID to this track.
Parameters:
puid - a string containing a PUID

addRelease(self, release)

Add a release on which this track appears.
Parameters:
release - a Release object

getArtist(self)

Returns the main artist of this track.
Returns:
an Artist object, or None

getDuration(self)

Returns the duration of this track in milliseconds.
Returns:
an int containing the duration in milliseconds, or None

getDurationSplit(self)

Returns the duration as a (minutes, seconds) tuple.

If no duration is set, (0, 0) is returned. Seconds are rounded towards the ceiling if at least 500 milliseconds are left.
Returns:
a (minutes, seconds) tuple, both entries being ints

getPuids(self)

Returns the PUIDs associated with this track.

Please note that a PUID may be associated with more than one track.
Returns:
a list of strings, each containing one PUID

getReleases(self)

Returns the list of releases this track appears on.
Returns:
a list of Release objects

getTitle(self)

Returns the track's title.

The style and format of this attribute is specified by the style guide.
Returns:
a string containing the title, or None

See Also: The MusicBrainz Style Guidelines

setArtist(self, artist)

Sets this track's main artist.
Parameters:
artist - an Artist object

setDuration(self, duration)

Sets the duration of this track in milliseconds.
Parameters:
duration - an int containing the duration in milliseconds

setTitle(self, title)

Sets the track's title.
Parameters:
title - a string containing the title

See Also: getTitle


Property Details

artist

The track's main artist.
Get Method:
getArtist(self)
Set Method:
setArtist(self, artist)

duration

The duration in milliseconds.
Get Method:
getDuration(self)
Set Method:
setDuration(self, duration)

puids

The list of associated PUIDs.
Get Method:
getPuids(self)

releases

The releases on which this track appears.
Get Method:
getReleases(self)

title

The track's title.
Get Method:
getTitle(self)
Set Method:
setTitle(self, title)

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