From 8caf8e000b3063bd4c0f859ab91ee8b9aeb62373 Mon Sep 17 00:00:00 2001 From: Phil Tsaryk Date: Tue, 31 Oct 2023 22:44:02 +0100 Subject: [PATCH] feat: add more fields into metadata response Resolve: #8 --- cmd/daemon/api_server.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/daemon/api_server.go b/cmd/daemon/api_server.go index bdd7997..543185b 100644 --- a/cmd/daemon/api_server.go +++ b/cmd/daemon/api_server.go @@ -95,6 +95,9 @@ type ApiResponseStatusTrack struct { AlbumCoverUrl string `json:"album_cover_url"` Position int64 `json:"position"` Duration int `json:"duration"` + ReleaseDate string `json:"release_date"` + TrackNumber int `json:"track_number"` + DiscNumber int `json:"disc_number"` } func NewApiResponseStatusTrack(media *librespot.Media, prodInfo *ProductInfo, position int64) *ApiResponseStatusTrack { @@ -121,6 +124,9 @@ func NewApiResponseStatusTrack(media *librespot.Media, prodInfo *ProductInfo, po AlbumCoverUrl: prodInfo.ImageUrl(albumCoverId), Position: position, Duration: int(*track.Duration), + ReleaseDate: track.Album.Date.String(), + TrackNumber: int(*track.Number), + DiscNumber: int(*track.DiscNumber), } } else { episode := media.Episode() @@ -138,6 +144,9 @@ func NewApiResponseStatusTrack(media *librespot.Media, prodInfo *ProductInfo, po AlbumCoverUrl: prodInfo.ImageUrl(albumCoverId), Position: position, Duration: int(*episode.Duration), + ReleaseDate: "", + TrackNumber: 0, + DiscNumber: 0, } } }