Documentation ¶
Overview ¶
Package musicbrainz provides fairly good support for the MusicBrainz API with focus on the TakeoutFM needs for media syncing and building search metadata.
Index ¶
- Constants
- Variables
- type Alias
- type Area
- type Artist
- type ArtistCredit
- type ArtistsPage
- type AttributeIds
- type CoverArtArchive
- type Genre
- type Label
- type LabelInfo
- type LifeSpan
- type Media
- type MusicBrainz
- func (m *MusicBrainz) ArtistDetail(arid string) (Artist, error)
- func (m *MusicBrainz) ArtistReleases(artist, arid string) ([]Release, error)
- func (m *MusicBrainz) CoverArtArchive(reid string, rgid string) (coverArt, error)
- func (m *MusicBrainz) Release(reid string) (Release, error)
- func (m *MusicBrainz) ReleaseGroup(rgid string) (ReleaseGroup, error)
- func (m *MusicBrainz) Releases(rgid string) ([]Release, error)
- func (m *MusicBrainz) SearchArtist(name string) (Artist, error)
- func (m *MusicBrainz) SearchArtistID(arid string) (Artist, error)
- func (m *MusicBrainz) SearchRecordings(query string) ([]Recording, error)
- func (m *MusicBrainz) SearchReleaseGroup(arid string, name string) (SearchResult, error)
- type Rating
- type Recording
- type RecordingPage
- type Relation
- type Release
- type ReleaseGroup
- type ReleasesPage
- type SearchResult
- type Series
- type Tag
- type Track
- type URL
- type Work
Constants ¶
const ( PrimaryTypeAlbum = "Album" PrimaryTypeSingle = "Single" PrimaryTypeEP = "EP" PrimaryTypeBroadcast = "Broadcast" PrimaryTypeOther = "Other" TypeCompilation = "Compilation" TypeSoundtrack = "Soundtrack" TypeSpokenword = "Spokenword" TypeInterview = "Interview" TypeAudiobook = "Audiobook" TypeAudioDrama = "Audio drama" TypeLive = "Live" TypeRemix = "Remix" TypeDJMix = "DJ-mix" TypeMixtapeStreet = "Mixtape/Street" TypeNone = "" )
Variables ¶
var ( ErrArtistNotFound = errors.New("artist not found") ErrTooManyArtists = errors.New("too many artists") )
Functions ¶
This section is empty.
Types ¶
type Artist ¶
type Artist struct { ID string `json:"id"` Score int `json:"score"` Name string `json:"name"` SortName string `json:"sort-name"` Country string `json:"country"` Disambiguation string `json:"disambiguation"` Type string `json:"type"` Genres []Genre `json:"genres"` Tags []Tag `json:"tags"` Area Area `json:"area"` BeginArea Area `json:"begin-area"` EndArea Area `json:"end-area"` LifeSpan LifeSpan `json:"life-span"` Relations []Relation `json:"relations"` Aliases []Alias `json:"aliases"` }
func (Artist) PrimaryGenre ¶
func (Artist) SortedGenres ¶
type ArtistCredit ¶
type ArtistsPage ¶
type AttributeIds ¶
type CoverArtArchive ¶
type LifeSpan ¶
type LifeSpan struct { Ended bool `json:"ended"` Begin string `json:"begin"` End string `json:"end"` }
TODO artist detail get detail for each artist - lifespan, url rel links, genres json api: https://musicbrainz.org/ws/2/artist/3798b104-01cb-484c-a3b0-56adc6399b80?inc=genres+url-rels&fmt=json
type MusicBrainz ¶
type MusicBrainz struct {
// contains filtered or unexported fields
}
func NewMusicBrainz ¶
func NewMusicBrainz(client client.Getter) *MusicBrainz
func (*MusicBrainz) ArtistDetail ¶
func (m *MusicBrainz) ArtistDetail(arid string) (Artist, error)
func (*MusicBrainz) ArtistReleases ¶
func (m *MusicBrainz) ArtistReleases(artist, arid string) ([]Release, error)
Get all releases for an artist from MusicBrainz.
func (*MusicBrainz) CoverArtArchive ¶
func (m *MusicBrainz) CoverArtArchive(reid string, rgid string) (coverArt, error)
func (*MusicBrainz) ReleaseGroup ¶
func (m *MusicBrainz) ReleaseGroup(rgid string) (ReleaseGroup, error)
func (*MusicBrainz) SearchArtist ¶
func (m *MusicBrainz) SearchArtist(name string) (Artist, error)
Search for artist by name using MusicBrainz.
func (*MusicBrainz) SearchArtistID ¶
func (m *MusicBrainz) SearchArtistID(arid string) (Artist, error)
Obtain artist details using MusicBrainz artist ID.
func (*MusicBrainz) SearchRecordings ¶ added in v0.19.0
func (m *MusicBrainz) SearchRecordings(query string) ([]Recording, error)
func (*MusicBrainz) SearchReleaseGroup ¶
func (m *MusicBrainz) SearchReleaseGroup(arid string, name string) (SearchResult, error)
type Recording ¶
type Recording struct { ID string `json:"id"` Length int `json:"length"` Title string `json:"title"` Relations []Relation `json:"relations"` ArtistCredit []ArtistCredit `json:"artist-credit"` FirstReleaseDate string `json:"first-release-date"` Releases []Release `json:"releases"` }
func (Recording) FirstReleaseTime ¶
type RecordingPage ¶ added in v0.19.0
type Relation ¶
type Relation struct { Type string `json:"type"` TargetType string `json:"target-type"` Artist Artist `json:"artist"` Attributes []string `json:"attributes"` AttributeIds AttributeIds `json:"attribute-ids"` Work Work `json:"work"` URL URL `json:"url"` Series Series `json:"series"` }
release-group series: type="part of", target-type="series", see series release recording series: type="part of", target-type="series", see series single: type="single from", target-type="release_group", see release_group
type Release ¶
type Release struct { ID string `json:"id"` Title string `json:"title"` Date string `json:"date"` Disambiguation string `json:"disambiguation"` Country string `json:"country"` Status string `json:"status"` Asin string `json:"asin"` Relations []Relation `json:"relations"` LabelInfo []LabelInfo `json:"label-info"` Media []Media `json:"media"` ReleaseGroup ReleaseGroup `json:"release-group"` CoverArtArchive CoverArtArchive `json:"cover-art-archive"` ArtistCredit []ArtistCredit `json:"artist-credit"` }
func (Release) FilteredMedia ¶ added in v0.19.2
func (Release) TotalDiscs ¶
func (Release) TotalTracks ¶
type ReleaseGroup ¶
type ReleaseGroup struct { ID string `json:"id"` Title string `json:"title"` Disambiguation string `json:"disambiguation"` PrimaryType string `json:"primary-type"` SecondaryTypes []string `json:"secondary-types"` Rating Rating `json:"rating"` FirstReleaseDate string `json:"first-release-date"` Tags []Tag `json:"tags"` Genres []Genre `json:"genres"` Releases []Release `json:"releases"` ArtistCredit []ArtistCredit `json:"artist-credit"` Relations []Relation `json:"relations"` }
func (ReleaseGroup) FirstReleaseTime ¶
func (rg ReleaseGroup) FirstReleaseTime() time.Time
func (ReleaseGroup) SecondaryType ¶
func (rg ReleaseGroup) SecondaryType() string
func (ReleaseGroup) SortedGenres ¶
func (rg ReleaseGroup) SortedGenres() []Genre
type ReleasesPage ¶
type SearchResult ¶
type SearchResult struct { Created string `json:"created"` Count int `json:"count"` Offset int `json:"offset"` ReleaseGroups []ReleaseGroup `json:"release-groups"` }
type Series ¶
type Series struct { ID string `json:"id"` Name string `json:"name"` Disambiguation string `json:"disambiguation"` Type string `json:"type"` }
type="Release group series" type="Recording series" (for recording in release)
type Track ¶
type Track struct { Title string `json:"title"` Position int `json:"position"` // Number string `json:"number"` -- position & number are the same ArtistCredit []ArtistCredit `json:"artist-credit"` Recording Recording `json:"recording"` }