#!/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" playeropts="--control --utf8 --title --preload 1 --buffer 768" picker="fzf" pickeropts="--color=bw --nth=2.. --delimiter=[[:space:]]" ### Alternatives #player="mpv" #playeropts="--no-video --load-scripts=no --no-msg-color --cache-secs=120 --force-seekable=yes" #picker="slmenu" #pickeropts="-t -p STA: -l $(( $(tput lines) - 1 ))" if ! command -v "$player" >/dev/null 2>&1 -o ! command -v "$picker" >/dev/null 2>&1 then printf "\033c" echo "RMRP requires $player and $picker. Please install both to enjoy RMRP." >&2 exit 1 fi station=$(sed -E '/^(#|$)/d;s/[^[:space:]]*[[:space:]]//' "$stnfile" | nl |\ $picker $pickeropts | sed 's/^[[:space:]]*\([0-9][0-9]*\)[[:space:]].*/\1/') [ -z "$station" ] && exit 1 $player $playeropts "$(sed -E '/^(#|$)/d' "$stnfile" | sed ''"$station"'!d')" $0