gomusicbrainz

package module
Version: v0.0.0-...-6c07e13 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: MIT Imports: 9 Imported by: 16

README

gomusicbrainz License MIT GoDoc GoWalker Build Status

a Go (Golang) MusicBrainz WS2 client library - a work in progress.

gopherbrainz Oo

Current state

Currently GoMusicBrainz provides methods to perform search and lookup requests. Browse requests are not supported yet.

Installation

$ go get github.com/michiwend/gomusicbrainz

Search Requests

GoMusicBrainz provides a search method for every WS2 search request in the form:

func (*WS2Client) Search<ENTITY>(searchTerm, limit, offset) (<ENTITY>SearchResponse, error)

searchTerm follows the Apache Lucene syntax and can either contain multiple fields with logical operators or just a simple search string. Please refer to lucene.apache.org for more details on the lucene syntax. In addition the [MusicBrainz website] (https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search) provides information about all possible query-fields.

Example

This example demonstrates a simple search requests to find the artist Parov Stelar. You can find it as a runnable go program in the samples folder.

// create a new WS2Client.
client := gomusicbrainz.NewWS2Client(
    "https://musicbrainz.org/ws/2",
    "A GoMusicBrainz example",
    "0.0.1-beta",
    "http://github.com/michiwend/gomusicbrainz")

// Search for some artist(s)
resp, _ := client.SearchArtist(`artist:"Parov Stelar"`, -1, -1)

// Pretty print Name and score of each returned artist.
for _, artist := range resp.Artists {
    fmt.Printf("Name: %-25sScore: %d\n", artist.Name, resp.Scores[artist])
}

the above code will produce the following output:

Name: Parov Stelar             Score: 100
Name: Parov Stelar Trio        Score: 80
Name: Parov Stelar & the Band  Score: 70

Lookup Requests

GoMusicBrainz provides two ways to perform lookup requests: Either the specific lookup method that is implemented for each entity that has a lookup endpoint in the form

func(*WS2Client) Lookup<ETITY>(id MBID, inc ...string) (*<ENTITY>, error)

or the common lookup method if you already have an entity (with MBID) that implements the MBLookupEntity interface:

func(*WS2Client) Lookup(entity MBLookupEntity, inc ...string) error
Example

The following example demonstrates the (specific) LookupArtist method. You can find it as a runnable go program in the samples folder.

// create a new WS2Client.
client, _ := gomusicbrainz.NewWS2Client(
    "https://musicbrainz.org/ws/2",
    "A GoMusicBrainz example",
    "0.0.1-beta",
    "http://github.com/michiwend/gomusicbrainz")

// Lookup artist by id.
artist, err := client.LookupArtist("9a709693-b4f8-4da9-8cc1-038c911a61be")

if err != nil {
    fmt.Println(err)
    return
}

fmt.Printf("%+v", artist)

Package Documentation

Full documentation for this package can be found at GoDoc and GoWalker

Documentation

Overview

Package gomusicbrainz implements a MusicBrainz WS2 client library.

MusicBrainz WS2 (Version 2 of the XML Web Service) supports three different requests:

Search requests

With search requests you can search MusicBrainz´ database for all entities. GoMusicBrainz implements one search method for every search request in the form:

func (*WS2Client) Search<ENTITY>(searchTerm, limit, offset) (<ENTITY>SearchResponse, error)

searchTerm follows the Apache Lucene syntax and can either contain multiple fields with logical operators or just a simple search string. Please refer to https://lucene.apache.org/core/4_3_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description for more details on the lucene syntax. limit defines how many entries should be returned (1-100, default 25). offset is used for paging through more than one page of results. To ignore limit and/or offset, set it to -1.

Lookup requests

You can perform a lookup of an entity when you have the MBID for that entity. GoMusicBrainz provides two ways to perform lookup requests: Either the specific lookup method that is implemented for each entity that has a lookup endpoint in the form

