gospt/main.go

44 lines
724 B
Go
Raw Normal View History

2023-01-07 07:40:39 +00:00
package main
import (
"context"
"fmt"
2023-01-08 00:03:43 +00:00
"log"
2023-01-07 07:40:39 +00:00
"os"
"path/filepath"
"gospt/authmanager"
"gospt/config"
2023-01-08 00:03:43 +00:00
"gospt/ctx"
2023-01-07 07:40:39 +00:00
"gospt/runner"
"github.com/zmb3/spotify/v2"
spotifyauth "github.com/zmb3/spotify/v2/auth"
)
var (
auth *spotifyauth.Authenticator
ch = make(chan *spotify.Client)
state = "abc123"
)
func init() {
homeDir, _ := os.UserHomeDir()
configDir := filepath.Join(homeDir, ".config/gospt/")
config.LoadConfig(configDir)
}
func main() {
var err error
2023-01-08 00:03:43 +00:00
log.New(os.Stdout, "LOG:", 0)
ctx := ctx.NewContext(context.Background())
2023-01-07 07:40:39 +00:00
client, err := authmanager.GetClient(ctx)
if err != nil {
panic(err.Error())
}
2023-01-08 00:03:43 +00:00
err = runner.Run(ctx, client, os.Args[1:])
2023-01-07 07:40:39 +00:00
if err != nil {
fmt.Println(err)
}
}