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

Class Release

source code

object --+    
         |    
    Entity --+
             |
            Release

Represents a Release.

A release within MusicBrainz is an Entity which contains Track objects. Releases may be of more than one type: There can be albums, singles, compilations, live recordings, official releases, bootlegs etc.


Note: The current MusicBrainz server implementation supports only a limited set of types.

Instance Methods
 
__init__(self, id_=None, title=None)
Constructor.
source code
 
getTypes(self)
Returns the types of this release.
source code
 
addType(self, type_)
Add a type to the list of types.
source code
 
getTitle(self)
Returns the release's title.
source code
 
setTitle(self, title)
Sets the release's title.
source code
 
getTextLanguage(self)
Returns the language used in release and track titles.
source code
 
setTextLanguage(self, language)
Sets the language used in releaes and track titles.
source code
 
getTextScript(self)
Returns the script used in release and track titles.
source code
 
setTextScript(self, script)
Sets the script used in releaes and track titles.
source code
 
getAsin(self)
Returns the amazon shop identifier (ASIN).
source code
 
setAsin(self, asin)
Sets the amazon shop identifier (ASIN).
source code
 
getArtist(self)
Returns the main artist of this release.
source code
 
setArtist(self, artist)
Sets this release's main artist.
source code
 
isSingleArtistRelease(self)
Checks if this is a single artist's release.
source code
 
getTracks(self)
Returns the tracks this release contains.
source code
 
addTrack(self, track)
Adds a track to this release.
source code
 
getTracksOffset(self)
Returns the offset of the track list.
source code
 
setTracksOffset(self, offset)
Sets the offset of the track list.
source code
 
getTracksCount(self)
Returns the number of tracks on this release.
source code
 
setTracksCount(self, value)
Sets the number of tracks on this release.
source code
 
getReleaseEvents(self)
Returns the list of release events.
source code
 
addReleaseEvent(self, event)
Adds a release event to this release.
source code
 
getReleaseEventsAsDict(self)
Returns the release events represented as a dict.
source code
 
getEarliestReleaseDate(self)
Returns the earliest release date.
source code
 
getEarliestReleaseEvent(self)
Returns the earliest release event.
source code
 
getDiscs(self)
Returns the discs associated with this release.
source code
 
addDisc(self, disc)
Adds a disc to this release.
source code

Inherited from Entity: addRelation, addTag, getId, getRelationTargetTypes, getRelationTargets, getRelations, getTag, getTags, setId

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables
  TYPE_NONE = 'http://musicbrainz.org/ns/mmd-1.0#None'
  TYPE_ALBUM = 'http://musicbrainz.org/ns/mmd-1.0#Album'
  TYPE_SINGLE = 'http://musicbrainz.org/ns/mmd-1.0#Single'
  TYPE_EP = 'http://musicbrainz.org/ns/mmd-1.0#EP'
  TYPE_COMPILATION = 'http://musicbrainz.org/ns/mmd-1.0#Compilat...
  TYPE_SOUNDTRACK = 'http://musicbrainz.org/ns/mmd-1.0#Soundtrack'
  TYPE_SPOKENWORD = 'http://musicbrainz.org/ns/mmd-1.0#Spokenword'
  TYPE_INTERVIEW = 'http://musicbrainz.org/ns/mmd-1.0#Interview'
  TYPE_AUDIOBOOK = 'http://musicbrainz.org/ns/mmd-1.0#Audiobook'
  TYPE_LIVE = 'http://musicbrainz.org/ns/mmd-1.0#Live'
  TYPE_REMIX = 'http://musicbrainz.org/ns/mmd-1.0#Remix'
  TYPE_OTHER = 'http://musicbrainz.org/ns/mmd-1.0#Other'
  TYPE_OFFICIAL = 'http://musicbrainz.org/ns/mmd-1.0#Official'
  TYPE_PROMOTION = 'http://musicbrainz.org/ns/mmd-1.0#Promotion'
  TYPE_BOOTLEG = 'http://musicbrainz.org/ns/mmd-1.0#Bootleg'
  TYPE_PSEUDO_RELEASE = 'http://musicbrainz.org/ns/mmd-1.0#Pseud...
