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