Created
March 17, 2022 02:05
-
-
Save ortango/f84277c959c3b2c719abe1a7eaaddda7 to your computer and use it in GitHub Desktop.
quick n' dirty radio player
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pon de network:http://musicserver.local:8010 | |
TSF Jazz:https://tsfjazz.ice.infomaniak.ch/tsfjazz-high.mp3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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/\&/\&\;/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