From d9c7102d8b90ae340956405858e1a9eaa4425368 Mon Sep 17 00:00:00 2001 From: Salt Date: Fri, 27 Sep 2019 16:00:50 -0500 Subject: [PATCH] Improve debug logging when ytdl fails (run with -vv) --- ptgdp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ptgdp b/ptgdp index d79d0aa..f383071 100755 --- a/ptgdp +++ b/ptgdp @@ -112,7 +112,9 @@ cachesong() { sanitize "$1" filename="$_ptgdpmusicdir/$_return" if ! checksong "$_return"; then - youtube-dl \ + log "Downloading new song \"$1\"" 2 + local ytdllog + if ytdllog=$(youtube-dl \ --add-metadata \ --audio-format "best" \ --default-search "ytsearch" \ @@ -120,15 +122,16 @@ cachesong() { "${_config[ytdl_args]}" \ -x \ -o "$filename.%(ext)s" \ - "$1" \ - > /dev/null 2>&1 & - if wait $!; then + "$1") + then # Sanitize removes all periods, so this is safe _return="$filename".* _returnstatus="dl" log "Downloaded song to \"$_return\"" 2 + log "$ytdllog" 2 return 0 else + log "$ytdllog" 2 _returnstatus="err" return 1 fi