Update radio setup - add notifications

This commit is contained in:
Wiktor Zykubek 2021-02-18 18:46:39 +01:00
parent c5e097e24e
commit d16664fad8
7 changed files with 25 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -2,7 +2,7 @@
# Select internet radio station and play it in mpd.
OPEN_FM_CHANNELS_LIST="$HOME/.config/openfm_channels.json"
OPEN_FM_CHANNELS_LIST="$HOME/.config/radio/openfm_channels.json"
STATIONS="$(sed 's/: .*//g; s/ /Open FM: /; s/"//g; s/}//g; s/{//g; /^$/d' "$OPEN_FM_CHANNELS_LIST")
newonce.radio
@ -13,17 +13,36 @@ Radio ZET"
station=$(echo "$STATIONS" | rofi -dmenu -i -l 20 -p ' Radio Station')
[ ! "$station" ] && exit
channel=""
case "$station" in
"newonce.radio") radio="http://streamer.radio.co/s93b51ccc1/listen" ;;
"RMF FM") radio="http://195.150.20.4:8000/rmf_fm" ;;
"RMF Maxxx") radio="http://195.150.20.4:8000/rmf_maxxx" ;;
"Radio ZET") radio="https://zt02.cdn.eurozet.pl/zet-old.mp3" ;;
"newonce.radio")
radio="http://streamer.radio.co/s93b51ccc1/listen"
icon="newonce.radio-logo.png"
;;
"RMF FM")
radio="http://195.150.20.4:8000/rmf_fm"
icon="rmf-fm-logo.png"
;;
"RMF Maxxx")
radio="http://195.150.20.4:8000/rmf_maxxx"
icon="rmf-maxxx-logo.png"
;;
"Radio ZET")
radio="https://zt02.cdn.eurozet.pl/zet-old.mp3"
icon="radio-zet-logo.png"
;;
*)
id="$(grep "\"$(echo "$station" | sed 's/Open FM: //g')\"" "$OPEN_FM_CHANNELS_LIST" | sed 's/.*: //g; s/"//g; s/,//g')"
radio="http://stream.open.fm/$id"
icon="open-fm-logo.png"
channel="$(echo "$station" | sed 's/Open FM: //g')"
station="Open FM"
;;
esac
mpc clear
mpc add "$radio"
mpc play
notify-send --icon "$HOME/.config/radio/$icon" "$station" "$channel"

View File

@ -8,7 +8,7 @@ if playerctl --player=spotify status | grep -q "Playing"; then
elif [ "$(mpc status | awk 'NR==2 {print $1}')" = "[playing]" ]; then
if mpc status -f "%file%" | grep -q "open.fm"; then
channel_id="$(mpc status -f "%name%" | awk 'NR==1 {print $1}')"
name="$(grep \""$channel_id"\" /home/samedamci/.config/openfm_channels.json | sed 's/: .*//g; s/ //; s/"//g' | tr -d '\n')"
name="$(grep \""$channel_id"\" "$HOME/.config/radio/openfm_channels.json" | sed 's/: .*//g; s/ //; s/"//g' | tr -d '\n')"
printf "%s" "Open FM: $name"
title="$(mpc status -f "%title%" | awk 'NR==1' | sed 's/ w .*//g; s/& .* -/-/g; s/feat. .* -/-/g; s/REKLAMA - open.fm - REKLAMA//g')"
[ ! "$title" = "" ] && printf "%s" ": $title"