Improve debug logging when ytdl fails (run with -vv)

This commit is contained in:
Salt 2019-09-27 16:00:50 -05:00
parent ffb1099cb7
commit d9c7102d8b

11
ptgdp
View File

@ -112,7 +112,9 @@ cachesong() {
sanitize "$1" sanitize "$1"
filename="$_ptgdpmusicdir/$_return" filename="$_ptgdpmusicdir/$_return"
if ! checksong "$_return"; then if ! checksong "$_return"; then
youtube-dl \ log "Downloading new song \"$1\"" 2
local ytdllog
if ytdllog=$(youtube-dl \
--add-metadata \ --add-metadata \
--audio-format "best" \ --audio-format "best" \
--default-search "ytsearch" \ --default-search "ytsearch" \
@ -120,15 +122,16 @@ cachesong() {
"${_config[ytdl_args]}" \ "${_config[ytdl_args]}" \
-x \ -x \
-o "$filename.%(ext)s" \ -o "$filename.%(ext)s" \
"$1" \ "$1")
> /dev/null 2>&1 & then
if wait $!; then
# Sanitize removes all periods, so this is safe # Sanitize removes all periods, so this is safe
_return="$filename".* _return="$filename".*
_returnstatus="dl" _returnstatus="dl"
log "Downloaded song to \"$_return\"" 2 log "Downloaded song to \"$_return\"" 2
log "$ytdllog" 2
return 0 return 0
else else
log "$ytdllog" 2
_returnstatus="err" _returnstatus="err"
return 1 return 1
fi fi