From 643a5fcbcd823d83da246dc959be48793eb0f074 Mon Sep 17 00:00:00 2001 From: Viktor Varland Date: Mon, 14 Apr 2025 12:36:14 +0200 Subject: [PATCH] feat: make quality and output_path_template optional --- internal/dl/dl.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/dl/dl.go b/internal/dl/dl.go index 07c30d0..cd21b4a 100644 --- a/internal/dl/dl.go +++ b/internal/dl/dl.go @@ -52,13 +52,11 @@ func Youtube(d Download, p config.Provider) { "--sleep-subtitles", throttle, "--sleep-requests", throttle, "--max-sleep-interval", "90", - "--format-sort", p.Quality, "--prefer-free-formats", "--write-subs", "--no-write-automatic-subs", "--sub-langs", "en", "--paths", outdir, - "--output", p.Output_path_template, "--download-archive", archive, "--break-on-existing", "--playlist-items", p.Range, @@ -98,6 +96,20 @@ func Youtube(d Download, p config.Provider) { args = append(args, fmt.Sprintf("youtube:po_token=web.gvs+%s", p.Po_token)) } + args = append(args, "--format-sort") + if p.Quality != "" { + args = append(args, p.Quality) + } else { + args = append(args, "res:1080") + } + + args = append(args, "--output") + if p.Output_path_template != "" { + args = append(args, p.Output_path_template) + } else { + args = append(args, "s%(upload_date>%Y)s/%(channel)s.s%(upload_date>%Y)Se%(upload_date>%m%d)S.%(title)s.%(id)s-1080p.%(ext)s") + } + args = append(args, channelUrl.String()) cmd := exec.Command(p.Cmd, args...)