navidrome/core/agents/interfaces.go

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

65 lines
1.1 KiB
Go
Raw Normal View History

2021-02-07 22:46:15 +01:00
package agents
import (
"context"
"errors"
)
type Constructor func(ctx context.Context) Interface
2021-02-08 16:14:29 +01:00
type Interface interface {
AgentName() string
}
2021-02-07 22:46:15 +01:00
type Artist struct {
Name string
MBID string
}
type ArtistImage struct {
URL string
Size int
}
2021-02-08 21:53:07 +01:00
type Song struct {
2021-02-07 22:46:15 +01:00
Name string
MBID string
}
var (
ErrNotFound = errors.New("not found")
)
type ArtistMBIDRetriever interface {
2021-02-09 17:19:32 +01:00
GetMBID(id string, name string) (string, error)
2021-02-07 22:46:15 +01:00
}
type ArtistURLRetriever interface {
2021-02-09 17:19:32 +01:00
GetURL(id, name, mbid string) (string, error)
2021-02-07 22:46:15 +01:00
}
type ArtistBiographyRetriever interface {
2021-02-09 17:19:32 +01:00
GetBiography(id, name, mbid string) (string, error)
2021-02-07 22:46:15 +01:00
}
type ArtistSimilarRetriever interface {
2021-02-09 17:19:32 +01:00
GetSimilar(id, name, mbid string, limit int) ([]Artist, error)
2021-02-07 22:46:15 +01:00
}
type ArtistImageRetriever interface {
2021-02-09 17:19:32 +01:00
GetImages(id, name, mbid string) ([]ArtistImage, error)
2021-02-07 22:46:15 +01:00
}
type ArtistTopSongsRetriever interface {
2021-02-09 17:19:32 +01:00
GetTopSongs(id, artistName, mbid string, count int) ([]Song, error)
2021-02-07 22:46:15 +01:00
}
var Map map[string]Constructor
func Register(name string, init Constructor) {
if Map == nil {
Map = make(map[string]Constructor)
}
Map[name] = init
}