refactor: direttoforo.State

This commit is contained in:
boyska 2017-07-29 02:06:38 +02:00
parent 7ce86918bc
commit afbd5f2f69
2 changed files with 18 additions and 12 deletions

View file

@ -8,26 +8,17 @@ import (
"os/signal"
"time"
"git.lattuga.net/boyska/direttoforo"
"git.lattuga.net/boyska/direttoforo/liquidsoap"
"git.lattuga.net/boyska/direttoforo/uiserver"
)
type State struct {
Streams map[string]liquidsoap.Stream
}
func NewState() State {
s := State{}
s.Streams = make(map[string]liquidsoap.Stream)
return s
}
func main() {
liqfile := flag.String("liq", "foo.liq", "Path to liquidsoap script to run")
bindpath := flag.String("bindpath", "/var/lib/direttoforo/ui.sock", "UNIX domain socket path for UIs")
flag.Parse()
state := NewState()
state := direttoforo.NewState()
netUIsock, err := net.Listen("unix", *bindpath)
if err != nil {
@ -74,7 +65,9 @@ func main() {
t.Conn.SetDeadline(time.Now().Add(3 * time.Second))
outs, err := t.Outputs()
if err != nil {
fmt.Println("telnet cmd errored", err)
if err.Error() != "EOF" {
fmt.Println("telnet cmd errored", err)
}
continue
}
changed := false

13
direttoforo.go Normal file
View file

@ -0,0 +1,13 @@
package direttoforo
import "git.lattuga.net/boyska/direttoforo/liquidsoap"
type State struct {
Streams map[string]liquidsoap.Stream
}
func NewState() State {
s := State{}
s.Streams = make(map[string]liquidsoap.Stream)
return s
}