Refactor Agents to be singleton

Initial work for Last.fm scrobbler
This commit is contained in:
Deluan
2021-06-22 11:15:51 -04:00
committed by Deluan Quintão
parent f9fa9667a3
commit d5461d0ae9
17 changed files with 289 additions and 212 deletions
+5 -3
View File
@@ -2,6 +2,8 @@ package agents
import (
"context"
"github.com/navidrome/navidrome/model"
)
const PlaceholderAgentName = "placeholder"
@@ -15,7 +17,7 @@ const (
type placeholderAgent struct{}
func placeholdersConstructor(ctx context.Context) Interface {
func placeholdersConstructor(ds model.DataStore) Interface {
return &placeholderAgent{}
}
@@ -23,11 +25,11 @@ func (p *placeholderAgent) AgentName() string {
return PlaceholderAgentName
}
func (p *placeholderAgent) GetBiography(id, name, mbid string) (string, error) {
func (p *placeholderAgent) GetBiography(ctx context.Context, id, name, mbid string) (string, error) {
return placeholderBiography, nil
}
func (p *placeholderAgent) GetImages(id, name, mbid string) ([]ArtistImage, error) {
func (p *placeholderAgent) GetImages(ctx context.Context, id, name, mbid string) ([]ArtistImage, error) {
return []ArtistImage{
{placeholderArtistImageLargeUrl, 300},
{placeholderArtistImageMediumUrl, 174},