jteeuwen/go-pkg-mpd — pull request #4 by fmoralesc (2012-09-17 05:10:50+00:00)
Title: Add support for the idle command

Just some changes to add support for the idle command, so there's no need to check manually for changes in the server.

It adds a new Type, SubSystem, and two functions: Idle (it polls for changes in any subsystem) and IdleSubSystem (it polls for changes in a specific subsystem).

An example of its usage:

package main

import (
"fmt"
"github.com/fmoralesc/go-pkg-mpd"
)

func main() {
c , _ := mpd.Dial("127.0.0.1:6600", "")
for true {
c.IdleSubSystem(mpd.PlayerSystem)
s, _ := c.Status()
if s.State == mpd.Playing {
fmt.Println("playing")
} else {
fmt.Println("not playing")
}
}
}