mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-14 11:17:19 +03:00
63 lines
1.0 KiB
Go
63 lines
1.0 KiB
Go
package agents
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
type Constructor func(ctx context.Context) Interface
|
|
|
|
type Interface interface{}
|
|
|
|
type Artist struct {
|
|
Name string
|
|
MBID string
|
|
}
|
|
|
|
type ArtistImage struct {
|
|
URL string
|
|
Size int
|
|
}
|
|
|
|
type Track struct {
|
|
Name string
|
|
MBID string
|
|
}
|
|
|
|
var (
|
|
ErrNotFound = errors.New("not found")
|
|
)
|
|
|
|
type ArtistMBIDRetriever interface {
|
|
GetMBID(name string) (string, error)
|
|
}
|
|
|
|
type ArtistURLRetriever interface {
|
|
GetURL(name, mbid string) (string, error)
|
|
}
|
|
|
|
type ArtistBiographyRetriever interface {
|
|
GetBiography(name, mbid string) (string, error)
|
|
}
|
|
|
|
type ArtistSimilarRetriever interface {
|
|
GetSimilar(name, mbid string, limit int) ([]Artist, error)
|
|
}
|
|
|
|
type ArtistImageRetriever interface {
|
|
GetImages(name, mbid string) ([]ArtistImage, error)
|
|
}
|
|
|
|
type ArtistTopSongsRetriever interface {
|
|
GetTopSongs(artistName, mbid string, count int) ([]Track, error)
|
|
}
|
|
|
|
var Map map[string]Constructor
|
|
|
|
func Register(name string, init Constructor) {
|
|
if Map == nil {
|
|
Map = make(map[string]Constructor)
|
|
}
|
|
Map[name] = init
|
|
}
|