mirror of
https://github.com/Superredstone/spotiflac-cli.git
synced 2026-03-07 20:18:07 +01:00
feat: add auto playlist/track recognize
This commit is contained in:
20
main.go
20
main.go
@@ -6,7 +6,6 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/Superredstone/spotiflac-cli/app"
|
||||
"github.com/Superredstone/spotiflac-cli/lib"
|
||||
"github.com/Superredstone/spotiflac-cli/pkg"
|
||||
"github.com/urfave/cli/v3"
|
||||
)
|
||||
@@ -14,7 +13,6 @@ import (
|
||||
func main() {
|
||||
var song_url string
|
||||
application := app.NewApp()
|
||||
startup()
|
||||
|
||||
cmd := &cli.Command{
|
||||
Name: "spotiflac-cli",
|
||||
@@ -26,25 +24,11 @@ func main() {
|
||||
},
|
||||
},
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
pkg.Download(application, song_url)
|
||||
|
||||
return nil
|
||||
err := pkg.Download(application, song_url)
|
||||
return err
|
||||
},
|
||||
}
|
||||
if err := cmd.Run(context.Background(), os.Args); err != nil {
|
||||
log.Fatal(err)
|
||||
shutdown()
|
||||
}
|
||||
|
||||
shutdown()
|
||||
}
|
||||
|
||||
func startup() {
|
||||
if err := lib.InitHistoryDB("SpotiFLAC"); err != nil {
|
||||
log.Fatal("Failed to init history DB: %v\n", err)
|
||||
}
|
||||
}
|
||||
|
||||
func shutdown() {
|
||||
lib.CloseHistoryDB()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user