+2
service/playingnow/playingnow.go
+2
service/playingnow/playingnow.go
+5
-2
service/spotify/spotify.go
+5
-2
service/spotify/spotify.go
···
538
538
} `json:"external_urls"`
539
539
DurationMs int `json:"duration_ms"`
540
540
} `json:"item"`
541
-
ProgressMS int `json:"progress_ms"`
541
+
ProgressMS int `json:"progress_ms"`
542
+
IsPlaying bool `json:"is_playing"`
542
543
}
543
544
544
545
err = json.Unmarshal(bodyBytes, &response) // Use bodyBytes here
545
546
if err != nil {
546
547
return nil, fmt.Errorf("failed to unmarshal spotify response: %w", err)
547
548
}
548
-
549
+
if response.IsPlaying == false {
550
+
return nil, nil
551
+
}
549
552
var artists []models.Artist
550
553
for _, artist := range response.Item.Artists {
551
554
artists = append(artists, models.Artist{