Update yandex-music-api-go library
Upgrade to v0.0.0-20261018055743-0456ca0665a6 which fixes the page=0 validation bug in GetArtistTracks/GetArtistAlbums. The library now returns *ArtistTracks/*ArtistAlbums wrappers instead of raw slices, so the YandexClient wrapper extracts the inner slices for backward compatibility. Reverted page numbering back to 0 in monitor since the API bug is fixed server-side/library-side.
This commit is contained in:
1 parent
ed6c26a3af
commit
c228e7e2b7
4 files changed
+23
-5
No files matched your search
@@ -72,12 +72,28 @@ func NewYandexClient(cfg *config.YandexConfig, debug bool) (*YandexClient, error
|
||||
|
||||
// GetArtistTracks fetches tracks for an artist
|
||||
func (c *YandexClient) GetArtistTracks(ctx context.Context, artistID int, page, pageSize int) ([]*yandexmusic.Track, error) {
|
||||
return c.client.GetArtistTracks(ctx, fmt.Sprintf("%d", artistID), page, pageSize)
|
||||
result, err := c.client.GetArtistTracks(ctx, fmt.Sprintf("%d", artistID), page, pageSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tracks := make([]*yandexmusic.Track, 0, len(result.Tracks))
|
||||
for i := range result.Tracks {
|
||||
tracks = append(tracks, &result.Tracks[i])
|
||||
}
|
||||
return tracks, nil
|
||||
}
|
||||
|
||||
// GetArtistAlbums fetches albums for an artist
|
||||
func (c *YandexClient) GetArtistAlbums(ctx context.Context, artistID int, page, pageSize int) ([]*yandexmusic.Album, error) {
|
||||
return c.client.GetArtistAlbums(ctx, fmt.Sprintf("%d", artistID), page, pageSize)
|
||||
result, err := c.client.GetArtistAlbums(ctx, fmt.Sprintf("%d", artistID), page, pageSize)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
albums := make([]*yandexmusic.Album, 0, len(result.Albums))
|
||||
for i := range result.Albums {
|
||||
albums = append(albums, &result.Albums[i])
|
||||
}
|
||||
return albums, nil
|
||||
}
|
||||
|
||||
// GetAlbumWithTracks fetches an album with its tracks
|
||||
|
||||
Reference in new issue
Block a user