caa

package module
v0.0.0-...-8dc0fb0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2018 License: MIT Imports: 10 Imported by: 6

README

gocaa

Build Status GoDoc

This package contains a library to access the Cover Art Archive from Go.

Installation

To get the latest stable version, use

go get gopkg.in/mineo/gocaa.v1

and import it with

import "gopkg.in/mineo/gocaa.v1"

To get the latest version, use

go get github.com/mineo/gocaa

and import it with

import "github.com/mineo/gocaa"

Documentation

Overview

Package caa provides access to the Cover Art Archive (https://coverartarchive.org)

Index

Constants

View Source
const (
	// 250px
	ImageSizeSmall = iota
	// 500px
	ImageSizeLarge
	ImageSizeOriginal
	// 250px
	ImageSize250 = ImageSizeSmall
	// 500px
	ImageSize500 = ImageSizeLarge
	// 1200px
	ImageSize1200
)

These constants can be used to indicate the required image size to the various image retrieval methods

Variables

This section is empty.

Functions

func StringToUUID

func StringToUUID(str string) (uuid u.UUID)

StringToUUID is a reexported helper function of the UUID module to parse a string into a UUID.

Types

type CAAClient

type CAAClient struct {
	BaseURL string
	// contains filtered or unexported fields
}

CAAClient manages the communication with the Cover Art Archive.

func NewCAAClient

func NewCAAClient(useragent string) (c *CAAClient)

NewCAAClient returns a new CAAClient that uses the User-Agent useragent

func (*CAAClient) GetReleaseBack

func (c *CAAClient) GetReleaseBack(mbid uuid.UUID, size int) (image CoverArtImage, err error)

GetReleaseBack retrieves the back image of the release with the MBID mbid in the specified size

func (*CAAClient) GetReleaseFront

func (c *CAAClient) GetReleaseFront(mbid uuid.UUID, size int) (image CoverArtImage, err error)

GetReleaseFront retrieves the front image of the release with the MBID mbid in the specified size

func (*CAAClient) GetReleaseGroupFront

func (c *CAAClient) GetReleaseGroupFront(mbid uuid.UUID, size int) (image CoverArtImage, err error)

GetReleaseGroupFront retrieves the front image of the release group with the MBID mbid in the specified size

func (*CAAClient) GetReleaseGroupInfo

func (c *CAAClient) GetReleaseGroupInfo(mbid uuid.UUID) (info *CoverArtInfo, err error)

GetReleaseGroupInfo retrieves information about the images in the Cover Art Archive for the release group with the MBID mbid

func (*CAAClient) GetReleaseImage

func (c *CAAClient) GetReleaseImage(mbid uuid.UUID, imageid int, size int) (image CoverArtImage, err error)

GetReleaseImage retrieves the image with the id imageid of the release with the MBID mbid in the specified size

func (*CAAClient) GetReleaseInfo

func (c *CAAClient) GetReleaseInfo(mbid uuid.UUID) (info *CoverArtInfo, err error)

GetReleaseInfo retrieves information about the images in the Cover Art Archive for the release with the MBID mbid

type CoverArtImage

type CoverArtImage struct {
	Data     []byte
	Mimetype string
}

CoverArtImage is a wrapper around an image from the CAA, containing its binary data and mimetype information.

type CoverArtImageInfo

type CoverArtImageInfo struct {
	Approved   bool
	Back       bool
	Comment    string
	Edit       int
	Front      bool
	ID         string
	Image      string
	Thumbnails ThumbnailMap
	Types      []string
}

CoverArtImageInfo is the unmarshaled representation of a single images metadata in a CAA JSON file. See https://musicbrainz.org/doc/Cover_Art_Archive/API#Cover_Art_Archive_Metadata for an example.

type CoverArtInfo

type CoverArtInfo struct {
	Images  []CoverArtImageInfo
	Release string
}

CoverArtInfo is the unmarshaled representation of a JSON file in the Cover Art Archive. See https://musicbrainz.org/doc/Cover_Art_Archive/API#Cover_Art_Archive_Metadata for an example.

type HTTPError

type HTTPError struct {
	StatusCode int
	URL        *url.URL
}

HTTPError is an error that occured while accessing URL. Instead of a status code of 200, StatusCode was returned by the server.

func (HTTPError) Error

func (e HTTPError) Error() string

type InvalidImageSizeError

type InvalidImageSizeError struct {
	EntityType string
	Size       int
}

InvalidImageSizeError indicates that Size is not valid for EntityType

func (InvalidImageSizeError) Error

func (e InvalidImageSizeError) Error() string

type ThumbnailMap

type ThumbnailMap map[string]string

ThumbnailMap maps thumbnail names to their URLs. The only valid keys are "large" and "small", "250", "500" and "1200".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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