Documentation ¶
Overview ¶
Package caa provides access to the Cover Art Archive (https://coverartarchive.org)
Index ¶
- Constants
- func StringToUUID(str string) (uuid u.UUID)
- type CAAClient
- func (c *CAAClient) GetReleaseBack(mbid uuid.UUID, size int) (image CoverArtImage, err error)
- func (c *CAAClient) GetReleaseFront(mbid uuid.UUID, size int) (image CoverArtImage, err error)
- func (c *CAAClient) GetReleaseGroupFront(mbid uuid.UUID, size int) (image CoverArtImage, err error)
- func (c *CAAClient) GetReleaseGroupInfo(mbid uuid.UUID) (info *CoverArtInfo, err error)
- func (c *CAAClient) GetReleaseImage(mbid uuid.UUID, imageid int, size int) (image CoverArtImage, err error)
- func (c *CAAClient) GetReleaseInfo(mbid uuid.UUID) (info *CoverArtInfo, err error)
- type CoverArtImage
- type CoverArtImageInfo
- type CoverArtInfo
- type HTTPError
- type InvalidImageSizeError
- type ThumbnailMap
Constants ¶
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 ¶
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 ¶
NewCAAClient returns a new CAAClient that uses the User-Agent useragent
func (*CAAClient) GetReleaseBack ¶
GetReleaseBack retrieves the back image of the release with the MBID mbid in the specified size
func (*CAAClient) GetReleaseFront ¶
GetReleaseFront retrieves the front image of the release with the MBID mbid in the specified size
func (*CAAClient) GetReleaseGroupFront ¶
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 ¶
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 interface{} `json:"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 ¶
HTTPError is an error that occured while accessing URL. Instead of a status code of 200, StatusCode was returned by the server.
type InvalidImageSizeError ¶
InvalidImageSizeError indicates that Size is not valid for EntityType
func (InvalidImageSizeError) Error ¶
func (e InvalidImageSizeError) Error() string
type ThumbnailMap ¶
ThumbnailMap maps thumbnail names to their URLs. The only valid keys are "large" and "small", "250", "500" and "1200".