musicbrainzws2

package module
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 9 Imported by: 2

README

Go MusicBrainz Web Service 2

PkgGoDev builds.sr.ht status

About

Go package to access the MusicBrainz API.

Documentation

See the API documentation for details.

Contribute

The source code for go-musicbrainzws2 is available on SourceHut.

Please report any issues on the issue tracker.

Patches can be submitted to the mailing list. You can clone the repository directly on SourceHut and submit your changes with the "Prepare patchset" button. Please see SourceHut's documentation for sending patches upstream for details.

License

go-musicbrainzws2 Copyright © 2024 Philipp Wolfer phw@uploadedlobster.com

Licensed under the conditions of the MIT license.

See COPYING for details.

Documentation

Overview

The musicbrainzws2 package allows accessing the MusicBrainz web service.

The package supports all MusicBrainz entities. The MusicBrainz web service provides three general types of requests: lookup, browse and search. All of them are supported.

All API functions are available by creating a Client using NewClient. Please note that this package currently is still a beta and the API may still change.

The Client supports lookup, browse and search queries for all entities. Submission of ISRCs, barcodes, folksonomy tags/genres and ratings is also supported, as is managing the contents of user collections.

The deprecated CD stubs are not supported and there are no plans to support them.

For a full documentation of the web service see https://musicbrainz.org/doc/MusicBrainz_API and the documentation of the search service at https://musicbrainz.org/doc/MusicBrainz_API/Search.

Index

Examples

Constants

View Source
const (
	UpvoteTag   = TagVote("upvote")
	DownvoteTag = TagVote("downvote")
	WithdrawTag = TagVote("withdraw")
)
View Source
const (
	// The default request limit of returned entities.
	DefaultLimit = 25

	// The maximum number of entities to return in a single request.
	MaxLimit = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alias

type Alias struct {
	Type      string      `json:"type"`
	TypeID    MBID        `json:"type-id"`
	Name      string      `json:"name"`
	SortName  string      `json:"sort-name"`
	Locale    string      `json:"locale"`
	BeginDate PartialDate `json:"begin-date"`
	EndDate   PartialDate `json:"end-date"`
	IsPrimary bool        `json:"primary"`
}

Aliases are alternative names for all types of MusicBrainz entities.

See https://musicbrainz.org/doc/Aliases

type Annotation added in v0.6.0

type Annotation struct {
	Type   string `json:"type"`
	Score  int    `json:"score"`
	Entity MBID   `json:"entity"`
	Name   string `json:"name"`
	Text   string `json:"text"`
}

Annotations are text fields, functioning like a miniature wiki, that can be added to any existing artists, labels, recordings, releases, release groups and works.

See https://musicbrainz.org/doc/Annotation

type Area

type Area struct {
	ID             MBID           `json:"id"`
	Score          int            `json:"score"`
	Name           string         `json:"name"`
	SortName       string         `json:"sort-name"`
	Disambiguation string         `json:"disambiguation"`
	Type           string         `json:"type"`
	TypeID         MBID           `json:"type-id"`
	Annotation     string         `json:"annotation"`
	Aliases        []Alias        `json:"aliases"`
	LifeSpan       LifeSpan       `json:"life-span"`
	Relations      RelationList   `json:"relations"`
	Rating         Rating         `json:"rating"`
	UserRating     Rating         `json:"user-rating"`
	Tags           []Tag          `json:"tags"`
	UserTags       []Tag          `json:"user-tags"`
	Genres         []Genre        `json:"genres"`
	UserGenres     []Genre        `json:"user-genres"`
	ISO31661Codes  []ISO31661Code `json:"iso-3166-1-codes"`
	ISO31662Codes  []ISO31662Code `json:"iso-3166-2-codes"`
}

Areas are geographic regions or settlements.

See https://musicbrainz.org/doc/Area

type AreaCollection

type AreaCollection struct {
	Collection
	Count int    `json:"area-count"`
	Areas []Area `json:"areas"`
}

type AreaFilter

type AreaFilter struct {
	CollectionMBID MBID
	Includes       []string
}

func (AreaFilter) SetQuery

func (f AreaFilter) SetQuery(r *resty.Request)

type Artist

type Artist struct {
	ID             MBID           `json:"id"`
	Score          int            `json:"score"`
	Name           string         `json:"name"`
	SortName       string         `json:"sort-name"`
	Disambiguation string         `json:"disambiguation"`
	Type           string         `json:"type"`
	TypeID         MBID           `json:"type-id"`
	Annotation     string         `json:"annotation"`
	Aliases        []Alias        `json:"aliases"`
	LifeSpan       LifeSpan       `json:"life-span"`
	Relations      RelationList   `json:"relations"`
	Gender         string         `json:"gender"`
	GenderID       MBID           `json:"gender-id"`
	CountryCode    ISO31661Code   `json:"country"`
	Area           *Area          `json:"area,omitempty"`
	BeginArea      *Area          `json:"begin-area,omitempty"`
	EndArea        *Area          `json:"end-area,omitempty"`
	ISNIs          []string       `json:"isnis"`
	IPIs           []string       `json:"ipis"`
	Rating         Rating         `json:"rating"`
	UserRating     Rating         `json:"user-rating"`
	Tags           []Tag          `json:"tags"`
	UserTags       []Tag          `json:"user-tags"`
	Genres         []Genre        `json:"genres"`
	UserGenres     []Genre        `json:"user-genres"`
	Recordings     []Recording    `json:"recordings"`
	Releases       []Release      `json:"releases"`
	ReleaseGroups  []ReleaseGroup `json:"release-groups"`
	Works          []Work         `json:"works"`
}

An artist is generally a musician (or musician persona), group of musicians, or other music professional (like a producer or engineer).

Occasionally, it can also be a non-musical person (like a photographer, an illustrator, or a poet whose writings are set to music), or even a fictional character.

See https://musicbrainz.org/doc/Artist

type ArtistCollection

type ArtistCollection struct {
	Collection
	Count   int      `json:"artist-count"`
	Artists []Artist `json:"artists"`
}

type ArtistCredit

type ArtistCredit []ArtistCreditEntry

Artist credits indicate who is the main credited artist (or artists) for releases, release groups, tracks and recordings, and how they are credited.

They consist of artists, with (optionally) their names as credited in the specific release, track, etc., and join phrases between them.

See https://musicbrainz.org/doc/Artist_Credits

func (ArtistCredit) String

func (c ArtistCredit) String() string
Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	artistCredit := musicbrainzws2.ArtistCredit{
		musicbrainzws2.ArtistCreditEntry{
			Name:       "Liv Kristine",
			JoinPhrase: " feat. ",
		},
		musicbrainzws2.ArtistCreditEntry{
			Name:       "Nick Holmes",
			JoinPhrase: " / ",
		},
		musicbrainzws2.ArtistCreditEntry{
			Name:       "Paradise Lost",
			JoinPhrase: "",
		},
	}

	fmt.Println(artistCredit.String())
}
Output:

Liv Kristine feat. Nick Holmes / Paradise Lost

type ArtistCreditEntry

type ArtistCreditEntry struct {
	Name       string `json:"name"`
	JoinPhrase string `json:"joinphrase"`
	Artist     Artist `json:"artist"`
}

type ArtistFilter

type ArtistFilter struct {
	AreaMBID         MBID
	CollectionMBID   MBID
	RecordingMBID    MBID
	ReleaseMBID      MBID
	ReleaseGroupMBID MBID
	WorkMBID         MBID
	Includes         []string
}

func (ArtistFilter) SetQuery

func (f ArtistFilter) SetQuery(r *resty.Request)

type Barcode added in v0.6.0

type Barcode string

The textual representation of a scanned barcode.

On MusicBrainz it is recommended that the barcode is a valid UPC or EAN number. But this is not mandatory and the barcode can be any string.

See https://musicbrainz.org/doc/Barcode

func (Barcode) IsEAN13 added in v0.6.0

func (b Barcode) IsEAN13() bool

Returns true, if the barcode is a valid International Article Number (EAN) in EAN-13 format.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	mbid := musicbrainzws2.Barcode("5016583115227")
	if mbid.IsEAN13() {
		fmt.Printf("%s is a valid EAN-13\n", mbid)
	}
}
Output:

5016583115227 is a valid EAN-13

func (Barcode) IsUPC added in v0.6.0

func (b Barcode) IsUPC() bool

Returns true, if the barcode is a valid Universal Product Code (UPC).

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	mbid := musicbrainzws2.Barcode("075992735223")
	if mbid.IsUPC() {
		fmt.Printf("%s is a valid UPC\n", mbid)
	}
}
Output:

075992735223 is a valid UPC

type BrowseAreasResult added in v0.8.0

type BrowseAreasResult struct {
	Count  int    `json:"area-count"`
	Offset int    `json:"area-offset"`
	Areas  []Area `json:"areas"`
}

type BrowseArtistsResult added in v0.8.0

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

type BrowseCollectionsResult added in v0.8.0

type BrowseCollectionsResult struct {
	Count       int          `json:"collection-count"`
	Offset      int          `json:"collection-offset"`
	Collections []Collection `json:"collections"`
}

type BrowseEventsResult added in v0.8.0

type BrowseEventsResult struct {
	Count  int     `json:"event-count"`
	Offset int     `json:"event-offset"`
	Events []Event `json:"events"`
}

type BrowseInstrumentsResult added in v0.8.0

