From a63dc3d875f00080c43074b6e0328064a6fce22c Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 21 Jan 2022 10:11:10 -0800 Subject: mpd: we only want events from the player subsystem Store the name of the subsystem in a constant, add some comments on where to find the list. --- tools/mpd-stats/internal/mpd/mpd.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools/mpd-stats/internal/mpd/mpd.go') diff --git a/tools/mpd-stats/internal/mpd/mpd.go b/tools/mpd-stats/internal/mpd/mpd.go index 5b57ee4..859348e 100644 --- a/tools/mpd-stats/internal/mpd/mpd.go +++ b/tools/mpd-stats/internal/mpd/mpd.go @@ -7,6 +7,11 @@ import ( "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 @@ -18,7 +23,8 @@ func NewPlayer(net string, addr string) (*Player, error) { err error ) - p.Watcher, err = mpd.NewWatcher(net, addr, "", "player") + // 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) } -- cgit 1.4.1