Monitor MPD FIFO output status for audio sources
This commit is contained in:
9 files changed
+159
-1
No files matched your search
@@ -33,6 +33,8 @@ type Player struct {
|
||||
Version Version
|
||||
|
||||
name string
|
||||
audioSource config.Audio
|
||||
fifoState string
|
||||
addr string
|
||||
password string
|
||||
idleSubsystems []string
|
||||
@@ -226,6 +228,10 @@ func (p *Player) sendDataCommand(conn *clientConn, format string, args ...interf
|
||||
if line == "OK" {
|
||||
break
|
||||
}
|
||||
if strings.HasPrefix(line, "ACK ") {
|
||||
err = textproto.ProtocolError(line)
|
||||
break
|
||||
}
|
||||
|
||||
lines = append(lines, line)
|
||||
}
|
||||
@@ -443,6 +449,7 @@ func (p *Player) mainLoop(conn *clientConn, events chan player.Event) {
|
||||
defer ticker.Stop()
|
||||
|
||||
var err error
|
||||
var outputCheck time.Time
|
||||
loop:
|
||||
for {
|
||||
select {
|
||||
@@ -469,6 +476,10 @@ loop:
|
||||
}
|
||||
|
||||
case <-ticker.C:
|
||||
if p.audioSource.Type == "fifo" && time.Since(outputCheck) >= 15*time.Second {
|
||||
outputCheck = time.Now()
|
||||
p.checkFIFOOutput(conn)
|
||||
}
|
||||
var status map[string]string
|
||||
if status, err = p.sendMapCommand(conn, "status"); err != nil {
|
||||
log.WithError(err).Error("error retrieving status")
|
||||
|
||||
Reference in new issue
Block a user