From 60ae4057900936c9160e581c4423ece7b12c897c Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Sat, 11 Dec 2021 11:17:58 +0100 Subject: [PATCH] scripts: Add custom ytdl options for vidl Allow setting custom ytdl options for the vidl video downloader. Can be set through $YT_DL_OPTS environment option. --- scripts/.local/bin/vidl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/.local/bin/vidl b/scripts/.local/bin/vidl index 9d4dab3..f5b4e36 100755 --- a/scripts/.local/bin/vidl +++ b/scripts/.local/bin/vidl @@ -5,6 +5,8 @@ DL_FOLDER="${DL_FOLDER:-${XDG_VIDEOS_DIR:-$HOME/videos}}/inbox" ARCHIVE_FOLDER="${ARCHIVE_FOLDER:-${XDG_VIDEOS_DIR:-$HOME/videos}}/archive" YT_DL_CMD="${YT_DL_CMD:-yt-dlp}" +yt_default_opts=(-f "best[height\<=1080]" --retries 15 --embed-subs --sub-lang "en,de,es,fr") +declare -a YT_DL_OPTS=${YT_DL_OPTS:-( "${yt_default_opts[@]}" )} YT_DL_TITLE="""${YT_DL_TITLE:-%(channel)s_%(title)s_%(id)s}""" show_help() { @@ -71,10 +73,8 @@ _findfile() { YT_DL_TITLE="%(channel)s_%(title)s_%(id)s" _download() { "$YT_DL_CMD" \ - -f 'best[height<=1080]' \ -o "$DL_FOLDER/$YT_DL_TITLE.%(ext)s" \ - --write-sub --write-auto-sub --embed-subs --sub-lang en,de,es,fr \ - --retries 15 \ + "${YT_DL_OPTS[@]}" \ "$url" }