helm/shell/sk/bin/sk-mpc
2018-03-23 15:29:50 -04:00

12 lines
319 B
Bash
Executable file

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