Fix queueing up files, validate files (loosely) before continuing
This commit is contained in:
		
							
								
								
									
										14
									
								
								ptgdp
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								ptgdp
									
									
									
									
									
								
							@@ -125,7 +125,16 @@ cachesong() {
 | 
			
		||||
			"$1")
 | 
			
		||||
		then
 | 
			
		||||
			# Sanitize removes all periods, so this is safe
 | 
			
		||||
			_return="$filename".*
 | 
			
		||||
			for file in "$filename".*; do
 | 
			
		||||
				if [ -f "$file" ]; then
 | 
			
		||||
					_return="$file"
 | 
			
		||||
				else
 | 
			
		||||
					error "Downloaded song \"$_return\" but could not find output file"
 | 
			
		||||
					log "$ytdllog" 2
 | 
			
		||||
					_returnstatus="err"
 | 
			
		||||
					return 1
 | 
			
		||||
				fi
 | 
			
		||||
			done
 | 
			
		||||
			_returnstatus="dl"
 | 
			
		||||
			log "Downloaded song to \"$_return\"" 2
 | 
			
		||||
			log "$ytdllog" 2
 | 
			
		||||
@@ -202,7 +211,8 @@ backend-enqueue() { # Enqueues a song
 | 
			
		||||
		mpd)
 | 
			
		||||
			file=${1##$_mpdroot/}
 | 
			
		||||
			if ! mpc add "$file" > /dev/null 2>&1; then
 | 
			
		||||
				error "Could not add file: \"$file\" ($?)"
 | 
			
		||||
				errorval="$?"
 | 
			
		||||
				error "Could not add file: \"$file\" ($errorval)"
 | 
			
		||||
			fi
 | 
			
		||||
			return 0
 | 
			
		||||
			;;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user