catalog

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlbumArtist

type AlbumArtist struct {
	Id             string          `json:"id"`
	Names          []Name          `json:"names"`
	AlternateNames []AlternateName `json:"alternateNames,omitempty"`
}

type AlbumCatalog

type AlbumCatalog struct {
	Header
	Entities []*AlbumEntity `json:"entities"`
}

func CreateAlbumCatalog

func CreateAlbumCatalog() *AlbumCatalog

func (*AlbumCatalog) AddMetaData

func (ac *AlbumCatalog) AddMetaData(md MetaData, lastUpdate time.Time)

type AlbumEntity

type AlbumEntity struct {
	Id                string          `json:"id"`
	Names             []Name          `json:"names"`
	Popularity        Popularity      `json:"popularity"`
	LastUpdatedTime   JSONTime        `json:"lastUpdatedTime"`
	Locales           []Locale        `json:"locales,omitempty"`
	AlternateNames    []AlternateName `json:"alternateNames,omitempty"`
	LanguageOfContent []string        `json:"languageOfContent,omitempty"`
	ReleaseType       string          `json:"releaseType,omitempty"`
	Artists           []*AlbumArtist  `json:"artists"`
}

type AlternateName

type AlternateName struct {
	Language string   `json:"language"`
	Values   []string `json:"values"`
}

type ArtistCatalog

type ArtistCatalog struct {
	Header
	Entities []ArtistEntity `json:"entities"`
}

func CreateArtistCatalog

func CreateArtistCatalog() *ArtistCatalog

func (*ArtistCatalog) AddMetaData

func (ac *ArtistCatalog) AddMetaData(md MetaData, lastUpdate time.Time)

type ArtistEntity

type ArtistEntity struct {
	Id                string          `json:"id"`
	Names             []Name          `json:"names"`
	Popularity        Popularity      `json:"popularity"`
	LastUpdatedTime   JSONTime        `json:"lastUpdatedTime"`
	Locales           []Locale        `json:"locales,omitempty"`
	AlternateNames    []AlternateName `json:"alternateNames,omitempty"`
	LanguageOfContent []string        `json:"languageOfContent,omitempty"`
	// Deleted must be nil ( not deleted ) or a pointer to true.
	//  deleted=false is not valid according to the catalog upload api
	Deleted *bool `json:"deleted,omitempty"`
}

type Builder

type Builder struct {
	ArtistCatalog *ArtistCatalog
	AlbumCatalog  *AlbumCatalog
	TrackCatalog  *TrackCatalog
}

func New

func New() *Builder

func (*Builder) Walk

func (b *Builder) Walk(dir string) error
type Header struct {
	Type    string   `json:"type"`
	Version float64  `json:"version"`
	Locales []Locale `json:"locales"`
}

type HeaderType

type HeaderType string
const MusicAlbum HeaderType = "AMAZON.MusicAlbum"
const MusicGroup HeaderType = "AMAZON.MusicGroup"
const MusicRecording HeaderType = "AMAZON.MusicRecording"

type JSONTime

type JSONTime time.Time

func (*JSONTime) MarshalJSON

func (jt *JSONTime) MarshalJSON() ([]byte, error)

func (*JSONTime) String

func (jt *JSONTime) String() string

func (*JSONTime) UnmarshalJSON

func (jt *JSONTime) UnmarshalJSON(bytes []byte) (err error)

type Locale

type Locale struct {
	Country  string `json:"country"`
	Language string `json:"language"`
}

func DefaultLocales

func DefaultLocales() []Locale

type MetaData

type MetaData interface {
	// Artist is the tag data ARTIST
	Artist() string
	// ArtistID is the tag data MUSICBRAINZ_ARTISTID
	ArtistID() string
	// Album is the tag data ALBUM
	Album() string
	// AlbumID is the tag data MUSICBRAINZ_ALBUMID
	AlbumID() string
	// Track is the tag data TITLE
	Track() string
	// TrackID is the tag data MUSICBRAINZ_TRACKID
	TrackID() string
}

MetaData represents the musicbrainz data extracted from VORBIS_COMMENT

type MetaDataReceiver

type MetaDataReceiver interface {
	AddMetaData(metaData MetaData, lastUpdate time.Time)
}

type Name

type Name struct {
	Language string `json:"language"`
	Value    string `json:"value"`
}

type Popularity

type Popularity struct {
	Default   float64              `json:"default"`
	Overrides []PopularityOverride `json:"overrides,omitempty"`
}

type PopularityOverride

type PopularityOverride struct {
	Locale Locale  `json:"locale"`
	Value  float64 `json:"value"`
}

type TrackAlbum

type TrackAlbum struct {
	Id             string          `json:"id"`
	Names          []Name          `json:"names"`
	AlternateNames []AlternateName `json:"alternateNames,omitempty"`
	ReleaseType    string          `json:"releaseType,omitempty"`
}

type TrackArtist

type TrackArtist struct {
	Id             string          `json:"id"`
	Names          []Name          `json:"names"`
	AlternateNames []AlternateName `json:"alternateNames,omitempty"`
}

type TrackCatalog

type TrackCatalog struct {
	Header
	Entities []TrackEntity `json:"entities"`
}

func CreateTrackCatalog

func CreateTrackCatalog() *TrackCatalog

func (*TrackCatalog) AddMetaData

func (tc *TrackCatalog) AddMetaData(md MetaData, lastUpdate time.Time)

type TrackEntity

type TrackEntity struct {
	Id                string          `json:"id"`
	Names             []Name          `json:"names"`
	Popularity        Popularity      `json:"popularity"`
	LastUpdatedTime   JSONTime        `json:"lastUpdatedTime"`
	Locales           []Locale        `json:"locales,omitempty"`
	AlternateNames    []AlternateName `json:"alternateNames,omitempty"`
	LanguageOfContent []string        `json:"languageOfContent,omitempty"`
	Artists           []TrackArtist   `json:"artists"`
	Albums            []TrackAlbum    `json:"albums"`
	// Deleted must be a pointer to a true boolean or nil, never a pointer to a true boolean
	// This is a restriction of the api
	Deleted *bool `json:"deleted,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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