From 2fcaad5c1c9e59a2e4deca67bcda9f5cff9357c8 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 26 Jul 2024 10:57:21 +0200 Subject: [PATCH] vidl: Slightly improve url ingestion and error output --- scripts/.local/bin/vidl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/.local/bin/vidl b/scripts/.local/bin/vidl index 0349ac7..0cdca44 100755 --- a/scripts/.local/bin/vidl +++ b/scripts/.local/bin/vidl @@ -124,7 +124,7 @@ download() { # 1=url elif _should_archive; then archive_file=$(_findfile "$ARCHIVE_FOLDER" "$yt_dl_fname") echo "$archive_file" | while read -r file; do - echo "file $file exists, not downloading duplicate" + printf "File %s exists, not downloading duplicate.\n" "$file" _call_archive "$file" "$DL_FOLDER" done fi @@ -132,8 +132,8 @@ download() { # 1=url setup() { TEMP_FOLDER="${TEMP_FOLDER:-${HOME}/downloads}" - DL_FOLDER="${DL_FOLDER:-${XDG_VIDEOS_DIR:-$HOME/media/videos}/inbox}" - ARCHIVE_FOLDER="${ARCHIVE_FOLDER:-${XDG_VIDEOS_DIR:-$HOME/media/videos}/archive}" + 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-chapters --embed-subs --sub-lang "en,de,es,fr") declare -a YT_DL_OPTS=${YT_DL_OPTS:-( "${yt_default_opts[@]}" )} @@ -160,6 +160,7 @@ add_to_queue() { # 1=url } remove_from_queue() { # 1=url + printf "Removing url %s from queue.\n" "$1" sed -i.bak -e "\|$1|d" "$queue_file" } @@ -201,7 +202,7 @@ main() { exit fi - for url in $*; do + for url in "$@"; do add_to_queue "$url" done if is_only_instance; then