🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add artist ID to agent's interfaces
Deluanb855fe865e61
diff --git a/core/agents/interfaces.go b/core/agents/interfaces.goindex 6491e6264..02ab13136 100644--- a/core/agents/interfaces.go+++ b/core/agents/interfaces.go@@ -31,27 +31,27 @@ var ()type ArtistMBIDRetriever interface {- GetMBID(name string) (string, error)+ GetMBID(id string, name string) (string, error)}type ArtistURLRetriever interface {- GetURL(name, mbid string) (string, error)+ GetURL(id, name, mbid string) (string, error)}type ArtistBiographyRetriever interface {- GetBiography(name, mbid string) (string, error)+ GetBiography(id, name, mbid string) (string, error)}type ArtistSimilarRetriever interface {- GetSimilar(name, mbid string, limit int) ([]Artist, error)+ GetSimilar(id, name, mbid string, limit int) ([]Artist, error)}type ArtistImageRetriever interface {- GetImages(name, mbid string) ([]ArtistImage, error)+ GetImages(id, name, mbid string) ([]ArtistImage, error)}type ArtistTopSongsRetriever interface {- GetTopSongs(artistName, mbid string, count int) ([]Song, error)+ GetTopSongs(id, artistName, mbid string, count int) ([]Song, error)}var Map map[string]Constructordiff --git a/core/agents/lastfm.go b/core/agents/lastfm.goindex 3de31c235..68f9b8889 100644--- a/core/agents/lastfm.go+++ b/core/agents/lastfm.go@@ -34,7 +34,7 @@ func (l *lastfmAgent) AgentName() string {return lastFMAgentName}-func (l *lastfmAgent) GetMBID(name string) (string, error) {+func (l *lastfmAgent) GetMBID(id string, name string) (string, error) {a, err := l.callArtistGetInfo(name, "")if err != nil {return "", err@@ -45,7 +45,7 @@ func (l *lastfmAgent) GetMBID(name string) (string, error) {return a.MBID, nil}-func (l *lastfmAgent) GetURL(name, mbid string) (string, error) {+func (l *lastfmAgent) GetURL(id, name, mbid string) (string, error) {a, err := l.callArtistGetInfo(name, mbid)if err != nil {return "", err@@ -56,7 +56,7 @@ func (l *lastfmAgent) GetURL(name, mbid string) (string, error) {return a.URL, nil}-func (l *lastfmAgent) GetBiography(name, mbid string) (string, error) {+func (l *lastfmAgent) GetBiography(id, name, mbid string) (string, error) {a, err := l.callArtistGetInfo(name, mbid)if err != nil {return "", err@@ -67,7 +67,7 @@ func (l *lastfmAgent) GetBiography(name, mbid string) (string, error) {return a.Bio.Summary, nil}-func (l *lastfmAgent) GetSimilar(name, mbid string, limit int) ([]Artist, error) {+func (l *lastfmAgent) GetSimilar(id, name, mbid string, limit int) ([]Artist, error) {resp, err := l.callArtistGetSimilar(name, mbid, limit)if err != nil {return nil, err@@ -85,7 +85,7 @@ func (l *lastfmAgent) GetSimilar(name, mbid string, limit int) ([]Artist, error)return res, nil}-func (l *lastfmAgent) GetTopSongs(artistName, mbid string, count int) ([]Song, error) {+func (l *lastfmAgent) GetTopSongs(id, artistName, mbid string, count int) ([]Song, error) {resp, err := l.callArtistGetTopTracks(artistName, mbid, count)if err != nil {return nil, errdiff --git a/core/agents/placeholders.go b/core/agents/placeholders.goindex a0fd89020..8e1f3fb46 100644--- a/core/agents/placeholders.go+++ b/core/agents/placeholders.go@@ -23,11 +23,11 @@ func (p *placeholderAgent) AgentName() string {return PlaceholderAgentName}-func (p *placeholderAgent) GetBiography(name, mbid string) (string, error) {+func (p *placeholderAgent) GetBiography(id, name, mbid string) (string, error) {return placeholderBiography, nil}-func (p *placeholderAgent) GetImages(name, mbid string) ([]ArtistImage, error) {+func (p *placeholderAgent) GetImages(id, name, mbid string) ([]ArtistImage, error) {return []ArtistImage{{placeholderArtistImageLargeUrl, 300},{placeholderArtistImageMediumUrl, 174},diff --git a/core/agents/spotify.go b/core/agents/spotify.goindex 2f076542e..3f85a7fa6 100644--- a/core/agents/spotify.go+++ b/core/agents/spotify.go@@ -39,7 +39,7 @@ func (s *spotifyAgent) AgentName() string {return spotifyAgentName}-func (s *spotifyAgent) GetImages(name, mbid string) ([]ArtistImage, error) {+func (s *spotifyAgent) GetImages(id, name, mbid string) ([]ArtistImage, error) {a, err := s.searchArtist(name)if err != nil {if err == model.ErrNotFound {diff --git a/core/external_info.go b/core/external_info.goindex 5902a05f6..24eeea1e9 100644--- a/core/external_info.go+++ b/core/external_info.go@@ -243,7 +243,7 @@ func (e *externalInfo) callGetMBID(ctx context.Context, allAgents []agents.Interif !ok {continue}- mbid, err := agent.GetMBID(artist.Name)+ mbid, err := agent.GetMBID(artist.ID, artist.Name)if mbid != "" && err == nil {artist.MbzArtistID = mbidlog.Debug(ctx, "Got MBID", "agent", a.AgentName(), "artist", artist.Name, "mbid", mbid, "elapsed", time.Since(start))@@ -263,7 +263,7 @@ func (e *externalInfo) callGetTopSongs(ctx context.Context, allAgents []agents.Iif !ok {continue}- songs, err := agent.GetTopSongs(artist.Name, artist.MbzArtistID, count)+ songs, err := agent.GetTopSongs(artist.ID, artist.Name, artist.MbzArtistID, count)if len(songs) > 0 && err == nil {log.Debug(ctx, "Got Top Songs", "agent", a.AgentName(), "artist", artist.Name, "songs", songs, "elapsed", time.Since(start))return songs, err@@ -285,7 +285,7 @@ func (e *externalInfo) callGetURL(ctx context.Context, allAgents []agents.Interfif !ok {continue}- url, err := agent.GetURL(artist.Name, artist.MbzArtistID)+ url, err := agent.GetURL(artist.ID, artist.Name, artist.MbzArtistID)if url != "" && err == nil {artist.ExternalUrl = urllog.Debug(ctx, "Got External Url", "agent", a.AgentName(), "artist", artist.Name, "url", url, "elapsed", time.Since(start))@@ -308,7 +308,7 @@ func (e *externalInfo) callGetBiography(ctx context.Context, allAgents []agents.if !ok {continue}- bio, err := agent.GetBiography(clearName(artist.Name), artist.MbzArtistID)+ bio, err := agent.GetBiography(artist.ID, clearName(artist.Name), artist.MbzArtistID)if bio != "" && err == nil {policy := bluemonday.UGCPolicy()bio = policy.Sanitize(bio)@@ -334,7 +334,7 @@ func (e *externalInfo) callGetImage(ctx context.Context, allAgents []agents.Inteif !ok {continue}- images, err := agent.GetImages(artist.Name, artist.MbzArtistID)+ images, err := agent.GetImages(artist.ID, artist.Name, artist.MbzArtistID)if len(images) == 0 || err != nil {continue}@@ -367,7 +367,7 @@ func (e *externalInfo) callGetSimilar(ctx context.Context, allAgents []agents.Inif !ok {continue}- similar, err := agent.GetSimilar(artist.Name, artist.MbzArtistID, limit)+ similar, err := agent.GetSimilar(artist.ID, artist.Name, artist.MbzArtistID, limit)if len(similar) == 0 || err != nil {continue}