Properties
  types
The list of types for this release.
  title
The title of this release.
  textLanguage
The language used in release and track titles.
  textScript
The script used in release and track titles.
  asin
The amazon shop identifier.
  artist
The main artist of this release.
  tracks
The list of tracks.
  tracksOffset
The offset of the track list.
  tracksCount
The total number of releases
  releaseEvents
The list of release events.
  discs
The list of associated discs.

Inherited from Entity: id, tags

Inherited from object: __class__

Method Details

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

source code 

Constructor.

Parameters:
  • id_ - a string containing an absolute URI
  • title - a string containing the title
Overrides: object.__init__

getTypes(self)

source code 

Returns the types of this release.

To test for release types, you can use the constants TYPE_ALBUM, TYPE_SINGLE, etc.

Returns:
a list of strings containing absolute URIs

addType(self, type_)

source code 

Add a type to the list of types.

Parameters:
  • type_ - a string containing absolute URIs

See Also: getTypes

getTitle(self)

source code 

Returns the release's title.

Returns:
a string containing the release's title

setTitle(self, title)

source code 

Sets the release's title.

Parameters:
  • title - a string containing the release's title, or None

getTextLanguage(self)

source code 

Returns the language used in release and track titles.

To represent the language, the ISO-639-2/T standard is used, which provides three-letter terminological language codes like 'ENG', 'DEU', 'JPN', 'KOR', 'ZHO' or 'YID'.

Note that this refers to release and track titles, not lyrics.

Returns:
a string containing the language code, or None

setTextLanguage(self, language)

source code 

Sets the language used in releaes and track titles.

Parameters:
  • language - a string containing a language code

See Also: getTextLanguage

getTextScript(self)

source code 

Returns the script used in release and track titles.

To represent the script, ISO-15924 script codes are used. Valid codes are, among others: 'Latn', 'Cyrl', 'Hans', 'Hebr'

Note that this refers to release and track titles, not lyrics.

Returns:
a string containing the script code, or None

setTextScript(self, script)

source code 

Sets the script used in releaes and track titles.

Parameters:
  • script - a string containing a script code

See Also: getTextScript

getAsin(self)

source code 

Returns the amazon shop identifier (ASIN).

The ASIN is a 10-letter code (except for books) assigned by Amazon, which looks like 'B000002IT2' or 'B00006I4YD'.

Returns:
a string containing the ASIN, or None

setAsin(self, asin)

source code 

Sets the amazon shop identifier (ASIN).

Parameters:
  • asin - a string containing the ASIN

See Also: getAsin

getArtist(self)

source code 

Returns the main artist of this release.

Returns:
an Artist object, or None

setArtist(self, artist)

source code 

Sets this release's main artist.

Parameters:

isSingleArtistRelease(self)

source code 

Checks if this is a single artist's release.

Returns True if the release's main artist (getArtist) is also the main artist for all of the tracks. This is checked by comparing the artist IDs.

Note that the release's artist has to be set (see setArtist) for this. The track artists may be unset.

Returns:
True, if this is a single artist's release

getTracks(self)

source code 

Returns the tracks this release contains.

Returns:
a list containing Track objects

addTrack(self, track)

source code 

Adds a track to this release.

This appends a track at the end of this release's track list.

Parameters:

getTracksOffset(self)

source code 

Returns the offset of the track list.

This is used if the track list is incomplete (ie. the web service only returned part of the tracks on this release). Note that the offset value is zero-based, which means track 0 is the first track.

Returns:
an integer containing the offset, or None

setTracksOffset(self, offset)

source code 

Sets the offset of the track list.

