musicbrainz

package
v0.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

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

View Source
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

This section is empty.

Functions

This section is empty.

Types

type Area

type Area struct {
	Name     string `json:"name"`
	SortName string `json:"sort-name"`
}

TODO artist detail

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"`
}

func (Artist) PrimaryGenre

func (a Artist) PrimaryGenre() string

func (Artist) SortedGenres

func (a Artist) SortedGenres() []Genre

type ArtistCredit

type ArtistCredit struct {
	Name   string `json:"name"`
	Join   string `json:"joinphrase"`
	Artist Artist `json:"artist"`
}

type ArtistsPage

type ArtistsPage struct {
	Artists []Artist `json:"artists"`
	Offset  int      `json:"offset"`
	Count   int      `json:"count"`
}

type AttributeIds

type AttributeIds struct {
	Cover string `json:"cover"` // 1e8536bd-6eda-3822-8e78-1c0f4d3d2113
	Live  string `json:"live"`  // 70007db6-a8bc-46d7-a770-80e6a0bb551a
}

type CoverArtArchive

type CoverArtArchive struct {
	Count    int  `json:"count"`
	Artwork  bool `json:"artwork"`
	Front    bool `json:"front"`
	Back     bool `json:"back"`
	Darkened bool `json:"darkened"`
}

type Genre

type Genre struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type Label

type Label struct {
	Name     string `json:"name"`
	SortName string `json:"sort-name"`
}

type LabelInfo

type LabelInfo struct {
	Label         Label  `json:"label"`
	CatalogNumber string `json:"catalog-number"`
}

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: http://musicbrainz.org/ws/2/artist/3798b104-01cb-484c-a3b0-56adc6399b80?inc=genres+url-rels&fmt=json

type Media

type Media struct {
	Title      string  `json:"title"`
	Format     string  `json:"format"`
	Position   int     `json:"position"`
	TrackCount int     `json:"track-count"`
	Tracks     []Track `json:"tracks"`
}

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) Release

func (m *MusicBrainz) Release(reid string) (*Release, error)

func (*MusicBrainz) ReleaseGroup

func (m *MusicBrainz) ReleaseGroup(rgid string) (*ReleaseGroup, error)

func (*MusicBrainz) Releases

func (m *MusicBrainz) Releases(rgid string) ([]Release, error)

func (*MusicBrainz) SearchArtist

func (m *MusicBrainz) SearchArtist(name string) *Artist

Search for artist by name using MusicBrainz.

func (*MusicBrainz) SearchArtistID

func (m *MusicBrainz) SearchArtistID(arid string) *Artist

Obtain artist details using MusicBrainz artist ID.

func (*MusicBrainz) SearchReleaseGroup

func (m *MusicBrainz) SearchReleaseGroup(arid string, name string) (*SearchResult, error)

type Rating

type Rating struct {
	Votes int     `json:"votes-count"`
	Value float32 `json:"value"`
}

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"`
}

func (Recording) FirstReleaseTime

func (r Recording) FirstReleaseTime() time.Time

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) TotalDiscs

func (r Release) TotalDiscs() int

func (Release) TotalTracks

func (r Release) TotalTracks() int

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 ReleasesPage struct {
	Releases []Release `json:"releases"`
	Offset   int       `json:"release-offset"`
	Count    int       `json:"release-count"`
}

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 Tag

type Tag struct {
	Name  string `json:"name"`
	Count int    `json:"count"`
}

type Track

type Track struct {
	Title        string         `json:"title"`
	Position     int            `json:"position"`
	ArtistCredit []ArtistCredit `json:"artist-credit"`
	Recording    Recording      `json:"recording"`
}

func (Track) Artist

func (t Track) Artist() string

A feat. B

type URL

type URL struct {
	ID       string `json:"id"`
	Resource string `json:"resource"`
}

TODO artist detail

type Work

type Work struct {
	ID             string     `json:"id"`
	Title          string     `json:"title"`
	Disambiguation string     `json:"disambiguation"`
	Language       string     `json:"language"`
	Type           string     `json:"type"`
	Relations      []Relation `json:"relations"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL