catalog

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCatalogForType added in v0.2.1

func NewCatalogForType(catalogType catalog.CatalogType) (any, error)

func ReadFromStaging added in v0.2.1

func ReadFromStaging(catalogType catalog.CatalogType) (any, error)

func StagingPathForType added in v0.2.1

func StagingPathForType(catalogType catalog.CatalogType) string

func WriteToStaging added in v0.2.1

func WriteToStaging(catalog StagingCatalog) error

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

AlbumCatalog https://developer.amazon.com/en-US/docs/alexa/music-skills/catalog-reference.html#album

func CreateAlbumCatalog

func CreateAlbumCatalog() *AlbumCatalog

func (*AlbumCatalog) AddMetaData

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

func (*AlbumCatalog) CatalogType added in v0.2.1

func (ac *AlbumCatalog) CatalogType() catalog_.CatalogType

func (*AlbumCatalog) Validate added in v0.2.1

func (ac *AlbumCatalog) Validate() error

type AlbumEntity

type AlbumEntity struct {
	Id                string          `json:"id"`
	Names             []Name          `json:"names,omitempty"`
	Popularity        *Popularity     `json:"popularity,omitempty"`
	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,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 AlternateName

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

type ArtistCatalog

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

ArtistCatalog https://developer.amazon.com/en-US/docs/alexa/music-skills/catalog-reference.html#artist

func CreateArtistCatalog

func CreateArtistCatalog() *ArtistCatalog

func (*ArtistCatalog) AddMetaData

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

func (*ArtistCatalog) CatalogType added in v0.2.1

func (ac *ArtistCatalog) CatalogType() catalog_.CatalogType

func (*ArtistCatalog) Validate added in v0.2.1

func (ac *ArtistCatalog) Validate() error

type ArtistEntity

type ArtistEntity struct {
	Id                string          `json:"id"`
	Names             []Name          `json:"names,omitempty"`
	Popularity        *Popularity     `json:"popularity,omitempty"`
	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
	PlaylistCatalog *PlaylistCatalog
}

func New

func New() *Builder

func (*Builder) AddMetaData added in v0.2.1

func (b *Builder) AddMetaData(md MetaData, lastModified time.Time)

func (*Builder) ScanUserMusicFolder added in v0.2.1

func (b *Builder) ScanUserMusicFolder() error

func (*Builder) Walk

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

func (Header) TypeMatches added in v0.2.1

func (h Header) TypeMatches(other Header) bool

type HeaderType

type HeaderType string
const MusicAlbum HeaderType = "AMAZON.MusicAlbum"
const MusicGroup HeaderType = "AMAZON.MusicGroup"
const MusicPlaylist HeaderType = "AMAZON.MusicPlaylist"
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
	// Playlist is the playlist name
	Playlist() string
	// PlaylistID is the playlist id
	PlaylistID() string
	// Deleted indicates the entity has been removed from the catalog
	Deleted() bool
}

MetaData represents the musicbrainz data extracted from VORBIS_COMMENT

func DeletedMetaData added in v0.2.1

func DeletedMetaData(artistId, albumId, trackId, playlistId string) MetaData

func PlaylistMetadata added in v0.2.1

func PlaylistMetadata(playlistId, name string) MetaData

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 PlaylistCatalog added in v0.2.1

type PlaylistCatalog struct {
	Header
	Entities []*PlaylistEntity `json:"entities"`
}

PlaylistCatalog https://developer.amazon.com/en-US/docs/alexa/music-skills/catalog-reference.html#playlist

func CreatePlaylistCatalog added in v0.2.1

func CreatePlaylistCatalog() *PlaylistCatalog

func (*PlaylistCatalog) AddMetaData added in v0.2.1

func (pc *PlaylistCatalog) AddMetaData(md MetaData, lastUpdate time.Time)

func (*PlaylistCatalog) CatalogType added in v0.2.1

func (pc *PlaylistCatalog) CatalogType() catalog_.CatalogType

func (*PlaylistCatalog) Validate added in v0.2.1

func (pc *PlaylistCatalog) Validate() error

type PlaylistEntity added in v0.2.1

type PlaylistEntity 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"`
	// 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 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 StagingCatalog added in v0.2.1

type StagingCatalog interface {
	CatalogType() catalog.CatalogType
	Validate() error
}

type StaticMetaData added in v0.2.1

type StaticMetaData struct {
	ArtistValue     string
	ArtistIDValue   string
	AlbumValue      string
	AlbumIDValue    string
	TrackValue      string
	TrackIDValue    string
	PlaylistValue   string
	PlaylistIDValue string
	DeletedValue    bool
}

func (*StaticMetaData) Album added in v0.2.1

func (s *StaticMetaData) Album() string

func (*StaticMetaData) AlbumID added in v0.2.1

func (s *StaticMetaData) AlbumID() string

func (*StaticMetaData) Artist added in v0.2.1

func (s *StaticMetaData) Artist() string

func (*StaticMetaData) ArtistID added in v0.2.1

func (s *StaticMetaData) ArtistID() string

func (*StaticMetaData) Deleted added in v0.2.1

func (s *StaticMetaData) Deleted() bool

func (*StaticMetaData) Playlist added in v0.2.1

func (s *StaticMetaData) Playlist() string

func (*StaticMetaData) PlaylistID added in v0.2.1

func (s *StaticMetaData) PlaylistID() string

func (*StaticMetaData) Track added in v0.2.1

func (s *StaticMetaData) Track() string

func (*StaticMetaData) TrackID added in v0.2.1

func (s *StaticMetaData) TrackID() string

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

TrackCatalog https://developer.amazon.com/en-US/docs/alexa/music-skills/catalog-reference.html#track

func CreateTrackCatalog

func CreateTrackCatalog() *TrackCatalog

func (*TrackCatalog) AddMetaData

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

func (*TrackCatalog) CatalogType added in v0.2.1

func (tc *TrackCatalog) CatalogType() catalog_.CatalogType

func (*TrackCatalog) Validate added in v0.2.1

func (tc *TrackCatalog) Validate() error

type TrackEntity

type TrackEntity struct {
	Id                string          `json:"id"`
	Names             []Name          `json:"names,omitempty"`
	Popularity        *Popularity     `json:"popularity,omitempty"`
	LastUpdatedTime   JSONTime        `json:"lastUpdatedTime"`
	Locales           []Locale        `json:"locales,omitempty"`
	AlternateNames    []AlternateName `json:"alternateNames,omitempty"`
	LanguageOfContent []string        `json:"languageOfContent,omitempty"`
	Artists           []TrackArtist   `json:"artists,omitempty"`
	Albums            []TrackAlbum    `json:"albums,omitempty"`
	// 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