Some checks failed
Pipeline: Test, Lint, Build / Get version info (push) Has been cancelled
Pipeline: Test, Lint, Build / Lint Go code (push) Has been cancelled
Pipeline: Test, Lint, Build / Test Go code (push) Has been cancelled
Pipeline: Test, Lint, Build / Test JS code (push) Has been cancelled
Pipeline: Test, Lint, Build / Lint i18n files (push) Has been cancelled
Pipeline: Test, Lint, Build / Check Docker configuration (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (darwin/amd64) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (darwin/arm64) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (linux/386) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (linux/amd64) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (linux/arm/v5) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (linux/arm/v6) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (linux/arm/v7) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (linux/arm64) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (windows/386) (push) Has been cancelled
Pipeline: Test, Lint, Build / Build (windows/amd64) (push) Has been cancelled
Pipeline: Test, Lint, Build / Push to GHCR (push) Has been cancelled
Pipeline: Test, Lint, Build / Push to Docker Hub (push) Has been cancelled
Pipeline: Test, Lint, Build / Cleanup digest artifacts (push) Has been cancelled
Pipeline: Test, Lint, Build / Build Windows installers (push) Has been cancelled
Pipeline: Test, Lint, Build / Package/Release (push) Has been cancelled
Pipeline: Test, Lint, Build / Upload Linux PKG (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
POEditor import / update-translations (push) Has been cancelled
85 lines
1.8 KiB
Go
85 lines
1.8 KiB
Go
package agents
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/navidrome/navidrome/model"
|
|
)
|
|
|
|
type Constructor func(ds model.DataStore) Interface
|
|
|
|
type Interface interface {
|
|
AgentName() string
|
|
}
|
|
|
|
// AlbumInfo contains album metadata (no images)
|
|
type AlbumInfo struct {
|
|
Name string
|
|
MBID string
|
|
Description string
|
|
URL string
|
|
}
|
|
|
|
type Artist struct {
|
|
Name string
|
|
MBID string
|
|
}
|
|
|
|
type ExternalImage struct {
|
|
URL string
|
|
Size int
|
|
}
|
|
|
|
type Song struct {
|
|
Name string
|
|
MBID string
|
|
}
|
|
|
|
var (
|
|
ErrNotFound = errors.New("not found")
|
|
)
|
|
|
|
// AlbumInfoRetriever provides album info (no images)
|
|
type AlbumInfoRetriever interface {
|
|
GetAlbumInfo(ctx context.Context, name, artist, mbid string) (*AlbumInfo, error)
|
|
}
|
|
|
|
// AlbumImageRetriever provides album images
|
|
type AlbumImageRetriever interface {
|
|
GetAlbumImages(ctx context.Context, name, artist, mbid string) ([]ExternalImage, error)
|
|
}
|
|
|
|
type ArtistMBIDRetriever interface {
|
|
GetArtistMBID(ctx context.Context, id string, name string) (string, error)
|
|
}
|
|
|
|
type ArtistURLRetriever interface {
|
|
GetArtistURL(ctx context.Context, id, name, mbid string) (string, error)
|
|
}
|
|
|
|
type ArtistBiographyRetriever interface {
|
|
GetArtistBiography(ctx context.Context, id, name, mbid string) (string, error)
|
|
}
|
|
|
|
type ArtistSimilarRetriever interface {
|
|
GetSimilarArtists(ctx context.Context, id, name, mbid string, limit int) ([]Artist, error)
|
|
}
|
|
|
|
type ArtistImageRetriever interface {
|
|
GetArtistImages(ctx context.Context, id, name, mbid string) ([]ExternalImage, error)
|
|
}
|
|
|
|
type ArtistTopSongsRetriever interface {
|
|
GetArtistTopSongs(ctx context.Context, id, artistName, mbid string, count int) ([]Song, error)
|
|
}
|
|
|
|
var Map map[string]Constructor
|
|
|
|
func Register(name string, init Constructor) {
|
|
if Map == nil {
|
|
Map = make(map[string]Constructor)
|
|
}
|
|
Map[name] = init
|
|
}
|