Parameters:
  • offset - an integer containing the offset, or None

getTracksCount(self)

source code 

Returns the number of tracks on this release.

This may or may not match with the number of elements that getTracks returns. If the count is higher than the list, it indicates that the list is incomplete.

Returns:
an integer containing the count, or None

setTracksCount(self, value)

source code 

Sets the number of tracks on this release.

Parameters:
  • value - an integer containing the count, or None

getReleaseEvents(self)

source code 

Returns the list of release events.

A Release may contain a list of so-called release events, each represented using a ReleaseEvent object. Release evens specify where and when this release was, well, released.

Returns:
a list of ReleaseEvent objects

addReleaseEvent(self, event)

source code 

Adds a release event to this release.

Parameters:

See Also: getReleaseEvents

getReleaseEventsAsDict(self)

source code 

Returns the release events represented as a dict.

Keys are ISO-3166 country codes like 'DE', 'UK', 'FR' etc. Values are dates in 'YYYY', 'YYYY-MM' or 'YYYY-MM-DD' format.

Returns:
a dict containing (countryCode, date) entries

getEarliestReleaseDate(self)

source code 

Returns the earliest release date.

This favours complete dates. For example, '2006-09' is returned if there is '2000', too. If there is no release event associated with this release, None is returned.

Returns:
a string containing the date, or None

getEarliestReleaseEvent(self)

source code 

Returns the earliest release event.

This works like getEarliestReleaseDate, but instead of just the date, this returns a ReleaseEvent object.

Returns:
a ReleaseEvent object, or None

getDiscs(self)

source code 

Returns the discs associated with this release.

Discs are currently containers for MusicBrainz DiscIDs. Note that under rare circumstances (identical TOCs), a DiscID could be associated with more than one release.

Returns:
a list of Disc objects

addDisc(self, disc)

source code 

Adds a disc to this release.

Parameters:
  • disc - a Disc object

Class Variable Details

TYPE_COMPILATION

Value:
'http://musicbrainz.org/ns/mmd-1.0#Compilation'

TYPE_PSEUDO_RELEASE

Value:
'http://musicbrainz.org/ns/mmd-1.0#Pseudo-Release'

Property Details

types

The list of types for this release.

Get Method:
getTypes(self) - Returns the types of this release.

title

The title of this release.

Get Method:
getTitle(self) - Returns the release's title.
Set Method:
setTitle(self, title) - Sets the release's title.

textLanguage

The language used in release and track titles.

Get Method:
getTextLanguage(self) - Returns the language used in release and track titles.
Set Method:
setTextLanguage(self, language) - Sets the language used in releaes and track titles.

textScript

The script used in release and track titles.

Get Method:
getTextScript(self) - Returns the script used in release and track titles.
Set Method:
setTextScript(self, script) - Sets the script used in releaes and track titles.

asin

The amazon shop identifier.

Get Method:
getAsin(self) - Returns the amazon shop identifier (ASIN).
Set Method:
setAsin(self, asin) - Sets the amazon shop identifier (ASIN).

artist

The main artist of this release.

Get Method:
getArtist(self) - Returns the main artist of this release.
Set Method:
setArtist(self, artist) - Sets this release's main artist.

tracks

The list of tracks.

Get Method:
getTracks(self) - Returns the tracks this release contains.

tracksOffset

The offset of the track list.

Get Method:
getTracksOffset(self) - Returns the offset of the track list.
Set Method:
setTracksOffset(self, offset) - Sets the offset of the track list.

tracksCount

The total number of releases

Get Method:
getTracksCount(self) - Returns the number of tracks on this release.
Set Method:
setTracksCount(self, value) - Sets the number of tracks on this release.

releaseEvents

The list of release events.

Get Method:
getReleaseEvents(self) - Returns the list of release events.

discs

The list of associated discs.

Get Method:
getDiscs(self) - Returns the discs associated with this release.