mirror of
https://github.com/Superredstone/spotiflac-cli.git
synced 2026-03-07 20:18:07 +01:00
feat: add --override flag
This commit is contained in:
@@ -7,6 +7,7 @@ type App struct {
|
||||
ApiInterval int // How many ms to wait between one call to apis and the other
|
||||
NoFallback bool
|
||||
StopOnFail bool
|
||||
OverrideDownload bool
|
||||
}
|
||||
|
||||
func NewApp() App {
|
||||
|
||||
@@ -199,7 +199,7 @@ func (app *App) DownloadTrack(url string, outputFile string, service string, qua
|
||||
return err
|
||||
}
|
||||
|
||||
if fileExists {
|
||||
if fileExists && !app.OverrideDownload {
|
||||
app.log("File " + outputFile + " already exists")
|
||||
return nil
|
||||
}
|
||||
|
||||
7
main.go
7
main.go
@@ -54,15 +54,18 @@ func main() {
|
||||
&cli.BoolFlag{
|
||||
Name: "no-fallback",
|
||||
Usage: "do not fallback in case a source is not found",
|
||||
DefaultText: strconv.FormatBool(app.NoFallback),
|
||||
Destination: &app.NoFallback,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "stop-on-fail",
|
||||
Usage: "continue on download failure",
|
||||
DefaultText: strconv.FormatBool(app.StopOnFail),
|
||||
Destination: &app.StopOnFail,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "override",
|
||||
Usage: "override already downloaded songs",
|
||||
Destination: &app.OverrideDownload,
|
||||
},
|
||||
},
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
song_url := cmd.Args().First()
|
||||
|
||||
Reference in New Issue
Block a user