respond to some feedback

This commit is contained in:
Kendall Garner 2026-01-25 21:29:18 -08:00
parent 5f2169a836
commit 6ed2dfd9b9
No known key found for this signature in database
GPG Key ID: 9355F387FE765C94
2 changed files with 7 additions and 7 deletions

View File

@ -139,12 +139,12 @@ func (l *listenBrainzAgent) GetArtistTopSongs(ctx context.Context, id, artistNam
return nil, agents.ErrNotFound
}
var res []agents.Song
for _, t := range resp {
res = append(res, agents.Song{
res := make([]agents.Song, len(resp))
for i, t := range resp {
res[i] = agents.Song{
Name: t.RecordingName,
MBID: t.RecordingMbid,
})
}
}
return res, nil
}
@ -153,7 +153,7 @@ func init() {
conf.AddHook(func() {
if conf.Server.ListenBrainz.Enabled {
scrobbler.Register(listenBrainzAgentName, func(ds model.DataStore) scrobbler.Scrobbler {
// This is a workaround for the fact that a (Interface)(nil) is not the same as a (*lastfmAgent)(nil)
// This is a workaround for the fact that a (Interface)(nil) is not the same as a (*listenBrainzConstructor)(nil)
// See https://go.dev/doc/faq#nil_error
a := listenBrainzConstructor(ds)
if a != nil {
@ -168,7 +168,7 @@ func init() {
}
agents.Register(listenBrainzAgentName, func(ds model.DataStore) agents.Interface {
// This is a workaround for the fact that a (Interface)(nil) is not the same as a (*lastfmAgent)(nil)
// This is a workaround for the fact that a (Interface)(nil) is not the same as a (*listenBrainzConstructor)(nil)
// See https://go.dev/doc/faq#nil_error
a := listenBrainzConstructor(ds)
if a != nil {

View File

@ -212,7 +212,7 @@ func (c *client) makeGenericRequest(ctx context.Context, method string, endpoint
var lbzError lbzHttpError
jsonErr := decoder.Decode(&lbzError)
if resp.StatusCode != 200 && jsonErr != nil {
if jsonErr != nil {
return nil, fmt.Errorf("ListenBrainz: HTTP Error, Status: (%d)", resp.StatusCode)
}