1
0

Added a playlist instance and pass a PlaylistNext handler.

This commit is contained in:
Alexander Andreev 2023-10-01 01:33:55 +04:00
parent 88b5f21343
commit ca33de09cc
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -38,8 +38,12 @@ func main() {
r := httpr.New()
lstnrs := radio.NewListeners()
plylst, err := radio.NewPlaylist(*playlist, true)
if err != nil {
log.Fatalln(err)
}
djh := ihttp.NewDJHandlers(lstnrs)
djh := ihttp.NewDJHandlers(lstnrs, plylst)
s := r.Sub("/listener")
s.Handler(http.MethodGet, "/", djh.ListenersGet)
@ -47,7 +51,7 @@ func main() {
s.Handler(http.MethodDelete, "/", djh.ListenersDec)
s = r.Sub("/playlist")
s.Handler(http.MethodGet, "/", http.NotFound)
s.Handler(http.MethodGet, "/", djh.PlaylistNext)
s = r.Sub("/song")
s.Handler(http.MethodGet, "/", http.NotFound)