Improve debug logging when ytdl fails (run with -vv)
This commit is contained in:
		
							
								
								
									
										11
									
								
								ptgdp
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user