12 lines
		
	
	
		
			316 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			12 lines
		
	
	
		
			316 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
#
 | 
						|
# Select and play a song from the current playlist (using fzf)
 | 
						|
#
 | 
						|
 | 
						|
set -e
 | 
						|
 | 
						|
song=$(mpc -f "%position%) %artist% - %title%" playlist)
 | 
						|
song_index=$(fzf --query="$1" --select-1 --exit-0 --prompt='play > ' <<<"$song" | sed -n 's/^\([0-9]\+\)).*/\1/p')
 | 
						|
[[ $song_index ]] && mpc -q play "$song_index"
 |