Skip to content

Instantly share code, notes, and snippets.

@ortango
Created March 17, 2022 02:05
Show Gist options
  • Save ortango/f84277c959c3b2c719abe1a7eaaddda7 to your computer and use it in GitHub Desktop.
Save ortango/f84277c959c3b2c719abe1a7eaaddda7 to your computer and use it in GitHub Desktop.
quick n' dirty radio player
pon de network:http://musicserver.local:8010
TSF Jazz:https://tsfjazz.ice.infomaniak.ch/tsfjazz-high.mp3
#!/bin/bash
radio_ipc="${XDG_RUNTIME_DIR:-/tmp}/radio-ipc"
_ipc() { printf '%s\n' $@ | jq -Rnc '{command:[inputs]}' | socat - "$radio_ipc" &>/dev/null; }
case $1 in
pause|mute) _ipc cycle $1;;
stop|quit) _ipc quit; rm "$radio_ipc";;
play)
if lsof "$radio_ipc" &>/dev/null; then
_ipc loadfile "$2"
else
exec mpv --no-video "--input-ipc-server=${radio_ipc}" "$2" &>/dev/null&
fi
;;
esac
#!/bin/bash
radio_dir="${HOME}/radio/"
_rset() { printf '\0%s\x1f%s\n' "$1" "$2"; }
if (( ! ROFI_RETV )); then
while read -r entry; do
printf '%s' "${entry%%:*}"
_rset info "${entry#*:}"
done < "${radio_dir}/ease_up" | sed 's/\&/\&amp\;/g'
else
notify-send -h string:x-canonical-private-synchronous:radio "SELECTOR,PLAYTHATSHIT" "$1"
"${radio_dir}/playthat.sh" play "$ROFI_INFO"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment