Fix JSONID type conversions for yandex-music-api-go v0.0.0-20261018072517-d0173f795d2a
The new library version uses models.JSONID (custom string type) for ID fields instead of plain string. Convert to string where IDs are passed to functions expecting string or compared with string values. Affected: client.go (GetTrackInfoWithPosition), downloader.go (track.ID usage), monitor.go (track.ID, album.ID usage), storage.go (album/track ID assignment).
This commit is contained in:
1 parent
5d32daad07
commit
4e6bef40e3
6 files changed
+23
-21
No files matched your search
@@ -123,14 +123,14 @@ func (c *YandexClient) GetTrackInfoWithPosition(ctx context.Context, trackID str
|
||||
// Extract track position from first album
|
||||
var position *TrackPosition
|
||||
if len(track.Albums) > 0 {
|
||||
albumID := track.Albums[0].ID
|
||||
albumID := string(track.Albums[0].ID)
|
||||
albums, err := c.client.GetAlbumsWithTracks(ctx, []string{albumID})
|
||||
if err == nil && len(albums) > 0 {
|
||||
album := albums[0]
|
||||
// Find track in album.Volumes and get position
|
||||
for volIdx, volume := range album.Volumes {
|
||||
for trackIdx, t := range volume {
|
||||
if t.ID == trackID {
|
||||
if string(t.ID) == trackID {
|
||||
position = &TrackPosition{
|
||||
Volume: volIdx + 1,
|
||||
Index: trackIdx + 1,
|
||||
|
||||
Reference in new issue
Block a user