From 9d8a9538be60c5eacab410ba2abaf357344cf130 Mon Sep 17 00:00:00 2001 From: Superredstone Date: Sat, 28 Feb 2026 16:39:51 +0100 Subject: [PATCH] feat: add --override flag --- lib/app.go | 1 + lib/download.go | 2 +- main.go | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/app.go b/lib/app.go index a4544e5..9f6bb53 100644 --- a/lib/app.go +++ b/lib/app.go @@ -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 { diff --git a/lib/download.go b/lib/download.go index 4d2ad8e..7121dfd 100644 --- a/lib/download.go +++ b/lib/download.go @@ -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 } diff --git a/main.go b/main.go index cce48a8..e31fc94 100644 --- a/main.go +++ b/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()