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 {
|
||||
Artist string `json:"artist"`
|
||||
Title string `json:"title"`
|
||||
Duration int64 `json:"duration_milliseconds"`
|
||||
DurationMill int64 `json:"duration_milliseconds"`
|
||||
Duration string `json:"duration"`
|
||||
MaxListeners int `json:"listeners"`
|
||||
StartAt string `json:"start_at"`
|
||||
}{
|
||||
Artist: s.Artist,
|
||||
Title: s.Title,
|
||||
Duration: s.Duration.Milliseconds(),
|
||||
DurationMill: s.Duration.Milliseconds(),
|
||||
Duration: time.UnixMilli(s.Duration.Milliseconds()).Format("04:05"),
|
||||
MaxListeners: s.MaxListeners,
|
||||
StartAt: s.StartAt.UTC().Format(time.RFC3339)})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user