#!/bin/sh # RMRP - rich [wo]man's radio player, a PMRP rip-off # License: CC0 1.0 Universal # http://efe.kim/files/scripts/rmrp # http://efe.kim/files/misc/stations stnfile="$HOME/.stations" player="mpg123 --control --utf8 --title --preload 1 --buffer 768" picker="slmenu -t -i -p STN: -l $(( $(tput lines) - 1 ))" # see also: fzf, fzy station=$(sed -E '/^(#|$)/d;s/[^[:space:]]*[[:space:]]//' "$stnfile" |\ nl -w 3 -s ' ' | $picker |\ sed 's/^[[:space:]]*\([0-9][0-9]*\)[[:space:]].*/\1/') clear [ -z "$station" ] && exit 1 $player "$(sed -E '/^(#|$)/d' "$stnfile" | sed ''"$station"'!d')"