Class: MusicBrainz::Model::Release

Inherits:
Entity
  • Object
show all
Includes:
Rateable, Relateable, Taggable
Defined in:
lib/rbrainz/model/release.rb

Overview

A release in the MusicBrainz DB.

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.

See

musicbrainz.org/doc/Release.

Note

The current MusicBrainz server implementation supports only a limited set of types. See wiki.musicbrainz.org/ReleaseAttribute for more information.

Constant Summary collapse

TYPE_NONE =

A type for not a type. Currently unsupported by MusicBrainz

NS_MMD_1 + 'None'
TYPE_ALBUM =

An album, perhaps better defined as a “Long Play” (LP) release, generally consists of previously unreleased material. This includes release re-issues, with or without bonus tracks.

NS_MMD_1 + 'Album'
TYPE_AUDIOBOOK =

An audiobook is a book read by a narrator without music.

NS_MMD_1 + 'Audiobook'
TYPE_COMPILATION =

A compilation is a collection of previously released tracks by one or more artists. Please note that this is a simplified description of a compilation.

NS_MMD_1 + 'Compilation'
TYPE_EP =

An EP is a so-called “Extended Play” release and often contains the letters EP in the title.

NS_MMD_1 + 'EP'
TYPE_INTERVIEW =

An interview release contains an interview, generally with an Artist.

NS_MMD_1 + 'Interview'
TYPE_LIVE =

A release that was recorded live.

NS_MMD_1 + 'Live'
TYPE_REMIX =

A release that primarily contains remixed material.

NS_MMD_1 + 'Remix'
TYPE_SINGLE =

A single typically has one main song and possibly a handful of additional tracks or remixes of the main track. A single is usually named after its main song.

NS_MMD_1 + 'Single'
TYPE_SOUNDTRACK =

A soundtrack is the musical score to a movie, TV series, stage show, computer game etc.

NS_MMD_1 + 'Soundtrack'
TYPE_SPOKENWORD =

Non-music spoken word releases.

NS_MMD_1 + 'Spokenword'
TYPE_OTHER =

Any release that does not fit or can’t decisively be placed in any of the categories above.

NS_MMD_1 + 'Other'
TYPE_OFFICIAL =

Any release officially sanctioned by the artist and/or their record company. (Most releases will fit into this category.)

NS_MMD_1 + 'Official'
TYPE_PROMOTION =

A giveaway release or a release intended to promote an upcoming official release. (e.g. prerelease albums or releases included with a magazine, versions supplied to radio DJs for air-play, etc).

NS_MMD_1 + 'Promotion'
TYPE_BOOTLEG =

An unofficial/underground release that was not sanctioned by the artist and/or the record company.

NS_MMD_1 + 'Bootleg'
TYPE_PSEUDO_RELEASE =

A pseudo-release is a duplicate release for translation/transliteration purposes.

NS_MMD_1 + 'PseudoRelease'
ENTITY_TYPE =

See Entity::ENTITY_TYPE.

:release

Instance Attribute Summary collapse

Attributes included from Rateable

#rating, #user_rating

Attributes inherited from Entity

#id

Instance Method Summary collapse

Methods included from Taggable

#tags, #user_tags

Methods included from Relateable

#add_relation, #get_relations, #relation_target_types

Methods inherited from Entity

entity_type, #entity_type

Constructor Details

#initialize(id = nil, title = nil) ⇒ Release

Returns a new instance of Release.



149
150
151
152
153
154
155
156
157
# File 'lib/rbrainz/model/release.rb', line 149

def initialize(id=nil, title=nil)
  super id
  self.title      = title
  @release_groups = Collection.new
  @tracks         = Collection.new
  @release_events = Collection.new
  @discs          = Collection.new
  @types          = Array.new
end

Instance Attribute Details

#artistObject

The main artist of this release.



99
100
101
# File 'lib/rbrainz/model/release.rb', line 99

def artist
  @artist
end

#asinObject

The amazon shop identifier.

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



96
97
98
# File 'lib/rbrainz/model/release.rb', line 96

def asin
  @asin
end

#discsObject (readonly)

The list of associated discs.

Note that under rare circumstances (identical TOCs), a Disc could be associated with more than one release.



141
142
143
# File 'lib/rbrainz/model/release.rb', line 141

def discs
  @discs
end

#release_eventsObject (readonly)

The list of release events.

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



135
136
137
# File 'lib/rbrainz/model/release.rb', line 135

def release_events
  @release_events
end

#release_groupObject

The release group this release is part of.



125
126
127
# File 'lib/rbrainz/model/release.rb', line 125

def release_group
  @release_group
end

#text_languageObject

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.

See

Utils#get_language_name



111
112
113
# File 'lib/rbrainz/model/release.rb', line 111

def text_language
  @text_language
end

#text_scriptObject

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.

See

Utils#get_script_name



122
123
124
# File 'lib/rbrainz/model/release.rb', line 122

def text_script
  @text_script
end

#titleObject

The title of this release.



90
91
92
# File 'lib/rbrainz/model/release.rb', line 90

def title
  @title
end

#tracksObject (readonly)

The list of tracks.



128
129
130
# File 'lib/rbrainz/model/release.rb', line 128

def tracks
  @tracks
end

#typesObject (readonly)

The list of types for this release.

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



147
148
149
# File 'lib/rbrainz/model/release.rb', line 147

def types
  @types
end

Instance Method Details

#earliest_release_dateObject

Returns the date of the earliest release event or nil.

See

earliest_release_event



196
197
198
199
# File 'lib/rbrainz/model/release.rb', line 196

def earliest_release_date
  event = earliest_release_event
  event ? event.date : nil
end

#earliest_release_eventObject

Returns the earliest release date as an IncompleteDate.

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, nil is returned.

See

earliest_release_date



182
183
184
185
186
187
188
189
190
191
# File 'lib/rbrainz/model/release.rb', line 182

def earliest_release_event
  earliest_event = nil
  release_events.each do |event|
    if earliest_event.nil? or (event.date and
      (event.date <= earliest_event.date or event.date.between?(earliest_event.date)))
      earliest_event = event
    end
  end
  return earliest_event
end

#single_artist_release?Boolean

Checks if this is a single artist’s release.

Returns true if the release’s main artist (#artist) 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 #artist=) for this. The track artists may be unset.

Raises

RuntimeError

Returns:

  • (Boolean)


170
171
172
173
# File 'lib/rbrainz/model/release.rb', line 170

def single_artist_release?
    raise 'Release Artist may not be None!' unless artist
    tracks.all? {|track| !track.artist || track.artist.id == artist.id }
end

#to_sObject

Returns the string representation for this release.

Returns #title converted into a string.



204
205
206
# File 'lib/rbrainz/model/release.rb', line 204

def to_s
  title.to_s
end