feat: make quality and output_path_template optional
Some checks failed
build / build (push) Failing after 24s

This commit is contained in:
Viktor Varland 2025-04-14 12:36:14 +02:00
parent 8eb2193f3c
commit 643a5fcbcd
Signed by: varl
GPG key ID: 7459F0B410115EE8

View file

@ -52,13 +52,11 @@ func Youtube(d Download, p config.Provider) {
"--sleep-subtitles", throttle, "--sleep-subtitles", throttle,
"--sleep-requests", throttle, "--sleep-requests", throttle,
"--max-sleep-interval", "90", "--max-sleep-interval", "90",
"--format-sort", p.Quality,
"--prefer-free-formats", "--prefer-free-formats",
"--write-subs", "--write-subs",
"--no-write-automatic-subs", "--no-write-automatic-subs",
"--sub-langs", "en", "--sub-langs", "en",
"--paths", outdir, "--paths", outdir,
"--output", p.Output_path_template,
"--download-archive", archive, "--download-archive", archive,
"--break-on-existing", "--break-on-existing",
"--playlist-items", p.Range, "--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, 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()) args = append(args, channelUrl.String())
cmd := exec.Command(p.Cmd, args...) cmd := exec.Command(p.Cmd, args...)