aboutsummaryrefslogtreecommitdiff
path: root/cmd/mpd-scrobbler
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2021-10-10 11:34:07 -0700
committerFranck Cuny <franck@fcuny.net>2021-10-10 11:34:07 -0700
commit5caeabc351feffb1769b842e8d79481f330c46d9 (patch)
tree67552aa54c8ec822b9d836e738ab82248bd1554b /cmd/mpd-scrobbler
parentmpd: rename function to create the player (diff)
downloadx-5caeabc351feffb1769b842e8d79481f330c46d9.tar.gz
mpd: add function `Close` to the player
Let's close both the watcher and the client, instead of leaking this interface to the user.
Diffstat (limited to 'cmd/mpd-scrobbler')
-rw-r--r--cmd/mpd-scrobbler/main.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/mpd-scrobbler/main.go b/cmd/mpd-scrobbler/main.go
index 3953123..ba7bb05 100644
--- a/cmd/mpd-scrobbler/main.go
+++ b/cmd/mpd-scrobbler/main.go
@@ -16,8 +16,11 @@ func main() {
log.Fatalf("failed to create a client: %v", err)
}
- defer c.Watcher.Close()
- defer c.Client.Close()
+ defer func() {
+ if err := c.Close(); err != nil {
+ log.Fatalf("failed to close the player: %v", err)
+ }
+ }()
var (
currentRecord *scrobbler.Record