From 1a29e26ab8223bdeea6544785a0539d64976f4ab Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 10 Oct 2021 13:01:21 -0700 Subject: mpd-stats: pass database path to the scrobbler When creating a scrobbler, we provide the path to the database. The scrobbler then get a handler to the database. When a new record is created, we persist it to the database using the `save` function. --- tools/mpd-stats/cmd/mpd-scrobbler/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/mpd-stats/cmd') diff --git a/tools/mpd-stats/cmd/mpd-scrobbler/main.go b/tools/mpd-stats/cmd/mpd-scrobbler/main.go index 3540807..fdd9e4d 100644 --- a/tools/mpd-stats/cmd/mpd-scrobbler/main.go +++ b/tools/mpd-stats/cmd/mpd-scrobbler/main.go @@ -1,7 +1,9 @@ package main import ( + "fmt" "log" + "os" "golang.fcuny.net/mpd-stats/internal/scrobbler" ) @@ -9,8 +11,9 @@ import ( func main() { net := "tcp" addr := "localhost:6600" + dbpath := fmt.Sprintf("%s/.config/scrobbler.sql", os.Getenv("HOME")) - s, err := scrobbler.NewScrobbler(net, addr) + s, err := scrobbler.NewScrobbler(net, addr, dbpath) if err != nil { log.Fatalf("failed to create a client: %v", err) } -- cgit 1.4.1