feat(subsonic): add getAlbumInfo with cache

Release-As: 0.16.1
This commit is contained in:
sentriz
2023-11-07 23:43:11 +00:00
parent 3f5cf56c88
commit cc1a99f033
14 changed files with 268 additions and 48 deletions

View File

@@ -60,6 +60,26 @@ func (c *Client) ArtistGetInfo(artistName string) (Artist, error) {
return resp.Artist, nil
}
func (c *Client) AlbumGetInfo(artistName, albumName string) (Album, error) {
apiKey, _, err := c.keySecret()
if err != nil {
return Album{}, fmt.Errorf("get key and secret: %w", err)
}
params := url.Values{}
params.Add("method", "album.getInfo")
params.Add("api_key", apiKey)
params.Add("artist", artistName)
params.Add("album", albumName)
resp, err := c.makeRequest(http.MethodGet, params)
if err != nil {
return Album{}, fmt.Errorf("make request: %w", err)
}
return resp.Album, nil
}
func (c *Client) ArtistGetTopTracks(artistName string) (TopTracks, error) {
apiKey, _, err := c.keySecret()
if err != nil {