This commit is contained in:
2025-10-03 03:45:29 +02:00
parent 48b88892b5
commit 5427393547
6 changed files with 183 additions and 133 deletions

View File

@@ -2,8 +2,7 @@ package websocket
import "spotify-ws/internal/spotify"
// PlaybackState is the client-facing data structure. It conditionally omits
// real-time data fields from JSON based on the server's mode.
// PlaybackState is the client-facing data structure.
type PlaybackState struct {
IsPlaying bool `json:"is_playing"`
ProgressMs int `json:"progress_ms,omitempty"`
@@ -12,7 +11,6 @@ type PlaybackState struct {
}
// newPlaybackState creates a client-facing PlaybackState from the internal Spotify data.
// It includes progress data only if the server is in real-time mode.
func newPlaybackState(data *spotify.CurrentlyPlaying, realtime bool) PlaybackState {
if data == nil {
return PlaybackState{IsPlaying: false}