Implement TopSongs

This commit is contained in:
Deluan
2021-02-08 15:53:07 -05:00
committed by Deluan Quintão
parent e1cb52689e
commit e5cbfac483
3 changed files with 78 additions and 10 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ type ArtistImage struct {
Size int
}
type Track struct {
type Song struct {
Name string
MBID string
}
@@ -51,7 +51,7 @@ type ArtistImageRetriever interface {
}
type ArtistTopSongsRetriever interface {
GetTopSongs(artistName, mbid string, count int) ([]Track, error)
GetTopSongs(artistName, mbid string, count int) ([]Song, error)
}
var Map map[string]Constructor
+3 -3
View File
@@ -87,7 +87,7 @@ func (l *lastfmAgent) GetSimilar(name, mbid string, limit int) ([]Artist, error)
return res, nil
}
func (l *lastfmAgent) GetTopSongs(artistName, mbid string, count int) ([]Track, error) {
func (l *lastfmAgent) GetTopSongs(artistName, mbid string, count int) ([]Song, error) {
resp, err := l.callArtistGetTopTracks(artistName, mbid, count)
if err != nil {
return nil, err
@@ -95,9 +95,9 @@ func (l *lastfmAgent) GetTopSongs(artistName, mbid string, count int) ([]Track,
if len(resp) == 0 {
return nil, ErrNotFound
}
var res []Track
var res []Song
for _, t := range resp {
res = append(res, Track{
res = append(res, Song{
Name: t.Name,
MBID: t.MBID,
})