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.
This commit is contained in:
Marty Oehme 2021-12-11 11:17:58 +01:00
parent 4d563be7a4
commit 60ae405790
Signed by: Marty
GPG Key ID: B7538B8F50A1C800
1 changed files with 3 additions and 3 deletions

View File

@ -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"
}