Launch and stop liquidsoap in a main file.
This commit is contained in:
parent
0da8077ab7
commit
23f246857e
@ -4,8 +4,10 @@ import (
|
||||
"dwelling-radio/internal/configuration"
|
||||
"dwelling-radio/internal/handlers"
|
||||
"dwelling-radio/internal/radio"
|
||||
"dwelling-radio/internal/radio/liquidsoap"
|
||||
"dwelling-radio/pkg/logging"
|
||||
"dwelling-radio/pkg/server"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
@ -63,6 +65,11 @@ func main() {
|
||||
srv.GET("/lastsong", hand.LastSong)
|
||||
srv.GET("/playlist", hand.Playlist)
|
||||
|
||||
liquid, err := liquidsoap.NewLiquidsoap(config.Liquidsoap.ExecPath, config.Liquidsoap.ScriptPath)
|
||||
if err != nil {
|
||||
logErr.Fatalln("liquidsoap:", err)
|
||||
}
|
||||
|
||||
if err := srv.Start(config.SplitNetworkAddress()); err != nil {
|
||||
logErr.Fatalln(err)
|
||||
}
|
||||
@ -84,6 +91,12 @@ func main() {
|
||||
|
||||
<-doneSignal
|
||||
|
||||
if err := liquid.Stop(); err != nil {
|
||||
if !errors.Is(err, liquidsoap.ErrNotRunning) {
|
||||
logErr.Println("liquidsoap:", err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := srv.Stop(); err != nil {
|
||||
logErr.Fatalln(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user