This commit is contained in:
parent
7ecb57a8fd
commit
8fccb0886f
@ -99,10 +99,16 @@ func Run(c *commands.Commander, s fx.Shutdowner) {
|
||||
Name: "download_cover",
|
||||
Usage: "Downloads the cover of the current song",
|
||||
Aliases: []string{"dl"},
|
||||
Args: true,
|
||||
ArgsUsage: "download_cover <path>",
|
||||
Flags: []cli.Flag{
|
||||
&cli.PathFlag{
|
||||
Name: "path",
|
||||
Aliases: []string{"p"},
|
||||
Usage: "Path to save the cover",
|
||||
DefaultText: "./cover.png",
|
||||
},
|
||||
},
|
||||
Action: func(cCtx *cli.Context) error {
|
||||
return c.DownloadCover(cCtx.Args().First())
|
||||
return c.DownloadCover(cCtx.Path("path"))
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -115,6 +121,7 @@ func Run(c *commands.Commander, s fx.Shutdowner) {
|
||||
},
|
||||
},
|
||||
}
|
||||
app.Suggest = true
|
||||
if err := app.Run(os.Args); err != nil {
|
||||
slog.Error("COMMANDER", "run error", err)
|
||||
os.Exit(1)
|
||||
|
@ -6,6 +6,9 @@ import (
|
||||
)
|
||||
|
||||
func (c *Commander) DownloadCover(path string) error {
|
||||
if path == "" {
|
||||
path = "cover.png"
|
||||
}
|
||||
destinationPath := filepath.Clean(path)
|
||||
state, err := c.Client.PlayerState(c.Context)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user