diff options
| author | Franck Cuny <franck@fcuny.net> | 2021-10-10 11:34:07 -0700 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2022-06-11 14:32:07 -0700 |
| commit | 14744fe82699d39b56d1acf795c7ffef38139b95 (patch) | |
| tree | 8fada8cbbcc7b2eae807621eb143f1ca15574642 /tools/mpd-stats/cmd/mpd-scrobbler/main.go | |
| parent | mpd: rename function to create the player (diff) | |
| download | infra-14744fe82699d39b56d1acf795c7ffef38139b95.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 'tools/mpd-stats/cmd/mpd-scrobbler/main.go')
| -rw-r--r-- | tools/mpd-stats/cmd/mpd-scrobbler/main.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/mpd-stats/cmd/mpd-scrobbler/main.go b/tools/mpd-stats/cmd/mpd-scrobbler/main.go index 3953123..ba7bb05 100644 --- a/tools/mpd-stats/cmd/mpd-scrobbler/main.go +++ b/tools/mpd-stats/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 |
