music

package
v0.0.0-...-96d688b Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2017 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AcousticID

type AcousticID struct {
	APIKey      string
	Fingerprint string
	Duration    string
}

AcousticID allows getting information about a track from its contents

func NewAcoustid

func NewAcoustid(key string) *AcousticID

NewAcoustid set up with api key

func (*AcousticID) CalculateFingerprint

func (a *AcousticID) CalculateFingerprint(path string) error

CalculateFingerprint for a given track

func (*AcousticID) LookUp

func (a *AcousticID) LookUp() (*AcoustidResults, error)

LookUp Acoustid database once we have the fingerprint

type AcoustidResults

type AcoustidResults struct {
	Results []struct {
		ID         string `json:"id"`
		Recordings []struct {
			Artists []struct {
				ID   string `json:"id"`
				Name string `json:"name"`
			} `json:"artists"`
			Duration int    `json:"duration"`
			ID       string `json:"id"`
			Releases []struct {
				Artists []struct {
					ID   string `json:"id"`
					Name string `json:"name"`
				} `json:"artists"`
				Country string `json:"country"`
				Date    struct {
					Day   int `json:"day"`
					Month int `json:"month"`
					Year  int `json:"year"`
				} `json:"date"`
				ID          string `json:"id"`
				MediumCount int    `json:"medium_count"`
				Mediums     []struct {
					Format     string `json:"format"`
					Position   int    `json:"position"`
					TrackCount int    `json:"track_count"`
					Tracks     []struct {
						Artists []struct {
							ID   string `json:"id"`
							Name string `json:"name"`
						} `json:"artists"`
						ID       string `json:"id"`
						Position int    `json:"position"`
						Title    string `json:"title"`
					} `json:"tracks"`
				} `json:"mediums"`
				Releaseevents []struct {
					Country string `json:"country"`
					Date    struct {
						Day   int `json:"day"`
						Month int `json:"month"`
						Year  int `json:"year"`
					} `json:"date"`
				} `json:"releaseevents"`
				Title      string `json:"title"`
				TrackCount int    `json:"track_count"`
			} `json:"releases"`
			Title string `json:"title"`
		} `json:"recordings"`
		Score float64 `json:"score"`
	} `json:"results"`
	Status string `json:"status"`
}

AcoustidResults is a struct describing the JSON response from Acoustid

type DiscogsRelease

type DiscogsRelease struct {
	CredentialsFile string
	Token           string
	Secret          string
	UserToken       string
	UserSecret      string
	Client          oauth.Client
	Info            DiscogsResults
}

DiscogsRelease retrieves information about a release on Discogs.

func NewDiscogsRelease

func NewDiscogsRelease(token, secret string) *DiscogsRelease

NewDiscogsRelease set up with Discogs API authorization info.

func (*DiscogsRelease) Authorize

func (d *DiscogsRelease) Authorize(ui u.UserInterface) error

Authorize with Discogs by OAuth

func (*DiscogsRelease) LookUp

func (d *DiscogsRelease) LookUp(artist, release string) error

LookUp release on Discogs and retrieve its information

type DiscogsResults

type DiscogsResults struct {
	Pagination struct {
		Items   int      `json:"items"`
		Page    int      `json:"page"`
		Pages   int      `json:"pages"`
		PerPage int      `json:"per_page"`
		Urls    struct{} `json:"urls"`
	} `json:"pagination"`
	Results []struct {
		Barcode   []string `json:"barcode"`
		Catno     string   `json:"catno"`
		Community struct {
			Have int `json:"have"`
			Want int `json:"want"`
		} `json:"community"`
		Country     string   `json:"country"`
		Format      []string `json:"format"`
		Genre       []string `json:"genre"`
		ID          int      `json:"id"`
		Label       []string `json:"label"`
		ResourceURL string   `json:"resource_url"`
		Style       []string `json:"style"`
		Thumb       string   `json:"thumb"`
		Title       string   `json:"title"`
		Type        string   `json:"type"`
		URI         string   `json:"uri"`
		Year        string   `json:"year"`
	} `json:"results"`
}

type MusicBrainzRelease

type MusicBrainzRelease struct {
	ID   string
	Info MusicBrainzReleaseResults
}

MusicBrainzRelease allows retrieving information from MusicBrainz

func NewMusicBrainzRelease

func NewMusicBrainzRelease(id string) *MusicBrainzRelease

NewMusicBrainzRelease set up with release ID

func (*MusicBrainzRelease) GetInfo

func (mb *MusicBrainzRelease) GetInfo() error

GetInfo from MusicBrainz about a release

type MusicBrainzReleaseResults

type MusicBrainzReleaseResults struct {
	ArtistCredit []struct {
		Artist struct {
			Disambiguation string `json:"disambiguation"`
			ID             string `json:"id"`
			Name           string `json:"name"`
			SortName       string `json:"sort-name"`
		} `json:"artist"`
		Joinphrase string `json:"joinphrase"`
		Name       string `json:"name"`
	} `json:"artist-credit"`
	Asin            string `json:"asin"`
	Barcode         string `json:"barcode"`
	Country         string `json:"country"`
	CoverArtArchive struct {
		Artwork  bool `json:"artwork"`
		Back     bool `json:"back"`
		Count    int  `json:"count"`
		Darkened bool `json:"darkened"`
		Front    bool `json:"front"`
	} `json:"cover-art-archive"`
	Date           string `json:"date"`
	Disambiguation string `json:"disambiguation"`
	ID             string `json:"id"`
	LabelInfo      []struct {
		CatalogNumber string `json:"catalog-number"`
		Label         struct {
			Disambiguation string      `json:"disambiguation"`
			ID             string      `json:"id"`
			LabelCode      interface{} `json:"label-code"`
			Name           string      `json:"name"`
			SortName       string      `json:"sort-name"`
		} `json:"label"`
	} `json:"label-info"`
	Packaging     string `json:"packaging"`
	PackagingID   string `json:"packaging-id"`
	Quality       string `json:"quality"`
	ReleaseEvents []struct {
		Area struct {
			Disambiguation string   `json:"disambiguation"`
			ID             string   `json:"id"`
			Iso31661Codes  []string `json:"iso-3166-1-codes"`
			Name           string   `json:"name"`
			SortName       string   `json:"sort-name"`
		} `json:"area"`
		Date string `json:"date"`
	} `json:"release-events"`
	Status             string `json:"status"`
	StatusID           string `json:"status-id"`
	TextRepresentation struct {
		Language string `json:"language"`
		Script   string `json:"script"`
	} `json:"text-representation"`
	Title string `json:"title"`
}

MusicBrainzReleaseResults is a struct describing the JSON response for a MusicBreinz query about a speficif release.

Jump to

Keyboard shortcuts

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