Add missing fields to ArtistInfo
This commit is contained in:
@@ -83,6 +83,8 @@ func (e *externalInfo) callArtistInfo(ctx context.Context, artist *model.Artist,
|
|||||||
log.Debug(ctx, "Got info from Last.FM", "artist", artist.Name, "info", lfmArtist.Bio.Summary, "elapsed", time.Since(start))
|
log.Debug(ctx, "Got info from Last.FM", "artist", artist.Name, "info", lfmArtist.Bio.Summary, "elapsed", time.Since(start))
|
||||||
}
|
}
|
||||||
e.setBio(info, lfmArtist.Bio.Summary)
|
e.setBio(info, lfmArtist.Bio.Summary)
|
||||||
|
e.setLastFMUrl(info, lfmArtist.URL)
|
||||||
|
e.setMbzID(info, lfmArtist.MBID)
|
||||||
e.setSimilar(ctx, info, lfmArtist.Similar.Artists, includeNotPresent)
|
e.setSimilar(ctx, info, lfmArtist.Similar.Artists, includeNotPresent)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@@ -126,6 +128,18 @@ func (e *externalInfo) setBio(info *model.ArtistInfo, bio string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *externalInfo) setLastFMUrl(info *model.ArtistInfo, url string) {
|
||||||
|
if info.LastFMUrl == "" {
|
||||||
|
info.LastFMUrl = url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *externalInfo) setMbzID(info *model.ArtistInfo, mbzID string) {
|
||||||
|
if info.MbzID == "" {
|
||||||
|
info.MbzID = mbzID
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (e *externalInfo) setSmallImageUrl(info *model.ArtistInfo, url string) {
|
func (e *externalInfo) setSmallImageUrl(info *model.ArtistInfo, url string) {
|
||||||
if info.SmallImageUrl == "" {
|
if info.SmallImageUrl == "" {
|
||||||
info.SmallImageUrl = url
|
info.SmallImageUrl = url
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ package model
|
|||||||
type ArtistInfo struct {
|
type ArtistInfo struct {
|
||||||
ID string
|
ID string
|
||||||
Name string
|
Name string
|
||||||
|
MbzID string
|
||||||
Bio string
|
Bio string
|
||||||
Similar []Artist
|
Similar []Artist
|
||||||
SmallImageUrl string
|
SmallImageUrl string
|
||||||
MediumImageUrl string
|
MediumImageUrl string
|
||||||
LargeImageUrl string
|
LargeImageUrl string
|
||||||
|
LastFMUrl string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,6 +271,8 @@ func (c *BrowsingController) GetArtistInfo(w http.ResponseWriter, r *http.Reques
|
|||||||
response.ArtistInfo.SmallImageUrl = info.SmallImageUrl
|
response.ArtistInfo.SmallImageUrl = info.SmallImageUrl
|
||||||
response.ArtistInfo.MediumImageUrl = info.MediumImageUrl
|
response.ArtistInfo.MediumImageUrl = info.MediumImageUrl
|
||||||
response.ArtistInfo.LargeImageUrl = info.LargeImageUrl
|
response.ArtistInfo.LargeImageUrl = info.LargeImageUrl
|
||||||
|
response.ArtistInfo.LastFmUrl = info.LastFMUrl
|
||||||
|
response.ArtistInfo.MusicBrainzID = info.MbzID
|
||||||
for _, s := range info.Similar {
|
for _, s := range info.Similar {
|
||||||
similar := responses.Artist{}
|
similar := responses.Artist{}
|
||||||
similar.Id = s.ID
|
similar.Id = s.ID
|
||||||
|
|||||||
Reference in New Issue
Block a user