Skip to content

Commit

Permalink
feat: add more fields into metadata response
Browse files Browse the repository at this point in the history
Resolve: #8
  • Loading branch information
phts authored and devgianlu committed Nov 2, 2023
1 parent 2a61d42 commit 8caf8e0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/daemon/api_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand All @@ -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,
}
}
}
Expand Down

0 comments on commit 8caf8e0

Please sign in to comment.