Checkpoint
This commit is contained in:
125 files changed
+59376
No files matched your search
@@ -0,0 +1,36 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
bragi "git.maze.io/go/bragi"
|
||||
)
|
||||
|
||||
func main() {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
|
||||
s := bragi.NewMPD("volumio.local:6600")
|
||||
log := logrus.WithField("source", s.Name())
|
||||
log.Info("created source")
|
||||
for e := range s.Events() {
|
||||
switch e := e.(type) {
|
||||
case *bragi.ConnectedEvent:
|
||||
log.Info("connected")
|
||||
|
||||
case *bragi.DisconnectedEvent:
|
||||
log.Info("disconnected")
|
||||
|
||||
case *bragi.StatusEvent:
|
||||
t := e.Status.Track
|
||||
if t != nil {
|
||||
logrus.
|
||||
WithField("track", t).
|
||||
WithField("file", t.Path).
|
||||
Info("received track")
|
||||
}
|
||||
|
||||
default:
|
||||
log.WithField("event", e).Info("received event")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user