chromaprint

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultConfig = Config{
		Key:     defaultClientId,
		Timeout: defaultTimeout,
		Rate:    defaultQps,
		Base:    baseUrl,
	}
)
View Source
var (
	ErrQueryRateExceeded = errors.New("Query Rate Exceeded")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Config
	*http.Client
	*url.URL
	// contains filtered or unexported fields
}

func NewClient

func NewClient() *Client

func NewClientWithConfig

func NewClientWithConfig(cfg Config) (*Client, error)

func (*Client) Lookup

func (client *Client) Lookup(fingerprint string, duration time.Duration, flags Meta) ([]*ResponseMatch, error)

func (*Client) String

func (client *Client) String() string

type Config

type Config struct {
	Key     string        `yaml:key`     // AcuostId Web Service Key
	Timeout time.Duration `yaml:timeout` // AcoustId Client timeout
	Rate    uint          `yaml:rate`    // Maximum requests per second
	Base    string        `yaml:base`    // Base URL
}

type Meta

type Meta uint
const (
	META_RECORDING Meta = (1 << iota)
	META_RECORDINGID
	META_RELEASE
	META_RELEASEID
	META_RELEASEGROUP
	META_RELEASEGROUPID
	META_TRACK
	META_COMPRESS
	META_USERMETA
	META_SOURCE
	META_MIN       = META_RECORDING
	META_MAX       = META_SOURCE
	META_NONE Meta = 0
	META_ALL       = META_RECORDING | META_RECORDINGID | META_RELEASE | META_RELEASEID | META_RELEASEGROUP | META_RELEASEGROUPID | META_TRACK | META_COMPRESS | META_USERMETA | META_SOURCE
)

func (Meta) FlagString

func (m Meta) FlagString() string

func (Meta) String

func (m Meta) String() string

type Response

type Response struct {
	Status  string           `json:"status"`
	Error   ResponseError    `json:"error"`
	Results []*ResponseMatch `json:"results"`
}

type ResponseArtist

type ResponseArtist struct {
	Id   string `json:"id"`
	Name string `json:"name,omitempty"`
}

type ResponseError

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type ResponseGroup

type ResponseGroup struct {
	Id       string            `json:"id"`
	Type     string            `json:"type,omitempty"`
	Title    string            `json:"title,omitempty"`
	Releases []ResponseRelease `json:"releases,omitempty"`
}

type ResponseMatch

type ResponseMatch struct {
	Id         string              `json:"id"`
	Score      float64             `json:"score"`
	Recordings []ResponseRecording `json:"recordings,omitempty"`
}

func (*ResponseMatch) String

func (r *ResponseMatch) String() string

type ResponseMedium

type ResponseMedium struct {
	Format     string          `json:"format"`
	Position   uint            `json:"position"`
	TrackCount uint            `json:"track_count"`
	Tracks     []ResponseTrack `json:"tracks,omitempty"`
}

type ResponseRecording

type ResponseRecording struct {
	Id            string           `json:"id"`
	Title         string           `json:"title,omitempty"`
	Duration      float64          `json:"duration,omitempty"`
	Artists       []ResponseArtist `json:"artists,omitempty"`
	ReleaseGroups []ResponseGroup  `json:"releasegroups,omitempty"`
}

type ResponseRelease

type ResponseRelease struct {
	Id      string           `json:"id"`
	Mediums []ResponseMedium `json:"mediums,omitempty"`
}

type ResponseTrack

type ResponseTrack struct {
	Id       string           `json:"id"`
	Artists  []ResponseArtist `json:"artists,omitempty"`
	Position uint             `json:"position"`
	Title    string           `json:"title,omitempty"`
}

Jump to

Keyboard shortcuts

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