func(*WS2Client) Lookup<ETITY>(id MBID, inc ...string) (*<ENTITY>, error)

or the common lookup method if you already have an entity (with MBID) that implements the MBLookupEntity interface:

func(*WS2Client) Lookup(entity MBLookupEntity, inc ...string) error

With both methods you can include inc params which affect subqueries e.g. relationships. see http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#inc.3D_arguments_which_affect_subqueries Not all of them are supported yet.

Browse requets

not supported yet.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alias

type Alias struct {
	Name     string `xml:",chardata"`
	SortName string `xml:"sort-name,attr"`
	Locale   string `xml:"locale,attr"`
	Type     string `xml:"type,attr"`
	Primary  string `xml:"primary,attr"`
}

Alias is a type for aliases/misspellings of artists, works, areas, labels and places.

type Annotation

type Annotation struct {
	Type   string `xml:"type,attr"`
	Entity string `xml:"entity"`
	Name   string `xml:"name"`
	Text   string `xml:"text"`
}

Annotation is a miniature wiki that can be added to any existing artists, labels, recordings, releases, release groups and works. More informations at https://musicbrainz.org/doc/Annotation

type AnnotationSearchResponse

type AnnotationSearchResponse struct {
	WS2ListResponse
	Annotations []*Annotation
	Scores      ScoreMap
}

AnnotationSearchResponse is the response type returned by annotation request methods.

func (*AnnotationSearchResponse) ResultsWithScore

func (r *AnnotationSearchResponse) ResultsWithScore(score int) []*Annotation

ResultsWithScore returns a slice of Annotations with a min score.

type Area

type Area struct {
	ID            MBID           `xml:"id,attr"`
	Type          string         `xml:"type,attr"`
	Name          string         `xml:"name"`
	SortName      string         `xml:"sort-name"`
	ISO31662Codes []ISO31662Code `xml:"iso-3166-2-code-list>iso-3166-2-code"`
	Lifespan      Lifespan       `xml:"life-span"`
	Aliases       []Alias        `xml:"alias-list>alias"`
}

Area represents a geographic region or settlement.

func (*Area) Id

func (mbe *Area) Id() MBID

type AreaSearchResponse

type AreaSearchResponse struct {
	WS2ListResponse
	Areas  []*Area
	Scores ScoreMap
}

AreaSearchResponse is the response type returned by the SearchArea method.

func (*AreaSearchResponse) ResultsWithScore

func (r *AreaSearchResponse) ResultsWithScore(score int) []*Area

ResultsWithScore returns a slice of Areas with a min score.

type Artist

type Artist struct {
	ID             MBID               `xml:"id,attr"`
	Type           string             `xml:"type,attr"`
	Name           string             `xml:"name"`
	Disambiguation string             `xml:"disambiguation"`
	SortName       string             `xml:"sort-name"`
	CountryCode    string             `xml:"country"`
	Gender         string             `xml:"gender"`
	Lifespan       Lifespan           `xml:"life-span"`
	Area           Area               `xml:"area"`
	BeginArea      Area               `xml:"begin-area"`
	Aliases        []*Alias           `xml:"alias-list>alias"`
	Tags           []Tag              `xml:"tag-list>tag"`
	Relations      TargetRelationsMap `xml:"relation-list"`
}

Artist represents generally a musician, a group of musicians, a collaboration of multiple musicians or other music professionals.

func (*Artist) Id

func (mbe *Artist) Id() MBID

type ArtistCredit

type ArtistCredit struct {
	NameCredits []NameCredit `xml:"name-credit"`
}

ArtistCredit is either used to link multiple artists to one release/recording or to credit an artist with a different name. Visist https://musicbrainz.org/doc/Artist_Credit for more information.

type ArtistRelation

type ArtistRelation struct {
	RelationAbstract
	Artist Artist `xml:"artist"`
}

ArtistRelation is the Relation type for Artists.

type ArtistSearchResponse

