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/cmd/mpd-scrobbler/main.go | |
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/cmd/mpd-scrobbler/main.go')
-rw-r--r-- | tools/mpd-stats/cmd/mpd-scrobbler/main.go | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/tools/mpd-stats/cmd/mpd-scrobbler/main.go b/tools/mpd-stats/cmd/mpd-scrobbler/main.go deleted file mode 100644 index c2693a4..0000000 --- a/tools/mpd-stats/cmd/mpd-scrobbler/main.go +++ /dev/null @@ -1,57 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "log" - "os" - "path/filepath" - - "golang.fcuny.net/mpd-stats/internal/scrobbler" -) - -func main() { - var ( - mpdHost = flag.String("host", "localhost", "The MPD server to connect to (default: localhost)") - mpdPort = flag.Int("port", 6600, "The TCP port of the MPD server to connect to (default: 6600)") - ) - flag.Parse() - - net := "tcp" - addr := fmt.Sprintf("%s:%d", *mpdHost, *mpdPort) - - dbpath, err := getDbPath() - if err != nil { - log.Fatalf("failed to get the path to the database: %v", err) - } - - s, err := scrobbler.NewScrobbler(net, addr, dbpath) - if err != nil { - log.Fatalf("failed to create a client: %v", err) - } - - defer func() { - if err := s.Close(); err != nil { - log.Fatalf("failed to close the scrobbler: %v", err) - } - }() - - s.Run() -} - -func getDbPath() (string, error) { - xch := os.Getenv("XDG_CONFIG_HOME") - if xch == "" { - home := os.Getenv("HOME") - xch = filepath.Join(home, ".config") - } - - scrobblerHome := filepath.Join(xch, "mpd-scrobbler") - if _, err := os.Stat(scrobblerHome); os.IsNotExist(err) { - if err := os.Mkdir(scrobblerHome, 0755); err != nil { - return "", err - } - } - - return filepath.Join(scrobblerHome, "scrobbler.sql"), nil -} |