From c054c3b32e25c7cb43c8b3b4b0f03a05dccf14ae Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 2 Oct 2023 01:26:22 +0400 Subject: [PATCH] Added a duration field to Song_ struct. --- internal/radio/song.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/radio/song.go b/internal/radio/song.go index e2677ac..64d5e38 100644 --- a/internal/radio/song.go +++ b/internal/radio/song.go @@ -11,6 +11,7 @@ import ( type Song_ struct { Artist string Title string + Duration time.Duration MaxListeners int StartAt time.Time } @@ -23,11 +24,13 @@ func (s *Song_) MarshalJSON() ([]byte, error) { return json.Marshal(&struct { Artist string `json:"artist"` Title string `json:"title"` + Duration int64 `json:"duration_milliseconds"` MaxListeners int `json:"listeners"` StartAt string `json:"start_at"` }{ Artist: s.Artist, Title: s.Title, + Duration: s.Duration.Milliseconds(), MaxListeners: s.MaxListeners, StartAt: s.StartAt.UTC().Format(time.RFC3339)}) }