type ArtistSearchResponse struct {
	WS2ListResponse
	Artists []*Artist
	Scores  ScoreMap
}

ArtistSearchResponse is the response type returned by the SearchArtist method.

func (*ArtistSearchResponse) ResultsWithScore

func (r *ArtistSearchResponse) ResultsWithScore(score int) []*Artist

ResultsWithScore returns a slice of Artists with a min score.

type BrainzTime

type BrainzTime struct {
	time.Time
	Accuracy BrainzTimeAccuracy
}

BrainzTime represents a MusicBrainz date by combining time.Time with a Accuracy field to distinguish between different date accuracies e.g. "2006" and "2006-01".

You can compare the accuracy of a BrainzTime type simply by using operators:

// time1 represents "2006-01"
// time2 represents "2006"

time1.Accuracy > time2.Accuray // true

func (*BrainzTime) UnmarshalXML

func (t *BrainzTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type BrainzTimeAccuracy

type BrainzTimeAccuracy int

BrainzTimeAccuracy specifies the accuracy for the corresponding BrainzTime.

const (
	Year BrainzTimeAccuracy = iota
	Month
	Day
)

type CDStub

type CDStub struct {
	ID        string `xml:"id,attr"` // seems not to be a valid MBID (UUID)
	Title     string `xml:"title"`
	Artist    string `xml:"artist"`
	Barcode   string `xml:"barcode"`
	Comment   string `xml:"comment"`
	TrackList struct {
		Count int `xml:"count,attr"`
	} `xml:"track-list"`
}

CDStub represents an anonymously submitted track list.

type CDStubSearchResponse

type CDStubSearchResponse struct {
	WS2ListResponse
	CDStubs []*CDStub
	Scores  ScoreMap
}

CDStubSearchResponse is the response type returned by the SearchCDStub method.

func (*CDStubSearchResponse) ResultsWithScore

func (r *CDStubSearchResponse) ResultsWithScore(score int) []*CDStub

ResultsWithScore returns a slice of CDStubs with a min score.

type Freedb

type Freedb struct {
}

type FreedbSearchResponse

type FreedbSearchResponse struct {
}

type ISO31662Code

type ISO31662Code string

type Label

type Label struct {
	ID             MBID     `xml:"id,attr"`
	Name           string   `xml:"name"`
	Type           string   `xml:"type,attr"`
	SortName       string   `xml:"sort-name"`
	Disambiguation string   `xml:"disambiguation"`
	CountryCode    string   `xml:"country"`
	Area           Area     `xml:"area"`
	LabelCode      int      `xml:"label-code"`
	Lifespan       Lifespan `xml:"life-span"`
	Aliases        []*Alias `xml:"alias-list>alias"`
}

Label represents an imprint, a record company or a music group. Labels refer mainly to imprints in MusicBrainz. Visit https://musicbrainz.org/doc/Label for more information.

func (*Label) Id

func (mbe *Label) Id() MBID

type LabelInfo

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

LabelInfo contains a label and links it to a catalog number.

type LabelSearchResponse

type LabelSearchResponse struct {
	WS2ListResponse
	Labels []*Label
	Scores ScoreMap
}

LabelSearchResponse is the response type returned by the SearchLabel method.

func (*LabelSearchResponse) ResultsWithScore

func (r *LabelSearchResponse) ResultsWithScore(score int) []*Label

ResultsWithScore returns a slice of Labels with a min score.

type Lifespan

type Lifespan struct {
	Begin BrainzTime `xml:"begin"`
	End   BrainzTime `xml:"end"`
	Ended bool       `xml:"ended"`
}

Lifespan represents either the life span of a natural person or more generally the period of time in which an entity e.g. a Label existed.

type MBCoordinates

type MBCoordinates struct {
	Lat string `xml:"latitude"`
	Lng string `xml:"longitude"`
}

MBCoordinates represents a tuple of latitude,longitude values.

type MBEntity

type MBEntity interface {
	Id() MBID
	// contains filtered or unexported methods
}

MBentity is an interface implemented by all MusicBrainz entities with MBIDs.

type MBID

type MBID string

MBID represents a MusicBrainz Identifier. A MBID is a 36 character Universally Unique Identifier that is permanently assigned to each entity in the database, i.e. artists, release groups, releases, recordings, works, labels, areas, places and URLs.

type MBLookupEntity

type MBLookupEntity interface {
	MBEntity
	// contains filtered or unexported methods
}

MBLookupEntity represents all MusicBrainz entities for which a MBID-lookup request is provided by WS2.

type Medium

type Medium struct {
	Format   string `xml:"format"`
	Position int    `xml:"position"`
	//DiscList TODO implement type
	Tracks []*Track `xml:"track-list>track"`
}

Medium represents one of the physical, separate things you would get when you buy something in a record store e.g. CDs, vinyls, etc. Mediums are always included in a release. For more information visit https://musicbrainz.org/doc/Medium

type NameCredit

type NameCredit struct {
	Artist Artist `xml:"artist"`
}

type Place

type Place struct {
	ID          MBID          `xml:"id,attr"`
	Type        string        `xml:"type,attr"`
	Name        string        `xml:"name"`
	Address     string        `xml:"address"`
	Coordinates MBCoordinates `xml:"coordinates"`
	Area        Area          `xml:"area"`
	Lifespan    Lifespan      `xml:"life-span"`
	Aliases     []*Alias      `xml:"alias-list>alias"`
}

Place represents a building or outdoor area used for performing or producing music.

func (*Place) Id

func (mbe *Place) Id() MBID

type PlaceSearchResponse

type PlaceSearchResponse struct {
	WS2ListResponse
	Places []*Place
	Scores ScoreMap
}

PlaceSearchResponse is the response type returned by the SearchPlace method.

func (*PlaceSearchResponse) ResultsWithScore

func (r *PlaceSearchResponse) ResultsWithScore(score int) []*Place

ResultsWithScore returns a slice of Places with a min score.

type Recording

type Recording struct {
	ID             MBID         `xml:"id,attr"`
	Title          string       `xml:"title"`
	Length         int          `xml:"length"`
	Disambiguation string       `xml:"disambiguation"`
	ArtistCredit   ArtistCredit `xml:"artist-credit"`
}

func (*Recording) Id

func (mbe *Recording) Id() MBID

type RecordingSearchResponse

type RecordingSearchResponse struct {
	WS2ListResponse
	Recordings []*Recording
	Scores     ScoreMap
}

RecordingSearchResponse is the response type returned by the SearchRecording method.

func (*RecordingSearchResponse) ResultsWithScore

func (r *RecordingSearchResponse) ResultsWithScore(score int) []*Recording

ResultsWithScore returns a slice of Recordings with a min score.

type Relation

type Relation interface {
	TypeOf() string
}

Relation describes a relationship between different MusicBrainz entities. See this link https://musicbrainz.org/relationships for a table of relationships.

func RelationsOfTypes

func RelationsOfTypes(rels []Relation, relTypes ...string) []Relation

RelationsOfTypes returns a slice of Relations for the given relTypes. For a list of all possible relationships see https://musicbrainz.org/relationships

type RelationAbstract

type RelationAbstract struct {
	Type        string     `xml:"type,attr"`
	TypeID      MBID       `xml:"type-id,attr"`
	Target      string     `xml:"target"`
	TargetID    MBID       `xml:"target-id,attr"`
	OrderingKey int        `xml:"ordering-key"`
	Direction   string     `xml:"direction"`
	Begin       BrainzTime `xml:"begin"`
	End         BrainzTime `xml:"end"`
	Ended       bool       `xml:"ended"`
}

RelationAbstract is the common abstract type for Relations.

func (*RelationAbstract) TypeOf

func (r *RelationAbstract) TypeOf() string

type Release

type Release struct {
	ID                 MBID               `xml:"id,attr"`
	Title              string             `xml:"title"`
	Status             string             `xml:"status"`
	Disambiguation     string             `xml:"disambiguation"`
	TextRepresentation TextRepresentation `xml:"text-representation"`
	ArtistCredit       ArtistCredit       `xml:"artist-credit"`
	ReleaseGroup       ReleaseGroup       `xml:"release-group"`
	Date               BrainzTime         `xml:"date"`
	CountryCode        string             `xml:"country"`
	Barcode            string             `xml:"barcode"`
	Asin               string             `xml:"asin"`
	Quality            string             `xml:"quality"`
	LabelInfos         []LabelInfo        `xml:"label-info-list>label-info"`
	Mediums            []*Medium          `xml:"medium-list>medium"`
	Relations          TargetRelationsMap `xml:"relation-list"`
}

Release represents a unique release (i.e. issuing) of a product on a specific date with specific release information such as the country, label, barcode, packaging, etc. More information at https://musicbrainz.org/doc/Release

func OriginalRelease

func OriginalRelease(releases []*Release) *Release

OriginalRelease is a helper function that returns the earliest release of a release array with the most accurate date. It can be used to determine the original/first release from releases of a release group.

func (*Release) Id

func (mbe *Release) Id() MBID

type ReleaseGroup

type ReleaseGroup struct {
	ID               MBID         `xml:"id,attr"`
	Type             string       `xml:"type,attr"`
	PrimaryType      string       `xml:"primary-type"`
	Title            string       `xml:"title"`
	FirstReleaseDate BrainzTime   `xml:"first-release-date"`
	ArtistCredit     ArtistCredit `xml:"artist-credit"`
	Releases         []*Release   `xml:"release-list>release"` // FIXME if important unmarshal count,attr
	Tags             []*Tag       `xml:"tag-list>tag"`
}

ReleaseGroup groups several different releases into a single logical entity. Every release belongs to one, and only one release group. More informations at https://musicbrainz.org/doc/Release_Group

func (*ReleaseGroup) Id

func (mbe *ReleaseGroup) Id() MBID

type ReleaseGroupSearchResponse

type ReleaseGroupSearchResponse struct {
	WS2ListResponse
	ReleaseGroups []*ReleaseGroup
	Scores        ScoreMap
}

ReleaseGroupSearchResponse is the response type returned by release group request methods.

func (*ReleaseGroupSearchResponse) ResultsWithScore

func (r *ReleaseGroupSearchResponse) ResultsWithScore(score int) []*ReleaseGroup

ResultsWithScore returns a slice of ReleaseGroups with a min score.

type ReleaseRelation

type ReleaseRelation struct {
	RelationAbstract
	Release Release `xml:"release"`
}

ReleaseRelation is the Relation type for Releases.

type ReleaseSearchResponse

type ReleaseSearchResponse struct {
	WS2ListResponse
	Releases []*Release
	Scores   ScoreMap
}

ReleaseSearchResponse is the response type returned by the SearchRelease method.

func (*ReleaseSearchResponse) ResultsWithScore

func (r *ReleaseSearchResponse) ResultsWithScore(score int) []*Release

ResultsWithScore returns a slice of Releases with a min score.

type ScoreMap

type ScoreMap map[interface{}]int

ScoreMap maps addresses of search request results to its scores.

type Tag

type Tag struct {
	Count int    `xml:"count,attr"`
	Name  string `xml:"name"`
}

Tag is the common type for Tags.

type TargetRelationsMap

type TargetRelationsMap map[string][]Relation

TargetRelationsMap maps target-types to Relations.

func (*TargetRelationsMap) UnmarshalXML

func (r *TargetRelationsMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML is needed to implement XMLUnmarshaler for custom, value-based unmarshaling of relation-list elements.

type TextRepresentation

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

type Track

type Track struct {
	ID        MBID      `xml:"id,attr"`
	Position  int       `xml:"position"`
	Number    string    `xml:"number"`
	Length    int       `xml:"length"`
	Recording Recording `xml:"recording"`
}

Track represents a recording on a particular release (or, more exactly, on a particular medium). See https://musicbrainz.org/doc/Track

type URLRelation

type URLRelation struct {
	RelationAbstract
}

type WS2Client

type WS2Client struct {
	WS2RootURL *url.URL // The API root URL
	// contains filtered or unexported fields
}

WS2Client defines a Go client for the MusicBrainz Web Service 2.

func NewWS2Client

func NewWS2Client(wsurl, appname, version, contact string) (*WS2Client, error)

NewWS2Client returns a new instance of WS2Client. Please provide meaningful information about your application as described at https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting#Provide_meaningful_User-Agent_strings

func (*WS2Client) Lookup

func (c *WS2Client) Lookup(entity MBLookupEntity, inc ...string) error

Lookup performs a WS2 lookup request for the given entity (e.g. Artist, Label, ...)

func (*WS2Client) LookupArea

func (c *WS2Client) LookupArea(id MBID, inc ...string) (*Area, error)

LookupArea performs an area lookup request for the given MBID.

func (*WS2Client) LookupArtist

func (c *WS2Client) LookupArtist(id MBID, inc ...string) (*Artist, error)

LookupArtist performs an artist lookup request for the given MBID.

func (*WS2Client) LookupLabel

func (c *WS2Client) LookupLabel(id MBID, inc ...string) (*Label, error)

LookupLabel performs a label lookup request for the given MBID.

func (*WS2Client) LookupPlace

func (c *WS2Client) LookupPlace(id MBID, inc ...string) (*Place, error)

LookupPlace performs a place lookup request for the given MBID.

func (*WS2Client) LookupRecording

func (c *WS2Client) LookupRecording(id MBID, inc ...string) (*Recording, error)

LookupRecording performs an recording lookup request for the given MBID.

func (*WS2Client) LookupRelease

func (c *WS2Client) LookupRelease(id MBID, inc ...string) (*Release, error)

LookupRelease performs a release lookup request for the given MBID.

func (*WS2Client) LookupReleaseGroup

func (c *WS2Client) LookupReleaseGroup(id MBID, inc ...string) (*ReleaseGroup, error)

LookupReleaseGroup performs a release-group lookup request for the given MBID.

func (*WS2Client) SearchAnnotation

func (c *WS2Client) SearchAnnotation(searchTerm string, limit, offset int) (*AnnotationSearchResponse, error)

SearchAnnotation queries MusicBrainz´ Search Server for Annotations.

Possible search fields to provide in searchTerm are:

text    The content of the annotation
type    The entity type (artist, releasegroup, release, recording, work, label)
name    The name of the entity
entity  The entity's MBID

For more information visit http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#Annotation

func (*WS2Client) SearchArea

func (c *WS2Client) SearchArea(searchTerm string, limit, offset int) (*AreaSearchResponse, error)

SearchArea queries MusicBrainz´ Search Server for Areas.

Possible search fields to provide in searchTerm are:

aid       the area ID
alias     the aliases/misspellings for this area
area      area name
begin     area begin date
comment   disambugation comment
end 	  area end date
ended 	  area ended
sortname  area sort name
iso       area iso1, iso2 or iso3 codes
iso1      area iso1 codes
iso2      area iso3 codes
iso3      area iso3 codes
type      the aliases/misspellings for this label

With no fields specified searchTerm searches the area and sortname fields. For more information visit http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#Area

func (*WS2Client) SearchArtist

func (c *WS2Client) SearchArtist(searchTerm string, limit, offset int) (*ArtistSearchResponse, error)

SearchArtist queries MusicBrainz´ Search Server for Artists.

Possible search fields to provide in searchTerm are:

area          artist area
beginarea     artist begin area
endarea       artist end area
arid          MBID of the artist
artist        name of the artist
artistaccent  name of the artist with any accent characters retained
alias         the aliases/misspellings for the artist
begin         artist birth date/band founding date
comment       artist comment to differentiate similar artists
country       the two letter country code for the artist country or 'unknown'
end           artist death date/band dissolution date
ended         true if know ended even if do not know end date
gender        gender of the artist (“male”, “female”, “other”)
ipi           IPI code for the artist
sortname      artist sortname
tag           a tag applied to the artist
type          artist type (“person”, “group”, "other" or “unknown”)

With no fields specified searchTerm searches the artist, sortname and alias fields. For more information visit http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#Artist

func (*WS2Client) SearchCDStub

func (c *WS2Client) SearchCDStub(searchTerm string, limit, offset int) (*CDStubSearchResponse, error)

SearchCDStub queries MusicBrainz´ Search Server for CDStubs.

Possible search fields to provide in searchTerm are:

artist   artist name
title    release name
barcode  release barcode
comment  general comments about the release
tracks   number of tracks on the CD stub
discid   disc ID of the CD

With no fields specified searchTerm searches only the artist Field. For more information visit https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#CDStubs

func (*WS2Client) SearchFreedb

func (c *WS2Client) SearchFreedb(searchTerm string, limit, offset int) (*FreedbSearchResponse, error)

func (*WS2Client) SearchLabel

func (c *WS2Client) SearchLabel(searchTerm string, limit, offset int) (*LabelSearchResponse, error)

SearchLabel queries MusicBrainz´ Search Server for Labels.

Possible search fields to provide in searchTerm are:

alias        the aliases/misspellings for this label
area         label area
begin        label founding date
code         label code (only the figures part, i.e. without "LC")
comment      label comment to differentiate similar labels
country      The two letter country code of the label country
end          label dissolution date
ended        true if know ended even if do not know end date
ipi          ipi
label        label name
labelaccent  name of the label with any accent characters retained
laid         MBID of the label
sortname     label sortname
type         label type
tag          folksonomy tag

With no fields specified searchTerm searches the label, sortname and alias fields. For more information visit https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#Label

func (*WS2Client) SearchPlace

func (c *WS2Client) SearchPlace(searchTerm string, limit, offset int) (*PlaceSearchResponse, error)

SearchPlace queries MusicBrainz´ Search Server for Places.

Possible search fields to provide in searchTerm are:

pid       the place ID
address   the address of this place
alias     the aliases/misspellings for this area
area      area name
begin     place begin date
comment   disambiguation comment
end       place end date
ended     place ended
lat       place latitude
long      place longitude
sortname  place sort name
type      the aliases/misspellings for this place

With no fields specified searchTerm searches the place, alias, address and area fields. For more information visit https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#Place

func (*WS2Client) SearchRecording

func (c *WS2Client) SearchRecording(searchTerm string, limit, offset int) (*RecordingSearchResponse, error)

SearchRecording queries MusicBrainz´ Search Server for Recordings.

Possible search fields to provide in searchTerm are:

arid             artist id
artist           artist name is name(s) as it appears on the recording
artistname       an artist on the recording, each artist added as a separate field
creditname       name credit on the recording, each artist added as a separate field
comment          recording disambiguation comment
country          recording release country
date             recording release date
dur              duration of track in milliseconds
format           recording release format
isrc             ISRC of recording
number           free text track number
position         the medium that the recording should be found on, first medium is position 1
primarytype      primary type of the release group (album, single, ep, other)
puid             PUID of recording
qdur             quantized duration (duration / 2000)
recording        name of recording or a track associated with the recording
recordingaccent  name of the recording with any accent characters retained
reid             release id
release          release name
rgid             release group id
rid              recording id
secondarytype    secondary type of the release group (audiobook, compilation, interview, live, remix soundtrack, spokenword)
status           Release status (official, promotion, Bootleg, Pseudo-Release)
tid              track id
tnum             track number on medium
tracks           number of tracks in the medium on release
tracksrelease    number of tracks on release as a whole
tag              folksonomy tag
type             type of the release group, old type mapping for when we did not have separate primary and secondary types or use standalone for standalone recordings
video            true to only show video tracks

With no fields specified searchTerm searches the recording field only. For more information visit http://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#Recording

func (*WS2Client) SearchRelease

func (c *WS2Client) SearchRelease(searchTerm string, limit, offset int) (*ReleaseSearchResponse, error)

SearchRelease queries MusicBrainz´ Search Server for Releases.

Possible search fields to provide in searchTerm are:

arid           artist id
artist         complete artist name(s) as it appears on the release
artistname     an artist on the release, each artist added as a separate field
asin           the Amazon ASIN for this release
barcode        The barcode of this release
catno          The catalog number for this release, can have multiples when major using an imprint
comment        Disambiguation comment
country        The two letter country code for the release country
creditname     name credit on the release, each artist added as a separate field
date           The release date (format: YYYY-MM-DD)
discids        total number of cd ids over all mediums for the release
discidsmedium  number of cd ids for the release on a medium in the release
format         release format
laid           The label id for this release, a release can have multiples when major using an imprint
label          The name of the label for this release, can have multiples when major using an imprint
lang           The language for this release. Use the three character ISO 639 codes to search for a specific language. (e.g. lang:eng)
mediums        number of mediums in the release
primarytype    primary type of the release group (album, single, ep, other)
puid           The release contains recordings with these puids
quality        The quality of the release (low, normal, high)
reid           release id
release        release name
releaseaccent  name of the release with any accent characters retained
rgid           release group id
script         The 4 character script code (e.g. latn) used for this release
secondarytype  secondary type of the release group (audiobook, compilation, interview, live, remix, soundtrack, spokenword)
status         release status (e.g official)
tag            a tag that appears on the release
tracks         total number of tracks over all mediums on the release
tracksmedium   number of tracks on a medium in the release
type           type of the release group, old type mapping for when we did not have separate primary and secondary types

With no fields specified searchTerm searches the release field only. For more information visit https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#Release

func (*WS2Client) SearchReleaseGroup

func (c *WS2Client) SearchReleaseGroup(searchTerm string, limit, offset int) (*ReleaseGroupSearchResponse, error)

SearchReleaseGroup queries MusicBrainz´ Search Server for ReleaseGroups.

Possible search fields to provide in searchTerm are:

arid                MBID of the release group’s artist
artist              release group artist as it appears on the cover (Artist Credit)
artistname          “real name” of any artist that is included in the release group’s artist credit
comment             release group comment to differentiate similar release groups
creditname          name of any artist in multi-artist credits, as it appears on the cover.
primarytype         primary type of the release group (album, single, ep, other)
rgid                MBID of the release group
releasegroup        name of the release group
releasegroupaccent  name of the releasegroup with any accent characters retained
releases            number of releases in this release group
release             name of a release that appears in the release group
reid                MBID of a release that appears in the release group
secondarytype       secondary type of the release group (audiobook, compilation, interview, live, remix soundtrack, spokenword)
status              status of a release that appears within the release group
tag                 a tag that appears on the release group
type                type of the release group, old type mapping for when we did not have separate primary and secondary types

With no fields specified searchTerm searches the releasgroup field only. For more information visit https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search#Release_Group

func (*WS2Client) SearchWork

func (c *WS2Client) SearchWork(searchTerm string, limit, offset int) (*WorkSearchResponse, error)

type WS2ListResponse

type WS2ListResponse struct {
	Count  int `xml:"count,attr"`
	Offset int `xml:"offset,attr"`
}

WS2ListResponse is a abstract common type that provides the Count and Offset fields for ervery list response.

type Work

type Work struct {
}

type WorkSearchResponse

type WorkSearchResponse struct {
}

Directories

Path Synopsis
samples

Jump to

Keyboard shortcuts

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