mbz

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

package mbz provides functions for interacting with the musicbrainz api

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReleaseGroupToTitles

func ReleaseGroupToTitles(rg *MusicBrainzReleaseGroup) []string

Types

type MbzErrorCaller

type MbzErrorCaller struct{}

func (*MbzErrorCaller) GetArtistPrimaryAliases

func (m *MbzErrorCaller) GetArtistPrimaryAliases(ctx context.Context, id uuid.UUID) ([]string, error)

func (*MbzErrorCaller) GetRelease

func (m *MbzErrorCaller) GetRelease(ctx context.Context, id uuid.UUID) (*MusicBrainzRelease, error)

func (*MbzErrorCaller) GetReleaseGroup

func (m *MbzErrorCaller) GetReleaseGroup(ctx context.Context, id uuid.UUID) (*MusicBrainzReleaseGroup, error)

func (*MbzErrorCaller) GetReleaseTitles

func (m *MbzErrorCaller) GetReleaseTitles(ctx context.Context, RGID uuid.UUID) ([]string, error)

func (*MbzErrorCaller) GetTrack

func (m *MbzErrorCaller) GetTrack(ctx context.Context, id uuid.UUID) (*MusicBrainzTrack, error)

func (*MbzErrorCaller) Shutdown

func (m *MbzErrorCaller) Shutdown()

type MbzMockCaller

type MbzMockCaller struct {
	Artists       map[uuid.UUID]*MusicBrainzArtist
	ReleaseGroups map[uuid.UUID]*MusicBrainzReleaseGroup
	Releases      map[uuid.UUID]*MusicBrainzRelease
	Tracks        map[uuid.UUID]*MusicBrainzTrack
}

func (*MbzMockCaller) GetArtistPrimaryAliases

func (m *MbzMockCaller) GetArtistPrimaryAliases(ctx context.Context, id uuid.UUID) ([]string, error)

func (*MbzMockCaller) GetRelease

func (m *MbzMockCaller) GetRelease(ctx context.Context, id uuid.UUID) (*MusicBrainzRelease, error)

func (*MbzMockCaller) GetReleaseGroup

func (m *MbzMockCaller) GetReleaseGroup(ctx context.Context, id uuid.UUID) (*MusicBrainzReleaseGroup, error)

func (*MbzMockCaller) GetReleaseTitles

func (m *MbzMockCaller) GetReleaseTitles(ctx context.Context, RGID uuid.UUID) ([]string, error)

func (*MbzMockCaller) GetTrack

func (m *MbzMockCaller) GetTrack(ctx context.Context, id uuid.UUID) (*MusicBrainzTrack, error)

func (*MbzMockCaller) Shutdown

func (m *MbzMockCaller) Shutdown()

type MusicBrainzArea

type MusicBrainzArea struct {
	Name           string   `json:"name"`
	Iso3166_1Codes []string `json:"iso-3166-1-codes"`
}

type MusicBrainzArtist

type MusicBrainzArtist struct {
	Name     string                   `json:"name"`
	SortName string                   `json:"sort_name"`
	Gender   string                   `json:"gender"`
	Area     MusicBrainzArea          `json:"area"`
	Aliases  []MusicBrainzArtistAlias `json:"aliases"`
}

type MusicBrainzArtistAlias

type MusicBrainzArtistAlias struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Primary bool   `json:"primary"`
}

type MusicBrainzArtistCredit

type MusicBrainzArtistCredit struct {
	Artist MusicBrainzArtist `json:"artist"`
	Name   string            `json:"name"`
}

type MusicBrainzCaller

type MusicBrainzCaller interface {
	GetArtistPrimaryAliases(ctx context.Context, id uuid.UUID) ([]string, error)
	GetReleaseTitles(ctx context.Context, RGID uuid.UUID) ([]string, error)
	GetTrack(ctx context.Context, id uuid.UUID) (*MusicBrainzTrack, error)
	GetReleaseGroup(ctx context.Context, id uuid.UUID) (*MusicBrainzReleaseGroup, error)
	GetRelease(ctx context.Context, id uuid.UUID) (*MusicBrainzRelease, error)
	Shutdown()
}

type MusicBrainzClient

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

func NewMusicBrainzClient

func NewMusicBrainzClient() *MusicBrainzClient

func (*MusicBrainzClient) GetArtistPrimaryAliases

func (c *MusicBrainzClient) GetArtistPrimaryAliases(ctx context.Context, id uuid.UUID) ([]string, error)

Returns the artist name at index 0, and all primary aliases after.

func (*MusicBrainzClient) GetLatinTitles

func (c *MusicBrainzClient) GetLatinTitles(ctx context.Context, id uuid.UUID) ([]string, error)

Searches for Pseudo-Releases of release groups with Latin script, and returns them as an array

func (*MusicBrainzClient) GetRelease

func (c *MusicBrainzClient) GetRelease(ctx context.Context, id uuid.UUID) (*MusicBrainzRelease, error)

func (*MusicBrainzClient) GetReleaseGroup

func (c *MusicBrainzClient) GetReleaseGroup(ctx context.Context, id uuid.UUID) (*MusicBrainzReleaseGroup, error)

func (*MusicBrainzClient) GetReleaseTitles

func (c *MusicBrainzClient) GetReleaseTitles(ctx context.Context, RGID uuid.UUID) ([]string, error)

func (*MusicBrainzClient) GetTrack

func (c *MusicBrainzClient) GetTrack(ctx context.Context, id uuid.UUID) (*MusicBrainzTrack, error)

Returns the artist name at index 0, and all primary aliases after.

func (*MusicBrainzClient) Shutdown

func (c *MusicBrainzClient) Shutdown()

type MusicBrainzRelease

type MusicBrainzRelease struct {
	Title              string                    `json:"title"`
	ID                 string                    `json:"id"`
	ArtistCredit       []MusicBrainzArtistCredit `json:"artist-credit"`
	Status             string                    `json:"status"`
	TextRepresentation TextRepresentation        `json:"text-representation"`
}

type MusicBrainzReleaseGroup

type MusicBrainzReleaseGroup struct {
	Title        string                    `json:"title"`
	Type         string                    `json:"primary_type"`
	ArtistCredit []MusicBrainzArtistCredit `json:"artist-credit"`
	Releases     []MusicBrainzRelease      `json:"releases"`
}

type MusicBrainzTrack

type MusicBrainzTrack struct {
	Title    string `json:"title"`
	LengthMs int    `json:"length"`
}

type TextRepresentation

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

Jump to

Keyboard shortcuts

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