type BrowseInstrumentsResult struct {
	Count       int          `json:"instrument-count"`
	Offset      int          `json:"instrument-offset"`
	Instruments []Instrument `json:"instruments"`
}

type BrowseLabelsResult added in v0.8.0

type BrowseLabelsResult struct {
	Count  int     `json:"label-count"`
	Offset int     `json:"label-offset"`
	Labels []Label `json:"labels"`
}

type BrowsePlacesResult added in v0.8.0

type BrowsePlacesResult struct {
	Count  int     `json:"place-count"`
	Offset int     `json:"place-offset"`
	Places []Place `json:"places"`
}

type BrowseRecordingsResult added in v0.8.0

type BrowseRecordingsResult struct {
	Count      int         `json:"recording-count"`
	Offset     int         `json:"recording-offset"`
	Recordings []Recording `json:"recordings"`
}

type BrowseReleaseGroupsResult added in v0.8.0

type BrowseReleaseGroupsResult struct {
	Count         int            `json:"release-group-count"`
	Offset        int            `json:"release-group-offset"`
	ReleaseGroups []ReleaseGroup `json:"release-groups"`
}

type BrowseReleasesResult added in v0.8.0

type BrowseReleasesResult struct {
	Count    int       `json:"release-count"`
	Offset   int       `json:"release-offset"`
	Releases []Release `json:"releases"`
}

type BrowseSeriesResult added in v0.8.0

type BrowseSeriesResult struct {
	Count  int      `json:"series-count"`
	Offset int      `json:"series-offset"`
	Series []Series `json:"series"`
}

type BrowseWorksResult added in v0.8.0

