In MarshalJSON() for Song a string field Duration was removed, just msec left.
This commit is contained in:
parent
62f6e3b976
commit
1d50bbe790
@ -34,14 +34,12 @@ func (s *Song) MarshalJSON() ([]byte, error) {
|
||||
Artist string `json:"artist"`
|
||||
Title string `json:"title"`
|
||||
DurationMill int64 `json:"duration_msec"`
|
||||
Duration string `json:"duration"`
|
||||
MaxListeners int `json:"listeners"`
|
||||
StartAt string `json:"start_at"`
|
||||
}{
|
||||
Artist: s.Artist,
|
||||
Title: s.Title,
|
||||
DurationMill: s.Duration.Milliseconds(),
|
||||
Duration: s.DurationString(),
|
||||
MaxListeners: s.MaxListeners,
|
||||
StartAt: s.StartAt.UTC().Format(time.RFC3339)})
|
||||
}
|
||||
@ -77,13 +75,13 @@ func (sl *SongList) Add(newSong Song) {
|
||||
}
|
||||
|
||||
// Current returns a currently playing song.
|
||||
func (sl *SongList) Current() Song {
|
||||
func (sl *SongList) Current() *Song {
|
||||
sl.Lock()
|
||||
defer sl.Unlock()
|
||||
if sl.current.StartAt.Year() == 1 {
|
||||
return Song{}
|
||||
return nil
|
||||
}
|
||||
return sl.current
|
||||
return &sl.current
|
||||
}
|
||||
|
||||
// UpdateCurrentMaxListeners checks and updates a maximal number of listeners
|
||||
|
Loading…
Reference in New Issue
Block a user