diff options
author | Franck Cuny <franck@fcuny.net> | 2022-10-24 17:32:17 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-10-24 17:32:17 -0700 |
commit | fe7dfdd250b701177f051ad6cdc3dc68695cbfc4 (patch) | |
tree | 99d7cf0230ad604c256df2225c1d32ef4266d4ec /tools/mpd-stats/internal/mpd | |
parent | feat(home/packages): install git-broom (diff) | |
download | world-fe7dfdd250b701177f051ad6cdc3dc68695cbfc4.tar.gz |
ref(tools/mpd-stats): delete the project
It's been moved to its own repository at https://github.com/fcuny/mpd-stats Update the list of repositories managed by terraform.
Diffstat (limited to 'tools/mpd-stats/internal/mpd')
-rw-r--r-- | tools/mpd-stats/internal/mpd/mpd.go | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/tools/mpd-stats/internal/mpd/mpd.go b/tools/mpd-stats/internal/mpd/mpd.go deleted file mode 100644 index 859348e..0000000 --- a/tools/mpd-stats/internal/mpd/mpd.go +++ /dev/null @@ -1,54 +0,0 @@ -package mpd - -import ( - "log" - "time" - - "github.com/fhs/gompd/v2/mpd" -) - -const ( - // List of subsystems: https://mpd.readthedocs.io/en/latest/protocol.html#querying-mpd-s-status - SubSystemPlayer = "player" -) - -type Player struct { - Watcher *mpd.Watcher - Client *mpd.Client -} - -func NewPlayer(net string, addr string) (*Player, error) { - var ( - p Player - err error - ) - - // We are only subscribing to the player subsystem - p.Watcher, err = mpd.NewWatcher(net, addr, "", SubSystemPlayer) - if err != nil { - log.Fatalf("failed to create a watcher: %v", err) - } - - p.Client, err = mpd.Dial(net, addr) - if err != nil { - log.Fatalf("failed to start mpd client: %v", err) - } - - go func() { - for range time.Tick(30 * time.Second) { - p.Client.Ping() - } - }() - - return &p, nil -} - -func (p *Player) Close() error { - if err := p.Watcher.Close(); err != nil { - return err - } - if err := p.Client.Close(); err != nil { - return err - } - return nil -} |