Return a formatted string alongside with duration in milliseconds.
This commit is contained in:
parent
437403aa9e
commit
010774d775
@ -24,13 +24,15 @@ func (s *Song) MarshalJSON() ([]byte, error) {
|
|||||||
return json.Marshal(&struct {
|
return json.Marshal(&struct {
|
||||||
Artist string `json:"artist"`
|
Artist string `json:"artist"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Duration int64 `json:"duration_milliseconds"`
|
DurationMill int64 `json:"duration_milliseconds"`
|
||||||
|
Duration string `json:"duration"`
|
||||||
MaxListeners int `json:"listeners"`
|
MaxListeners int `json:"listeners"`
|
||||||
StartAt string `json:"start_at"`
|
StartAt string `json:"start_at"`
|
||||||
}{
|
}{
|
||||||
Artist: s.Artist,
|
Artist: s.Artist,
|
||||||
Title: s.Title,
|
Title: s.Title,
|
||||||
Duration: s.Duration.Milliseconds(),
|
DurationMill: s.Duration.Milliseconds(),
|
||||||
|
Duration: time.UnixMilli(s.Duration.Milliseconds()).Format("04:05"),
|
||||||
MaxListeners: s.MaxListeners,
|
MaxListeners: s.MaxListeners,
|
||||||
StartAt: s.StartAt.UTC().Format(time.RFC3339)})
|
StartAt: s.StartAt.UTC().Format(time.RFC3339)})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user