type BrowseWorksResult struct {
	Count  int    `json:"work-count"`
	Offset int    `json:"work-offset"`
	Works  []Work `json:"works"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

A client to access the MusicBrainz web service version 2.

Use NewClient to initialize a new instance.

func NewClient

func NewClient(appName, appVersion string) *Client

Returns a new Client.

The appName and appVersion will be used to construct the default user agent string and the client parameter required for data submission.

func (*Client) BaseURL

func (c *Client) BaseURL() string

Returns the set base URL.

func (*Client) BrowseAreaCollection added in v0.9.0

func (c *Client) BrowseAreaCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (AreaCollection, error)

Browse the areas in an AreaCollection.

func (*Client) BrowseAreas

func (c *Client) BrowseAreas(filter AreaFilter, paginator Paginator) (BrowseAreasResult, error)

Browse the areas related to another entity.

func (*Client) BrowseArtistCollection added in v0.9.0

func (c *Client) BrowseArtistCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (ArtistCollection, error)

Browse the artists in an ArtistCollection.

func (*Client) BrowseArtists

func (c *Client) BrowseArtists(filter ArtistFilter, paginator Paginator) (BrowseArtistsResult, error)

Browse the artists related to another entity.

func (*Client) BrowseCollections

func (c *Client) BrowseCollections(filter CollectionFilter, paginator Paginator) (BrowseCollectionsResult, error)

Browse the collections related to another entity.

Calling this without any filter set requires an authenticated user and will return all collections of this user.

When applying an entity filter, e.g. to query all collections containing a certain release ID, the result by default will list only public collections. To also get private collections of the authenticated user add "user-collections" to the Includes list of the CollectionFilter.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	// Query all public collections containing the release with the below release
	// MBID. The result will contain only collections with EntityType "release".
	filter := musicbrainzws2.CollectionFilter{
		ReleaseMBID: musicbrainzws2.MBID("e62d6ccd-25cc-3763-8055-1ab02fa81ed1"),
	}
	paginator := musicbrainzws2.DefaultPaginator()
	if result, err := client.BrowseCollections(filter, paginator); err != nil {
		// Print the names and types of all found collections
		for _, collection := range result.Collections {
			fmt.Printf("%s (%s)", collection.Name, collection.Type)
		}
	}
}
Output:

func (*Client) BrowseEventCollection added in v0.9.0

func (c *Client) BrowseEventCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (EventCollection, error)

Browse the events in an EventCollection.

func (*Client) BrowseEvents

func (c *Client) BrowseEvents(filter EventFilter, paginator Paginator) (BrowseEventsResult, error)

Browse the events related to another entity.

func (*Client) BrowseGenreCollection added in v0.9.0

func (c *Client) BrowseGenreCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (GenreCollection, error)

Browse the genres in a GenreCollection.

func (*Client) BrowseInstrumentCollection added in v0.9.0

func (c *Client) BrowseInstrumentCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (InstrumentCollection, error)

Browse the instruments in an InstrumentCollection.

func (*Client) BrowseInstruments

func (c *Client) BrowseInstruments(filter InstrumentFilter, paginator Paginator) (BrowseInstrumentsResult, error)

Browse the instruments related to another entity.

func (*Client) BrowseLabelCollection added in v0.9.0

func (c *Client) BrowseLabelCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (LabelCollection, error)

Browse the labels in a LabelCollection.

func (*Client) BrowseLabels

func (c *Client) BrowseLabels(filter LabelFilter, paginator Paginator) (BrowseLabelsResult, error)

Browse the labels related to another entity.

func (*Client) BrowsePlaceCollection added in v0.9.0

func (c *Client) BrowsePlaceCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (PlaceCollection, error)

Browse the places in a PlaceCollection.

func (*Client) BrowsePlaces

func (c *Client) BrowsePlaces(filter PlaceFilter, paginator Paginator) (BrowsePlacesResult, error)

Browse the places related to another entity.

func (*Client) BrowseRecordingCollection added in v0.9.0

func (c *Client) BrowseRecordingCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (RecordingCollection, error)

Browse the recordings in a RecordingCollection.

func (*Client) BrowseRecordings

func (c *Client) BrowseRecordings(filter RecordingFilter, paginator Paginator) (BrowseRecordingsResult, error)

Browse the recordings related to another entity.

func (*Client) BrowseReleaseCollection added in v0.9.0

func (c *Client) BrowseReleaseCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (ReleaseCollection, error)

Browse the releases in a ReleaseCollection.

func (*Client) BrowseReleaseGroupCollection added in v0.9.0

func (c *Client) BrowseReleaseGroupCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (ReleaseGroupCollection, error)

Browse the release groups in a ReleaseGroupCollection.

func (*Client) BrowseReleaseGroups

func (c *Client) BrowseReleaseGroups(filter ReleaseGroupFilter, paginator Paginator) (BrowseReleaseGroupsResult, error)

Browse the release groups related to another entity.

func (*Client) BrowseReleases

func (c *Client) BrowseReleases(filter ReleaseFilter, paginator Paginator) (BrowseReleasesResult, error)

Browse the releases related to another entity.

func (*Client) BrowseSeries

func (c *Client) BrowseSeries(filter SeriesFilter, paginator Paginator) (BrowseSeriesResult, error)

Browse the series related to another entity.

func (*Client) BrowseSeriesCollection added in v0.9.0

func (c *Client) BrowseSeriesCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (SeriesCollection, error)

Browse the series in a SeriesCollection.

func (*Client) BrowseWorkCollection added in v0.9.0

func (c *Client) BrowseWorkCollection(mbid MBID, filter IncludesFilter, paginator Paginator) (WorkCollection, error)

Browse the works in a WorkCollection.

func (*Client) BrowseWorks

func (c *Client) BrowseWorks(filter WorkFilter, paginator Paginator) (BrowseWorksResult, error)

Browse the works related to another entity.

func (*Client) CollectionAdd added in v0.7.0

func (c *Client) CollectionAdd(collection Collection, mbids []MBID) (SubmissionResult, error)

Adds the given MBIDs to the collection.

Requires an authenticated user with permission to update the collection.

The passed Collection must have at a minimum the fields ID and EntityType set to valid values.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	// In order to modify collections the user needs to be authenticated and
	// be owner or collaborator of the collection.
	client.SetDigestAuth("the_username", "$ecretP4$$word")
	// The collection must have at least the ID and the EntityType (recording,
	// release, release-group etc.) specified. You can create a new collection
	// instance like here or use one returned from LookupCollection,
	// BrowseCollections or SearchCollections.
	collection := musicbrainzws2.Collection{
		ID:         musicbrainzws2.MBID("eac97d44-19ea-4a9c-8f4d-cb68728cd458"),
		EntityType: "recording",
	}
	// List of recording IDs to add to the collection.
	recordingIDs := []musicbrainzws2.MBID{
		musicbrainzws2.MBID("569436a1-234a-44bc-a370-8f4d252bef21"),
		musicbrainzws2.MBID("78a2ac0d-67ab-4a5f-b9dc-3f86ef3fa994"),
	}
	if result, err := client.CollectionAdd(collection, recordingIDs); err != nil {
		fmt.Println(result.Message) // Will be "OK" on success
	}
}
Output:

func (*Client) CollectionRemove added in v0.7.0

func (c *Client) CollectionRemove(collection Collection, mbids []MBID) (SubmissionResult, error)

Removes the given MBIDs from the collection.

Requires an authenticated user with permission to update the collection.

The passed Collection must have at a minimum the fields ID and EntityType set to valid values.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	// In order to modify collections the user needs to be authenticated and
	// be owner or collaborator of the collection.
	client.SetDigestAuth("the_username", "$ecretP4$$word")
	// The collection must have at least the ID and the EntityType (recording,
	// release, release-group etc.) specified. You can create a new collection
	// instance like here or use one returned from LookupCollection,
	// BrowseCollections or SearchCollections.
	collection := musicbrainzws2.Collection{
		ID:         musicbrainzws2.MBID("eac97d44-19ea-4a9c-8f4d-cb68728cd458"),
		EntityType: "recording",
	}
	// List of recording IDs to remove from the collection.
	recordingIDs := []musicbrainzws2.MBID{
		musicbrainzws2.MBID("569436a1-234a-44bc-a370-8f4d252bef21"),
		musicbrainzws2.MBID("78a2ac0d-67ab-4a5f-b9dc-3f86ef3fa994"),
	}
	if result, err := client.CollectionRemove(collection, recordingIDs); err != nil {
		fmt.Println(result.Message) // Will be "OK" on success
	}
}
Output:

func (*Client) LookupArea

func (c *Client) LookupArea(mbid MBID, filter IncludesFilter) (Area, error)

Lookup a single area.

func (*Client) LookupArtist

func (c *Client) LookupArtist(mbid MBID, filter IncludesFilter) (Artist, error)

Lookup a single artist.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	mbid := musicbrainzws2.MBID("10bf95b6-30e3-44f1-817f-45762cdc0de0")
	filter := musicbrainzws2.IncludesFilter{
		Includes: []string{"releases"},
	}
	if artist, err := client.LookupArtist(mbid, filter); err != nil {
		fmt.Println(artist.Name)
	}
}
Output:

func (*Client) LookupCollection

func (c *Client) LookupCollection(mbid MBID, filter IncludesFilter) (Collection, error)

Lookup a single collection.

func (*Client) LookupDiscID added in v0.2.0

func (c *Client) LookupDiscID(discID string, filter DiscIDFilter) (DiscID, error)

Lookup a disc ID and the releases it is linked to.

By default only exact matches are returned. You can enable fuzzy searches by setting the DiscIDFilter TOC attribute to a valid CD TOC string.

When providing a TOC the discID parameter can also be left blank or be set to "-".

The Includes arguments supported in the DiscIDFilter are identical to a Client.LookupRelease request.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	discID := "I5l9cCSFccLKFEKS.7wqSZAorPU-"
	filter := musicbrainzws2.DiscIDFilter{
		Includes: []string{"recordings"},
	}
	if result, err := client.LookupDiscID(discID, filter); err != nil {
		// Print the titles of all found releases
		for _, release := range result.Releases {
			fmt.Println(release.Title)
		}
	}
}
Output:

Example (Fuzzy)
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	// By providing a CD TOC string the method will also return fuzzy matches, that
	// is releases that approximately match the track lengths.
	filter := musicbrainzws2.DiscIDFilter{
		TOC:      "1 12 267257 150 22767 41887 58317 72102 91375 104652 115380 132165 143932 159870 174597",
		Includes: []string{"recordings"},
	}
	// For fuzzy lookups the disc ID parameter can be left empty.
	if result, err := client.LookupDiscID("", filter); err != nil {
		// Print the titles of all found releases
		for _, release := range result.Releases {
			fmt.Println(release.Title)
		}
	}
}
Output:

func (*Client) LookupEvent

func (c *Client) LookupEvent(mbid MBID, filter IncludesFilter) (Event, error)

Lookup a single event.

func (*Client) LookupGenre added in v0.9.0

func (c *Client) LookupGenre(mbid MBID, filter IncludesFilter) (Genre, error)

Lookup a single recording.

func (*Client) LookupISRC added in v0.2.0

func (c *Client) LookupISRC(isrc ISRC, filter IncludesFilter) (ISRCResult, error)

Returns a list of recordings with matching ISRC.

The Includes arguments supported in the IncludesFilter are identical to a Client.LookupRecording request.

func (*Client) LookupISWC added in v0.2.0

func (c *Client) LookupISWC(iswc ISWC, filter IncludesFilter) (ISWCResult, error)

Returns a list of works with matching ISWC.

The Includes arguments supported in the IncludesFilter are identical to a Client.LookupWork request.

func (*Client) LookupInstrument

func (c *Client) LookupInstrument(mbid MBID, filter IncludesFilter) (Instrument, error)

Lookup a single instrument.

func (*Client) LookupLabel

func (c *Client) LookupLabel(mbid MBID, filter IncludesFilter) (Label, error)

Lookup a single label.

func (*Client) LookupPlace

func (c *Client) LookupPlace(mbid MBID, filter IncludesFilter) (Place, error)

Lookup a single place.

func (*Client) LookupRecording

func (c *Client) LookupRecording(mbid MBID, filter IncludesFilter) (Recording, error)

Lookup a single recording.

func (*Client) LookupRelease

func (c *Client) LookupRelease(mbid MBID, filter IncludesFilter) (Release, error)

Lookup a single release.

func (*Client) LookupReleaseGroup

func (c *Client) LookupReleaseGroup(mbid MBID, filter IncludesFilter) (ReleaseGroup, error)

Lookup a single release group.

func (*Client) LookupSeries

func (c *Client) LookupSeries(mbid MBID, filter IncludesFilter) (Series, error)

Lookup a single series.

func (*Client) LookupURL

func (c *Client) LookupURL(mbid MBID, filter IncludesFilter) (URL, error)

Lookup a single URL.

func (*Client) LookupURLByResource

func (c *Client) LookupURLByResource(filter URLFilter) (URL, error)

Lookup a single URL entity by target URL.

func (*Client) LookupWork

func (c *Client) LookupWork(mbid MBID, filter IncludesFilter) (Work, error)

Lookup a single work.

func (*Client) SearchAnnotation added in v0.6.0

func (c *Client) SearchAnnotation(filter SearchFilter, paginator Paginator) (SearchAnnotationsResult, error)

Search for annotations with a search query.

func (*Client) SearchAreas

func (c *Client) SearchAreas(filter SearchFilter, paginator Paginator) (SearchAreasResult, error)

Search for areas with a search query.

func (*Client) SearchArtists

func (c *Client) SearchArtists(filter SearchFilter, paginator Paginator) (SearchArtistsResult, error)

Search for artists with a search query.

func (*Client) SearchCollections

func (c *Client) SearchCollections(filter SearchFilter, paginator Paginator) (SearchCollectionsResult, error)

Search for collections with a search query.

func (*Client) SearchEvents

func (c *Client) SearchEvents(filter SearchFilter, paginator Paginator) (SearchEventsResult, error)

Search for events with a search query.

func (*Client) SearchInstruments

func (c *Client) SearchInstruments(filter SearchFilter, paginator Paginator) (SearchInstrumentsResult, error)

Search for instruments with a search query.

func (*Client) SearchLabels

func (c *Client) SearchLabels(filter SearchFilter, paginator Paginator) (SearchLabelsResult, error)

Search for labels with a search query.

func (*Client) SearchPlaces

func (c *Client) SearchPlaces(filter SearchFilter, paginator Paginator) (SearchPlacesResult, error)

Search for places with a search query.

func (*Client) SearchRecordings

func (c *Client) SearchRecordings(filter SearchFilter, paginator Paginator) (SearchRecordingsResult, error)

Search for recordings with a search query.

func (*Client) SearchReleaseGroups

func (c *Client) SearchReleaseGroups(filter SearchFilter, paginator Paginator) (SearchReleaseGroupsResult, error)

Search for release groups with a search query.

func (*Client) SearchReleases

func (c *Client) SearchReleases(filter SearchFilter, paginator Paginator) (SearchReleasesResult, error)

Search for releases with a search query.

func (*Client) SearchSeries

func (c *Client) SearchSeries(filter SearchFilter, paginator Paginator) (SearchSeriesResult, error)

Search for series with a search query.

func (*Client) SearchURLs

func (c *Client) SearchURLs(filter SearchFilter, paginator Paginator) (SearchURLsResult, error)

Search for URLs with a search query.

func (*Client) SearchWorks

func (c *Client) SearchWorks(filter SearchFilter, paginator Paginator) (SearchWorksResult, error)

Search for works with a search query.

func (*Client) SetAuthToken added in v0.3.0

func (c *Client) SetAuthToken(token string)

Authenticate with an OAuth2 token.

The token itself must be retrieved from MusicBrainz using the OAuth2 flow described in https://musicbrainz.org/doc/Development/OAuth2. Implementing the OAuth2 flow is outside the scope of this package. You can use existing OAuth2 libraries to help with the implementation.

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(url string)

Set the base URL for the MusicBrainz API.

By default this is "https://musicbrainz.org/ws/2/". Can be changed to access a different MusicBrainz instance.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	client.SetBaseURL("https://beta.musicbrainz.org/ws/2")
	fmt.Println(client.BaseURL())
}
Output:

https://beta.musicbrainz.org/ws/2

func (*Client) SetDigestAuth added in v0.3.0

func (c *Client) SetDigestAuth(username, password string)

Authenticate with a MusicBrainz username and password.

Authentication is required for all data submission endpoints and to query user specific data such as collections or user tags and genres.

func (*Client) SetUserAgent added in v0.3.0

func (c *Client) SetUserAgent(userAgent string)

Sets the user agent.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	client.SetUserAgent("other-tool/1.0")
	fmt.Println(client.UserAgent())
}
Output:

other-tool/1.0

func (*Client) SubmitBarcodes added in v0.7.0

func (c *Client) SubmitBarcodes(barcodes ReleaseBarcodeMap) (SubmissionResult, error)

Submit a list of barcodes for releases.

Example
package main

import (
	"fmt"
	"log"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	client.SetDigestAuth("someuser", "passw0rd")
	barcodes := musicbrainzws2.ReleaseBarcodeMap{
		"2a41c1ac-a71c-4da6-a4ec-8769c58df7e8": "5016583716929",
		"a41f925e-c73f-4cb9-b64c-0600abcc1f60": "5016583717421",
	}
	result, err := client.SubmitBarcodes(barcodes)
	if err != nil {
		log.Fatalf("Barcode submission failed: %v\n", err)
	}
	fmt.Println(result.Message) // Should print "OK"
}
Output:

func (*Client) SubmitISRCs added in v0.3.0

func (c *Client) SubmitISRCs(isrcs RecordingISRCMap) (SubmissionResult, error)

Submit a list of ISRCs for recordings.

Example
package main

import (
	"fmt"
	"log"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	client.SetDigestAuth("someuser", "passw0rd")
	recordingISRCs := musicbrainzws2.RecordingISRCMap{
		"b129ec30-a931-447d-86bb-0d249cc03ee5": []musicbrainzws2.ISRC{
			"DEA349900097", "UKASM1700022",
		},
		"75c961c9-6e00-4861-9c9d-e6ca90d57342": []musicbrainzws2.ISRC{
			"JPB600523201",
		},
	}
	result, err := client.SubmitISRCs(recordingISRCs)
	if err != nil {
		log.Fatalf("ISRC submission failed: %v\n", err)
	}
	fmt.Println(result.Message) // Should print "OK"
}
Output:

func (*Client) SubmitRatings added in v0.7.0

func (c *Client) SubmitRatings(tagMap EntityRatingMap) (SubmissionResult, error)

Submit user ratings for MusicBrainz entities.

This links MBIDs for different entities to a numeric rating (0-100, with 100 being the highest rating).

Example
package main

import (
	"fmt"
	"log"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	client.SetDigestAuth("someuser", "passw0rd")
	ratingMap := musicbrainzws2.EntityRatingMap{
		ArtistRatings: musicbrainzws2.MBIDRatingMap{
			"06fb1c8b-566e-4cb2-985b-b467c90781d4": 80,
			"10bf95b6-30e3-44f1-817f-45762cdc0de0": 100,
		},
		ReleaseGroupRatings: musicbrainzws2.MBIDRatingMap{
			"246568c5-1fe6-35b2-b056-c94d6c484eac": 90,
		},
	}
	result, err := client.SubmitRatings(ratingMap)
	if err != nil {
		log.Fatalf("Rating submission failed: %v\n", err)
	}
	fmt.Println(result.Message) // Should print "OK"
}
Output:

func (*Client) SubmitTags added in v0.5.0

func (c *Client) SubmitTags(tagMap EntityTagMap) (SubmissionResult, error)

Submit folksonomy tags (including genres) for MusicBrainz entities.

Tags can be submitted for multiple entities and entity types in a single request. By default tags will be voted for. But you can also set the "Vote" attribute on a TagVote to UpvoteTag, DownvoteTag or WithdrawTag.

The "withdraw" vote will remove any upvote or downvote that you previously added (as if you had never voted).

Example
package main

import (
	"fmt"
	"log"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	client := musicbrainzws2.NewClient("my-tool", "1.0")
	client.SetDigestAuth("someuser", "passw0rd")
	tagMap := musicbrainzws2.EntityTagMap{
		ArtistTags: musicbrainzws2.MBIDTagSubmissionMap{
			"06fb1c8b-566e-4cb2-985b-b467c90781d4": []musicbrainzws2.TagSubmission{
				{Tag: musicbrainzws2.Tag{Name: "blues rock"}},
				{Tag: musicbrainzws2.Tag{Name: "psychedelic rock"}},
				{Tag: musicbrainzws2.Tag{Name: "r&b"}, Vote: musicbrainzws2.WithdrawTag},
			},
		},
		ReleaseGroupTags: musicbrainzws2.MBIDTagSubmissionMap{
			"246568c5-1fe6-35b2-b056-c94d6c484eac": []musicbrainzws2.TagSubmission{
				{Tag: musicbrainzws2.Tag{Name: "electronic"}},
				{Tag: musicbrainzws2.Tag{Name: "electronic rock"}},
				{Tag: musicbrainzws2.Tag{Name: "experimental"}},
				{Tag: musicbrainzws2.Tag{Name: "classic rock"}, Vote: musicbrainzws2.DownvoteTag},
				{Tag: musicbrainzws2.Tag{Name: "rock"}, Vote: musicbrainzws2.WithdrawTag},
			},
		},
	}
	result, err := client.SubmitTags(tagMap)
	if err != nil {
		log.Fatalf("Tag submission failed: %v\n", err)
	}
	fmt.Println(result.Message) // Should print "OK"
}
Output:

func (*Client) UserAgent

func (c *Client) UserAgent() string

Returns the set user agent.

The user agent defaults to "appName/appVersion" using the values given in NewClient.

type Collection

type Collection struct {
	ID         MBID   `json:"id"`
	Name       string `json:"name"`
	Type       string `json:"type"`
	TypeID     MBID   `json:"type-id"`
	EntityType string `json:"entity-type"`
	Editor     string `json:"editor"`
}

Collections are lists of entities that users can create, title and edit as they see fit. Each collection can be private or public.

See https://musicbrainz.org/doc/Collections

type CollectionFilter

type CollectionFilter struct {
	AreaMBID         MBID
	ArtistMBID       MBID
	EventMBID        MBID
	LabelMBID        MBID
	PlaceMBID        MBID
	RecordingMBID    MBID
	ReleaseMBID      MBID
	ReleaseGroupMBID MBID
	WorkMBID         MBID
	Editor           string
	Includes         []string
}

func (CollectionFilter) SetQuery

func (f CollectionFilter) SetQuery(r *resty.Request)

type CoverArtArchiveInfo

type CoverArtArchiveInfo struct {
	HasArtwork bool `json:"artwork"`
	Count      int  `json:"count"`
	IsFront    bool `json:"front"`
	IsBack     bool `json:"back"`
	IsDarkened bool `json:"darkened"`
}

Holds information about the artwork available for a release on the Cover Art Archive.

type DiscID

type DiscID struct {
	ID          string    `json:"id"`
	Sectors     int       `json:"sectors"`
	OffsetCount int       `json:"offset-count"`
	Offsets     []int     `json:"offsets"`
	Releases    []Release `json:"releases"`
}

Contains the TOC information of a CD.

The TOC is used to uniquely identify different CDs.

func (DiscID) Duration added in v0.4.0

func (d DiscID) Duration() Duration

Returns the total playback duration of the disc.

The duration is calculated from the sectors (1 second = 75 sectors)

Example
package main

import (
	"fmt"

	_ "embed"
	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	disc := musicbrainzws2.DiscID{Sectors: 242457}
	duration := disc.Duration()
	fmt.Println(duration)
	fmt.Printf("%d ms", duration.Milliseconds())
}
Output:

53:52
3232760 ms

type DiscIDFilter added in v0.2.0

type DiscIDFilter struct {
	// Set this to a TOC string to enable fuzzy matching.
	//
	// A TOC string has the format "1 12 267257 150 22767 41887 58317 72102 91375 104652 115380 132165 143932 159870 174597".
	TOC string
	// By default, fuzzy TOC searches only return mediums whose format is set to
	// "CD." If you want to search all mediums regardless of format, set
	// MediaFormat to [MediaFormatAll].
	MediaFormat MediaFormatFilter
	// Allowed values are identical to [ReleaseFilter.Includes].
	Includes []string
}

func (DiscIDFilter) SetQuery added in v0.2.0

func (f DiscIDFilter) SetQuery(r *resty.Request)

type Duration added in v0.3.0

type Duration struct {
	time.Duration
}

A duration with millisecond precision.

This implementation provides the functionality of `time.Duration`. MusicBrainz returns the duration with millisecond precision if possible. In many cases data is only available with second precision, though.

func (Duration) MarshalJSON added in v0.3.0

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) String added in v0.3.0

func (d Duration) String() string

Returns the duration formatted as "MM:SS".

Example
package main

import (
	"fmt"
	"time"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	duration := musicbrainzws2.Duration{
		Duration: time.Duration(297001 * time.Millisecond),
	}
	fmt.Println(duration.String())
}
Output:

4:57

func (*Duration) UnmarshalJSON added in v0.3.0

func (d *Duration) UnmarshalJSON(b []byte) error

type EntityRatingMap added in v0.7.0

type EntityRatingMap struct {
	AreaRatings         MBIDRatingMap `xml:"area-list>area,omitempty"`
	ArtistRatings       MBIDRatingMap `xml:"artist-list>artist,omitempty"`
	EventRatings        MBIDRatingMap `xml:"event-list>event,omitempty"`
	InstrumentRatings   MBIDRatingMap `xml:"instrument-list>instrument,omitempty"`
	LabelRatings        MBIDRatingMap `xml:"label-list>label,omitempty"`
	PlaceRatings        MBIDRatingMap `xml:"place-list>place,omitempty"`
	RecordingRatings    MBIDRatingMap `xml:"recording-list>recording,omitempty"`
	ReleaseRatings      MBIDRatingMap `xml:"release-list>release,omitempty"`
	ReleaseGroupRatings MBIDRatingMap `xml:"release-group-list>release-group,omitempty"`
	SeriesRatings       MBIDRatingMap `xml:"series-list>series,omitempty"`
	WorkRatings         MBIDRatingMap `xml:"work-list>work,omitempty"`
}

Combined MBIDRatingMap entries for different entity types.

Used for tag submission with Client.SubmitRatings.

Example
package main

import (
	"encoding/xml"
	"fmt"
	"log"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	list := musicbrainzws2.EntityRatingMap{
		ArtistRatings: musicbrainzws2.MBIDRatingMap{
			"455641ea-fff4-49f6-8fb4-49f961d8f1ad": 100,
		},
		RecordingRatings: musicbrainzws2.MBIDRatingMap{
			"c410a773-c6eb-4bc0-9df8-042fe6645c63": 20,
		},
	}
	result, err := xml.MarshalIndent(list, "", "  ")
	if err != nil {
		log.Fatalf("Unexpected error %v", err)
	}
	fmt.Println(string(result))
}
Output:

<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
  <artist-list>
    <artist id="455641ea-fff4-49f6-8fb4-49f961d8f1ad">
      <user-rating>100</user-rating>
    </artist>
  </artist-list>
  <recording-list>
    <recording id="c410a773-c6eb-4bc0-9df8-042fe6645c63">
      <user-rating>20</user-rating>
    </recording>
  </recording-list>
</metadata>

func (EntityRatingMap) MarshalXML added in v0.7.0

func (l EntityRatingMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type EntityTagMap added in v0.5.0

type EntityTagMap struct {
	AreaTags         MBIDTagSubmissionMap `xml:"area-list>area,omitempty"`
	ArtistTags       MBIDTagSubmissionMap `xml:"artist-list>artist,omitempty"`
	EventTags        MBIDTagSubmissionMap `xml:"event-list>event,omitempty"`
	InstrumentTags   MBIDTagSubmissionMap `xml:"instrument-list>instrument,omitempty"`
	LabelTags        MBIDTagSubmissionMap `xml:"label-list>label,omitempty"`
	PlaceTags        MBIDTagSubmissionMap `xml:"place-list>place,omitempty"`
	RecordingTags    MBIDTagSubmissionMap `xml:"recording-list>recording,omitempty"`
	ReleaseTags      MBIDTagSubmissionMap `xml:"release-list>release,omitempty"`
	ReleaseGroupTags MBIDTagSubmissionMap `xml:"release-group-list>release-group,omitempty"`
	SeriesTags       MBIDTagSubmissionMap `xml:"series-list>series,omitempty"`
	WorkTags         MBIDTagSubmissionMap `xml:"work-list>work,omitempty"`
}

Combined MBIDTagSubmissionMap entries for different entity types.

Used for tag submission with Client.SubmitTags.

Example
package main

import (
	"encoding/xml"
	"fmt"
	"log"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	list := musicbrainzws2.EntityTagMap{
		ArtistTags: musicbrainzws2.MBIDTagSubmissionMap{
			"06fb1c8b-566e-4cb2-985b-b467c90781d4": []musicbrainzws2.TagSubmission{
				{Tag: musicbrainzws2.Tag{Name: "blues rock"}},
				{Tag: musicbrainzws2.Tag{Name: "psychedelic rock"}},
				{Tag: musicbrainzws2.Tag{Name: "r&b"}, Vote: musicbrainzws2.DownvoteTag},
			},
		},
		ReleaseGroupTags: musicbrainzws2.MBIDTagSubmissionMap{
			"246568c5-1fe6-35b2-b056-c94d6c484eac": []musicbrainzws2.TagSubmission{
				{Tag: musicbrainzws2.Tag{Name: "electronic rock"}},
				{Tag: musicbrainzws2.Tag{Name: "classic rock"}, Vote: musicbrainzws2.DownvoteTag},
				{Tag: musicbrainzws2.Tag{Name: "rock"}, Vote: musicbrainzws2.WithdrawTag},
			},
		},
	}
	result, err := xml.MarshalIndent(list, "", "  ")
	if err != nil {
		log.Fatalf("Unexpected error %v", err)
	}
	fmt.Println(string(result))
}
Output:

<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
  <artist-list>
    <artist id="06fb1c8b-566e-4cb2-985b-b467c90781d4">
      <user-tag-list>
        <user-tag>
          <name>blues rock</name>
        </user-tag>
        <user-tag>
          <name>psychedelic rock</name>
        </user-tag>
        <user-tag vote="downvote">
          <name>r&amp;b</name>
        </user-tag>
      </user-tag-list>
    </artist>
  </artist-list>
  <release-group-list>
    <release-group id="246568c5-1fe6-35b2-b056-c94d6c484eac">
      <user-tag-list>
        <user-tag>
          <name>electronic rock</name>
        </user-tag>
        <user-tag vote="downvote">
          <name>classic rock</name>
        </user-tag>
        <user-tag vote="withdraw">
          <name>rock</name>
        </user-tag>
      </user-tag-list>
    </release-group>
  </release-group-list>
</metadata>

func (EntityTagMap) MarshalXML added in v0.5.0

func (l EntityTagMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ErrorResult

type ErrorResult struct {
	Error string `json:"error"`
	Help  string `json:"help"`
}

type Event

type Event struct {
	ID             MBID         `json:"id"`
	Score          int          `json:"score"`
	Name           string       `json:"name"`
	Disambiguation string       `json:"disambiguation"`
	Type           string       `json:"type"`
	TypeID         MBID         `json:"type-id"`
	Annotation     string       `json:"annotation"`
	Aliases        []Alias      `json:"aliases"`
	Relations      RelationList `json:"relations"`
	LifeSpan       LifeSpan     `json:"life-span"`
	Rating         Rating       `json:"rating"`
	UserRating     Rating       `json:"user-rating"`
	Tags           []Tag        `json:"tags"`
	UserTags       []Tag        `json:"user-tags"`
	Genres         []Genre      `json:"genres"`
	UserGenres     []Genre      `json:"user-genres"`
	IsCancelled    bool         `json:"cancelled"`
	Time           string       `json:"time"`
	Setlist        string       `json:"setlist"`
}

An event refers to an organised activity that people can attend, and is relevant to the performance, production or celebration of music.

In most cases, this means live concerts, festivals and other similar activities.

See https://musicbrainz.org/doc/Event

type EventCollection

type EventCollection struct {
	Collection
	Count  int     `json:"event-count"`
	Events []Event `json:"events"`
}

type EventFilter

type EventFilter struct {
	AreaMBID       MBID
	ArtistMBID     MBID
	CollectionMBID MBID
	PlaceMBID      MBID
	Includes       []string
}

func (EventFilter) SetQuery

func (f EventFilter) SetQuery(r *resty.Request)

type Filter

type Filter interface {
	SetQuery(*resty.Request)
}

type Genre

type Genre struct {
	ID             MBID   `json:"id"`
	Disambiguation string `json:"disambiguation"`
	Tag
}

In MusicBrainz genres are special Tag that have assigned an MBID.

If an entity gets tagged with a value that is linked to a genre this genre gets automatically applied to the entity.

Like tags genres can also be submitted with Client.SubmitTags.

See https://musicbrainz.org/doc/Genre

type GenreCollection added in v0.9.0

type GenreCollection struct {
	Collection
	Count  int     `json:"genre-count"`
	Genres []Genre `json:"genres"`
}

type GeoCoordinates

type GeoCoordinates struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

type ISO31661Code added in v0.8.0

type ISO31661Code string

Represents a two-letter ISO 3166-1 country code.

See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

type ISO31662Code added in v0.2.0

type ISO31662Code string

Represents an ISO 3166-2 area code.

ISO 3166-2 consist of a ISO 3166-1 alpha-2 country code and up to three additional alphanumeric characters specifying a subdivision. The two parts are separated by a hyphen, e.g. "GB-SCT" or "DE-RP".

See https://en.wikipedia.org/wiki/ISO_3166-2

func (ISO31662Code) CountryCode added in v0.8.0

func (c ISO31662Code) CountryCode() ISO31661Code

Returns only the ISO 3166-1 country code part of the area code.

Example
package main

import (
	"fmt"

	_ "embed"
	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	code := musicbrainzws2.ISO31662Code("GB-SCT")
	fmt.Println(code.CountryCode())
}
Output:

GB

type ISRC added in v0.2.0

type ISRC string

An International Standard Recording Code (ISRC).

See https://musicbrainz.org/doc/ISRC

func (ISRC) IsValid added in v0.3.0

func (isrc ISRC) IsValid() bool

Returns true, if the MBID has a valid format.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	isrc := musicbrainzws2.ISRC("GBCKC0700189")
	if isrc.IsValid() {
		fmt.Printf("%s is a valid ISRC\n", isrc)
	}
}
Output:

GBCKC0700189 is a valid ISRC

type ISRCResult added in v0.2.0

type ISRCResult struct {
	ISRC       ISRC        `json:"isrc"`
	Recordings []Recording `json:"recordings"`
}

type ISWC added in v0.2.0

type ISWC string

An International Standard Musical Work Code (ISWC).

See https://musicbrainz.org/doc/ISWC

func (ISWC) IsValid added in v0.3.0

func (iswc ISWC) IsValid() bool

Returns true, if the ISWC has a valid format.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	iswc := musicbrainzws2.ISWC("T-034.524.680-1")
	if iswc.IsValid() {
		fmt.Printf("%s is a valid ISWC\n", iswc)
	}
}
Output:

T-034.524.680-1 is a valid ISWC

type ISWCResult added in v0.2.0

type ISWCResult struct {
	Count  int    `json:"iswc-count"`
	Offset int    `json:"iswc-offset"`
	Works  []Work `json:"works"`
}

type IncludesFilter added in v0.9.0

type IncludesFilter struct {
	Includes []string
}

func (IncludesFilter) SetQuery added in v0.9.0

func (f IncludesFilter) SetQuery(r *resty.Request)

type Instrument

type Instrument struct {
	ID             MBID         `json:"id"`
	Score          int          `json:"score"`
	Name           string       `json:"name"`
	Disambiguation string       `json:"disambiguation"`
	Type           string       `json:"type"`
	TypeID         MBID         `json:"type-id"`
	Annotation     string       `json:"annotation"`
	Description    string       `json:"description"`
	Aliases        []Alias      `json:"aliases"`
	Relations      RelationList `json:"relations"`
	Rating         Rating       `json:"rating"`
	UserRating     Rating       `json:"user-rating"`
	Tags           []Tag        `json:"tags"`
	UserTags       []Tag        `json:"user-tags"`
	Genres         []Genre      `json:"genres"`
	UserGenres     []Genre      `json:"user-genres"`
}

Instruments are devices created or adapted to make musical sounds.

Instruments are primarily used in relationships between two other entities, e.g. to specify the instrument played by an artist on a recording.

See https://musicbrainz.org/doc/Instrument

type InstrumentCollection

type InstrumentCollection struct {
	Collection
	Count       int          `json:"instrument-count"`
	Instruments []Instrument `json:"instruments"`
}

type InstrumentFilter

type InstrumentFilter struct {
	CollectionMBID MBID
	Includes       []string
}

func (InstrumentFilter) SetQuery

func (f InstrumentFilter) SetQuery(r *resty.Request)

type Label

type Label struct {
	ID             MBID         `json:"id"`
	Score          int          `json:"score"`
	Name           string       `json:"name"`
	SortName       string       `json:"sort-name"`
	Disambiguation string       `json:"disambiguation"`
	Type           string       `json:"type"`
	TypeID         MBID         `json:"type-id"`
	Annotation     string       `json:"annotation"`
	Aliases        []Alias      `json:"aliases"`
	Relations      RelationList `json:"relations"`
	LifeSpan       LifeSpan     `json:"life-span"`
	CountryCode    ISO31661Code `json:"country"`
	Area           *Area        `json:"area,omitempty"`
	ISNIs          []string     `json:"isnis"`
	IPIs           []string     `json:"ipis"`
	Rating         Rating       `json:"rating"`
	UserRating     Rating       `json:"user-rating"`
	Tags           []Tag        `json:"tags"`
	UserTags       []Tag        `json:"user-tags"`
	Genres         []Genre      `json:"genres"`
	UserGenres     []Genre      `json:"user-genres"`
	LabelCode      int          `json:"label-code"`
	Releases       []Release    `json:"releases"`
}

Labels in MusicBrainz refer mainly to imprints.

In some cases a label entity may represent a record company or music holding company.

See https://musicbrainz.org/doc/Label

type LabelCollection

type LabelCollection struct {
	Collection
	Count  int     `json:"label-count"`
	Labels []Label `json:"labels"`
}

type LabelFilter

type LabelFilter struct {
	AreaMBID       MBID
	CollectionMBID MBID
	ReleaseMBID    MBID
	Includes       []string
}

func (LabelFilter) SetQuery

func (f LabelFilter) SetQuery(r *resty.Request)

type LabelInfo

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

type LifeSpan

type LifeSpan struct {
	Begin    PartialDate `json:"begin"`
	End      PartialDate `json:"end"`
	HasEnded bool        `json:"ended"`
}

type MBID

type MBID string

A MusicBrainz Identifier uniquely identifies a MusicBrainz entity.

See https://musicbrainz.org/doc/MusicBrainz_Identifier

func (MBID) IsValid

func (id MBID) IsValid() bool

Returns true, if the MBID has a valid format.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	mbid := musicbrainzws2.MBID("10bf95b6-30e3-44f1-817f-45762cdc0de0")
	if mbid.IsValid() {
		fmt.Printf("%s is a valid MBID\n", mbid)
	}
}
Output:

10bf95b6-30e3-44f1-817f-45762cdc0de0 is a valid MBID

type MBIDRatingMap added in v0.7.0

type MBIDRatingMap map[MBID]int

Mapping between MBIDs and a a numeric rating (0-100).

type MBIDTagSubmissionMap added in v0.5.0

type MBIDTagSubmissionMap map[MBID][]TagSubmission

Mapping between MBIDs and a list of tags to submit.

func (MBIDTagSubmissionMap) MarshalXML added in v0.5.0

func (l MBIDTagSubmissionMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type MediaFormatFilter added in v0.2.0

type MediaFormatFilter string

Filter releases returned by Client.LookupDiscID for fuzzy matches.

const (
	// Used to query only CDs with [Client.LookupDiscID]. This is the default.
	MediaFormatCDOnly MediaFormatFilter = ""
	// Query all releases with [Client.LookupDiscID] when using fuzzy matching.
	MediaFormatAll MediaFormatFilter = "all"
)

type Medium

type Medium struct {
	Title       string   `json:"title"`
	Format      string   `json:"format"`
	FormatID    MBID     `json:"format-id"`
	Position    int      `json:"position"`
	TrackCount  int      `json:"track-count"`
	TrackOffset int      `json:"track-offset"`
	Tracks      []Track  `json:"tracks"`
	Discs       []DiscID `json:"discs"`
}

In MusicBrainz terminology, a prototypical medium is one of the physical, separate things you would get when you buy something in a record store.

They are the individual CDs, vinyls, etc. contained within the packaging of a Release. Mediums are always included in a release, and have a position in said release (e.g. disc 1 or disc 2). They have a format, like CD, 12" vinyl or cassette (in some cases this will be unknown), and can have an optional title (e.g. disc 2: The Early Years).

See https://musicbrainz.org/doc/Medium

type Paginator

type Paginator struct {
	Offset int
	Limit  int
}

func DefaultPaginator

func DefaultPaginator() Paginator

func (Paginator) Next

func (p Paginator) Next() Paginator

func (Paginator) Prev

func (p Paginator) Prev() Paginator

func (Paginator) SetQuery

func (p Paginator) SetQuery(r *resty.Request)

type PartialDate

type PartialDate struct {
	Year  int
	Month int
	Day   int
}

A partial date consists year, month and day, where the smaller units are optional.

The date can omit the day or both month and day.

func (PartialDate) IsEarlierThan

func (d PartialDate) IsEarlierThan(other PartialDate) bool

Returns true, if this date is earlier than other.

func (PartialDate) IsEmpty added in v0.5.0

func (d PartialDate) IsEmpty() bool

Returns true, if the partial date is considered empty.

A partial date is empty, if the Year is 0.

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	fmt.Println(musicbrainzws2.PartialDate{}.IsEmpty())
	fmt.Println(musicbrainzws2.PartialDate{Year: 0}.IsEmpty())
	fmt.Println(musicbrainzws2.PartialDate{Year: 1994}.IsEmpty())
	fmt.Println(musicbrainzws2.PartialDate{Year: 1994, Month: 4, Day: 5}.IsEmpty())
}
Output:

true
true
false
false

func (PartialDate) MarshalJSON

func (d PartialDate) MarshalJSON() ([]byte, error)

func (PartialDate) String

func (d PartialDate) String() string

Formats the partial date as a string in the format "YYYY-MM-DD"

Example
package main

import (
	"fmt"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	fmt.Println(musicbrainzws2.PartialDate{Year: 1994})
	fmt.Println(musicbrainzws2.PartialDate{Year: 1994, Month: 4})
	fmt.Println(musicbrainzws2.PartialDate{Year: 1994, Month: 4, Day: 5})
}
Output:

1994
1994-04
1994-04-05

func (*PartialDate) UnmarshalJSON

func (d *PartialDate) UnmarshalJSON(data []byte) error

type Place

type Place struct {
	ID             MBID           `json:"id"`
	Score          int            `json:"score"`
	Name           string         `json:"name"`
	Disambiguation string         `json:"disambiguation"`
	Type           string         `json:"type"`
	TypeID         MBID           `json:"type-id"`
	Annotation     string         `json:"annotation"`
	Aliases        []Alias        `json:"aliases"`
	Relations      RelationList   `json:"relations"`
	LifeSpan       LifeSpan       `json:"life-span"`
	Rating         Rating         `json:"rating"`
	UserRating     Rating         `json:"user-rating"`
	Tags           []Tag          `json:"tags"`
	UserTags       []Tag          `json:"user-tags"`
	Genres         []Genre        `json:"genres"`
	UserGenres     []Genre        `json:"user-genres"`
	Address        string         `json:"address"`
	Coordinates    GeoCoordinates `json:"coordinates"`
	Area           *Area          `json:"area,omitempty"`
}

A place is a building or outdoor area used for performing or producing music.

See https://musicbrainz.org/doc/Place

type PlaceCollection

type PlaceCollection struct {
	Collection
	Count  int     `json:"place-count"`
	Places []Place `json:"places"`
}

type PlaceFilter

type PlaceFilter struct {
	AreaMBID       MBID
	CollectionMBID MBID
	Includes       []string
}

func (PlaceFilter) SetQuery

func (f PlaceFilter) SetQuery(r *resty.Request)

type Rating added in v0.5.0

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

A rating of an entity as given by users.

The rating is a value between 0.0 and 5.0. If this represents the individual rating of the current user VotesCount is omitted and the Value is an integer number. If it represents the cumulated rating of all users VotesCount indicates how many users have rated the entity and Value is the average rating across all users.

type Recording

type Recording struct {
	ID               MBID         `json:"id"`
	Score            int          `json:"score"`
	Title            string       `json:"title"`
	Disambiguation   string       `json:"disambiguation"`
	Annotation       string       `json:"annotation"`
	Relations        RelationList `json:"relations"`
	ArtistCredit     ArtistCredit `json:"artist-credit"`
	Length           Duration     `json:"length"`
	FirstReleaseDate PartialDate  `json:"first-release-date,omitempty"`
	IsVideo          bool         `json:"video"`
	ISRCs            []ISRC       `json:"isrcs"`
	Rating           Rating       `json:"rating"`
	UserRating       Rating       `json:"user-rating"`
	Tags             []Tag        `json:"tags"`
	UserTags         []Tag        `json:"user-tags"`
	Genres           []Genre      `json:"genres"`
	UserGenres       []Genre      `json:"user-genres"`
	Releases         []Release    `json:"releases"`
}

A recording represents distinct audio that has been used to produce at least one released track.

See https://musicbrainz.org/doc/Recording

type RecordingCollection

type RecordingCollection struct {
	Collection
	Count      int         `json:"recording-count"`
	Recordings []Recording `json:"recordings"`
}

type RecordingFilter

type RecordingFilter struct {
	ArtistMBID     MBID
	CollectionMBID MBID
	ReleaseMBID    MBID
	WorkMBID       MBID
	Includes       []string
}

artist, collection, release, work

func (RecordingFilter) SetQuery

func (f RecordingFilter) SetQuery(r *resty.Request)

type RecordingISRCMap added in v0.3.0

type RecordingISRCMap map[MBID][]ISRC

A map with recording MBIDs and lists of ISRCs.

Used for ISRC submission with Client.SubmitISRCs.

Example
package main

import (
	"encoding/xml"
	"fmt"
	"log"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	list := musicbrainzws2.RecordingISRCMap{
		"b129ec30-a931-447d-86bb-0d249cc03ee5": []musicbrainzws2.ISRC{
			"DEA349900097", "UKASM1700022",
		},
	}
	result, err := xml.MarshalIndent(list, "", "  ")
	if err != nil {
		log.Fatalf("Unexpected error %v", err)
	}
	fmt.Println(string(result))
}
Output:

<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
  <recording-list>
    <recording id="b129ec30-a931-447d-86bb-0d249cc03ee5">
      <isrc-list count="2">
        <isrc id="DEA349900097"></isrc>
        <isrc id="UKASM1700022"></isrc>
      </isrc-list>
    </recording>
  </recording-list>
</metadata>

func (RecordingISRCMap) MarshalXML added in v0.3.0

func (l RecordingISRCMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Relation

type Relation struct {
	Type             string            `json:"type"`
	TypeID           MBID              `json:"type-id"`
	Begin            PartialDate       `json:"begin"`
	End              PartialDate       `json:"end"`
	HasEnded         bool              `json:"ended"`
	SourceCredit     string            `json:"source-credit"`
	TargetCredit     string            `json:"target-credit"`
	TargetType       string            `json:"target-type"`
	Direction        string            `json:"direction"`
	OrderingKey      int               `json:"ordering-key"`
	Attributes       []string          `json:"attributes"`
	AttributeIDs     map[string]MBID   `json:"attribute-ids"`
	AttributeCredits map[string]string `json:"attribute-credits"`
	AttributeValues  map[string]string `json:"attribute-values"`
	Area             *Area             `json:"area,omitempty"`
	Artist           *Artist           `json:"artist,omitempty"`
	Event            *Event            `json:"event,omitempty"`
	Genre            *Genre            `json:"genre,omitempty"`
	Instrument       *Instrument       `json:"instrument,omitempty"`
	Label            *Label            `json:"label,omitempty"`
	Place            *Place            `json:"place,omitempty"`
	Recording        *Recording        `json:"recording,omitempty"`
	Release          *Release          `json:"release,omitempty"`
	ReleaseGroup     *ReleaseGroup     `json:"release_group,omitempty"`
	Series           *Series           `json:"series,omitempty"`
	Work             *Work             `json:"work,omitempty"`
	URL              *URL              `json:"url,omitempty"`
}

type RelationList

type RelationList []Relation

func (RelationList) FilterByTargetType

func (l RelationList) FilterByTargetType(target string) RelationList

Returns a new RelationList only containing relations with matching target type.

type RelationResultList

type RelationResultList struct {
	Relations RelationList `json:"relations"`
}

type Release

type Release struct {
	ID                 MBID                `json:"id"`
	Score              int                 `json:"score"`
	Title              string              `json:"title"`
	Disambiguation     string              `json:"disambiguation"`
	Annotation         string              `json:"annotation"`
	Aliases            []Alias             `json:"aliases"`
	Relations          RelationList        `json:"relations"`
	ArtistCredit       ArtistCredit        `json:"artist-credit"`
	CountryCode        ISO31661Code        `json:"country"`
	Date               PartialDate         `json:"date"`
	Status             string              `json:"status"`
	StatusID           MBID                `json:"status-id"`
	Packaging          string              `json:"packaging"`
	PackagingID        MBID                `json:"packaging-id"`
	Quality            string              `json:"quality"`
	Barcode            Barcode             `json:"barcode"`
	ASIN               string              `json:"asin"`
	TextRepresentation TextRepresentation  `json:"text-representation"`
	LabelInfo          []LabelInfo         `json:"label-info"`
	ReleaseEvents      []ReleaseEvent      `json:"release-events"`
	CoverArtArchive    CoverArtArchiveInfo `json:"cover-art-archive"`
	ReleaseGroup       *ReleaseGroup       `json:"release-group,omitempty"`
	Media              []Medium            `json:"media"`
	Rating             Rating              `json:"rating"`
	UserRating         Rating              `json:"user-rating"`
	Tags               []Tag               `json:"tags"`
	UserTags           []Tag               `json:"user-tags"`
	Genres             []Genre             `json:"genres"`
	UserGenres         []Genre             `json:"user-genres"`
}

A MusicBrainz release represents the unique release (i.e. issuing) of a product containing at least one audio Medium.

See https://musicbrainz.org/doc/Release

type ReleaseBarcodeMap added in v0.7.0

type ReleaseBarcodeMap map[MBID]Barcode

A map with release MBIDs and lists of barcodes.

Used for barcode submission with Client.SubmitBarcodes.

Example
package main

import (
	"encoding/xml"
	"fmt"
	"log"

	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	list := musicbrainzws2.ReleaseBarcodeMap{
		"047ea202-b98d-46ae-97f7-0180a20ee5cf": "4050538793819",
	}
	result, err := xml.MarshalIndent(list, "", "  ")
	if err != nil {
		log.Fatalf("Unexpected error %v", err)
	}
	fmt.Println(string(result))
}
Output:

<metadata xmlns="http://musicbrainz.org/ns/mmd-2.0#">
  <release-list>
    <release id="047ea202-b98d-46ae-97f7-0180a20ee5cf">
      <barcode>4050538793819</barcode>
    </release>
  </release-list>
</metadata>

func (ReleaseBarcodeMap) MarshalXML added in v0.7.0

func (l ReleaseBarcodeMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ReleaseCollection

type ReleaseCollection struct {
	Collection
	Count    int       `json:"release-count"`
	Releases []Release `json:"releases"`
}

type ReleaseEvent

type ReleaseEvent struct {
	Date PartialDate `json:"date"`
	Area Area        `json:"area"`
}

type ReleaseFilter

type ReleaseFilter struct {
	AreaMBID         MBID
	ArtistMBID       MBID
	CollectionMBID   MBID
	LabelMBID        MBID
	TrackMBID        MBID
	TrackArtistMBID  MBID
	RecordingMBID    MBID
	ReleaseGroupMBID MBID
	Status           string
	Type             string
	Includes         []string
}

func (ReleaseFilter) SetQuery

func (f ReleaseFilter) SetQuery(r *resty.Request)

type ReleaseGroup

type ReleaseGroup struct {
	ID               MBID         `json:"id"`
	Score            int          `json:"score"`
	Title            string       `json:"title"`
	Disambiguation   string       `json:"disambiguation"`
	PrimaryType      string       `json:"primary-type"`
	PrimaryTypeID    MBID         `json:"primary-type-id"`
	SecondaryTypes   []string     `json:"secondary-types"`
	SecondaryTypeIDs []MBID       `json:"secondary-type-ids"`
	Annotation       string       `json:"annotation"`
	Aliases          []Alias      `json:"aliases"`
	Relations        RelationList `json:"relations"`
	ArtistCredit     ArtistCredit `json:"artist-credit"`
	FirstReleaseDate PartialDate  `json:"first-release-date,omitempty"`
	Rating           Rating       `json:"rating"`
	UserRating       Rating       `json:"user-rating"`
	Tags             []Tag        `json:"tags"`
	UserTags         []Tag        `json:"user-tags"`
	Genres           []Genre      `json:"genres"`
	UserGenres       []Genre      `json:"user-genres"`
	Releases         []Release    `json:"releases"`
}

A release group, as the name suggests, is used to group releases into a single logical entity.

Every Release belongs to one, and only one, release group.

See https://musicbrainz.org/doc/Release_Group

type ReleaseGroupCollection

type ReleaseGroupCollection struct {
	Collection
	Count         int            `json:"release-group-count"`
	ReleaseGroups []ReleaseGroup `json:"release-groups"`
}

type ReleaseGroupFilter

type ReleaseGroupFilter struct {
	ArtistMBID         MBID
	CollectionMBID     MBID
	ReleaseMBID        MBID
	Type               string
	ReleaseGroupStatus ReleaseGroupStatus
	Includes           []string
}

func (ReleaseGroupFilter) SetQuery

func (f ReleaseGroupFilter) SetQuery(r *resty.Request)

type ReleaseGroupStatus added in v0.2.0

type ReleaseGroupStatus string

Filters release groups in Client.BrowseReleaseGroups requests.

const (
	// Return all release groups
	ReleaseGroupStatusAll ReleaseGroupStatus = "all"
	// Show the same release groups as in the default website overview.
	// Excluding ones that contain only releases of status promotional, bootleg
	// or pseudo-release.
	ReleaseGroupStatusWebsiteDefault ReleaseGroupStatus = "website-default"
)

type SearchAnnotationsResult added in v0.8.0

type SearchAnnotationsResult struct {
	SearchResult
	Annotations []Annotation `json:"annotations"`
}

type SearchAreasResult added in v0.8.0

type SearchAreasResult struct {
	SearchResult
	Areas []Area `json:"areas"`
}

type SearchArtistsResult added in v0.8.0

type SearchArtistsResult struct {
	SearchResult
	Artists []Artist `json:"artists"`
}

type SearchCollectionsResult added in v0.8.0

type SearchCollectionsResult struct {
	SearchResult
	Collections []Collection `json:"collections"`
}

type SearchEventsResult added in v0.8.0

type SearchEventsResult struct {
	SearchResult
	Events []Event `json:"events"`
}

type SearchFilter

type SearchFilter struct {
	Query    string
	Includes []string
	Dismax   bool
}

func (SearchFilter) SetQuery

func (f SearchFilter) SetQuery(r *resty.Request)

type SearchInstrumentsResult added in v0.8.0

type SearchInstrumentsResult struct {
	SearchResult
	Instruments []Instrument `json:"instruments"`
}

type SearchLabelsResult added in v0.8.0

type SearchLabelsResult struct {
	SearchResult
	Labels []Label `json:"labels"`
}

type SearchPlacesResult added in v0.8.0

type SearchPlacesResult struct {
	SearchResult
	Places []Place `json:"places"`
}

type SearchRecordingsResult added in v0.8.0

type SearchRecordingsResult struct {
	SearchResult
	Recordings []Recording `json:"recordings"`
}

type SearchReleaseGroupsResult added in v0.8.0

type SearchReleaseGroupsResult struct {
	SearchResult
	ReleaseGroups []ReleaseGroup `json:"release-groups"`
}

type SearchReleasesResult added in v0.8.0

type SearchReleasesResult struct {
	SearchResult
	Releases []Release `json:"releases"`
}

type SearchResult

type SearchResult struct {
	Count   int       `json:"count"`
	Offset  int       `json:"offset"`
	Created time.Time `json:"created"`
}

type SearchSeriesResult added in v0.8.0

type SearchSeriesResult struct {
	SearchResult
	Series []Series `json:"series"`
}

type SearchURLsResult added in v0.8.0

type SearchURLsResult struct {
	SearchResult
	URLs []URL `json:"urls"`
}

type SearchWorksResult added in v0.8.0

type SearchWorksResult struct {
	SearchResult
	Works []Work `json:"works"`
}

type Series

type Series struct {
	ID             MBID         `json:"id"`
	Score          int          `json:"score"`
	Name           string       `json:"name"`
	Disambiguation string       `json:"disambiguation"`
	Type           string       `json:"type"`
	TypeID         MBID         `json:"type-id"`
	Annotation     string       `json:"annotation"`
	Aliases        []Alias      `json:"aliases"`
	Relations      RelationList `json:"relations"`
	Rating         Rating       `json:"rating"`
	UserRating     Rating       `json:"user-rating"`
	Tags           []Tag        `json:"tags"`
	UserTags       []Tag        `json:"user-tags"`
	Genres         []Genre      `json:"genres"`
	UserGenres     []Genre      `json:"user-genres"`
}

A series is a sequence of separate release groups, releases, recordings, works, artists or events with a common theme.

See https://musicbrainz.org/doc/Series

type SeriesCollection

type SeriesCollection struct {
	Collection
	Count  int      `json:"series-count"`
	Series []Series `json:"series"`
}

type SeriesFilter

type SeriesFilter struct {
	CollectionMBID MBID
	Includes       []string
}

func (SeriesFilter) SetQuery

func (f SeriesFilter) SetQuery(r *resty.Request)

type SubmissionResult added in v0.3.0

type SubmissionResult struct {
	Message string `json:"message"`
}

type Tag

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

A folksonomy tag allows tagging MusicBrainz entities with arbitrary values.

The tag has a name and a count. The count indicates by how many users this tag has been used on the entity it is applied to.

Tags can be submitted to the MusicBrainz database with Client.SubmitTags.

func (Tag) String added in v0.5.0

func (t Tag) String() string

Returns just the tag name.

Example
package main

import (
	"fmt"

	_ "embed"
	"go.uploadedlobster.com/musicbrainzws2"
)

func main() {
	tag := musicbrainzws2.Tag{Name: "blues rock", Count: 5}
	fmt.Println(tag)
}
Output:

blues rock

type TagSubmission added in v0.5.0

type TagSubmission struct {
	Tag
	Vote TagVote
}

func (TagSubmission) MarshalXML added in v0.5.0

func (t TagSubmission) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TagVote added in v0.5.0

type TagVote string

type TextRepresentation

type TextRepresentation struct {
	Script   string `json:"script"`
	Language string `json:"language"`
}

type Track

type Track struct {
	ID           MBID         `json:"id"`
	Title        string       `json:"title"`
	ArtistCredit ArtistCredit `json:"artist-credit"`
	Length       Duration     `json:"length"`
	Position     int          `json:"position"`
	Number       string       `json:"number"`
	Recording    Recording    `json:"recording"`
}

In MusicBrainz, a track is the way a Recording is represented on a particular Release (or, more exactly, on a particular Medium).

Every track has a title (see the guidelines for titles) and is credited to one or more artists. Tracks are additionally assigned MBIDs, though they cannot be the target of Relationships or other properties conventionally available to entities.

See https://musicbrainz.org/doc/Track

type URL

type URL struct {
	ID           MBID               `json:"id"`
	Score        int                `json:"score"`
	Resource     string             `json:"resource"`
	RelationList RelationResultList `json:"relation-list"`
}

A URL in MusicBrainz is a specific entity representing a regular internet Uniform Resource Locator.

See https://musicbrainz.org/doc/URL

type URLFilter

type URLFilter struct {
	Resource string
	Includes []string
}

func (URLFilter) SetQuery

func (f URLFilter) SetQuery(r *resty.Request)

type Work

type Work struct {
	ID             MBID            `json:"id"`
	Score          int             `json:"score"`
	Title          string          `json:"title"`
	Disambiguation string          `json:"disambiguation"`
	Type           string          `json:"type"`
	TypeID         MBID            `json:"type-id"`
	Annotation     string          `json:"annotation"`
	Aliases        []Alias         `json:"aliases"`
	Relations      RelationList    `json:"relations"`
	ISWCs          []ISWC          `json:"iswcs"`
	Languages      []string        `json:"languages"`
	Attributes     []WorkAttribute `json:"attributes"`
	Rating         Rating          `json:"rating"`
	UserRating     Rating          `json:"user-rating"`
	Tags           []Tag           `json:"tags"`
	UserTags       []Tag           `json:"user-tags"`
	Genres         []Genre         `json:"genres"`
	UserGenres     []Genre         `json:"user-genres"`
}

In MusicBrainz terminology, a work is a distinct intellectual or artistic creation, which can be expressed in the form of one or more audio recordings.

While a work in MusicBrainz is usually musical in nature, it is not necessarily so. For example, a work could be a novel, play, poem or essay, later recorded as an oratory or audiobook.

See https://musicbrainz.org/doc/Work

type WorkAttribute

type WorkAttribute struct {
	Type    string `json:"type"`
	TypeID  MBID   `json:"type-id"`
	Value   string `json:"value"`
	ValueID MBID   `json:"value-id"`
}

type WorkCollection

type WorkCollection struct {
	Collection
	Count int    `json:"work-count"`
	Works []Work `json:"works"`
}

type WorkFilter

type WorkFilter struct {
	ArtistMBID     MBID
	CollectionMBID MBID
	Includes       []string
}

func (WorkFilter) SetQuery

func (f WorkFilter) SetQuery(r *resty.Request)

Jump to

Keyboard shortcuts

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