feat: show last played songs in web ui
This commit is contained in:
parent
7f16452a99
commit
bcc1bce743
6 changed files with 206 additions and 7 deletions
|
@ -149,9 +149,10 @@ func (s *Server) handleStatic(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
// StatusResponse contains the jukebox status
|
||||
type StatusResponse struct {
|
||||
IsPlaying bool `json:"isPlaying"`
|
||||
CurrentSong *subsonic.Song `json:"currentSong"`
|
||||
UpdateTime string `json:"updateTime"`
|
||||
IsPlaying bool `json:"isPlaying"`
|
||||
CurrentSong *subsonic.Song `json:"currentSong"`
|
||||
SongHistory []*subsonic.Song `json:"songHistory"`
|
||||
UpdateTime string `json:"updateTime"`
|
||||
}
|
||||
|
||||
// handleStatus returns the current jukebox status as JSON
|
||||
|
@ -165,11 +166,13 @@ func (s *Server) handleStatus(w http.ResponseWriter, r *http.Request) {
|
|||
// getStatus returns the current status
|
||||
func (s *Server) getStatus() StatusResponse {
|
||||
currentSong := s.jukebox.GetCurrentSong()
|
||||
songHistory := s.jukebox.GetSongHistory()
|
||||
isPlaying := s.bot.IsPlaying()
|
||||
|
||||
return StatusResponse{
|
||||
IsPlaying: isPlaying,
|
||||
CurrentSong: currentSong,
|
||||
SongHistory: songHistory,
|
||||
UpdateTime: time.Now().Format(time.RFC3339),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue