Create setup to listen internet radio with mpd

This commit is contained in:
samedamci 2021-02-18 12:30:26 +01:00
parent c7c42d9f10
commit 5cb2fc47b4
No known key found for this signature in database
GPG Key ID: FCB4A9A20D00E894
5 changed files with 235 additions and 10 deletions

View File

@ -31,4 +31,9 @@ audio_output {
name "Alsa for audio sound card" name "Alsa for audio sound card"
} }
decoder {
plugin "faad"
enabled "no"
}
port "6600" port "6600"

View File

@ -0,0 +1,181 @@
{
"Top 20 Pop": "96",
"Top 20 PL": "97",
"Top 20 Impreza": "95",
"Top 20 Disco Polo": "53",
"Top 20 Hip-Hop": "98",
"Top 20 Rock": "99",
"Top 20 Alt": "83",
"Top 2020 Hits": "131",
"Radio 357": "357",
"Radio Nowy Świat": "368",
"WP Radio: muzyka i informacje": "367",
"Radiospacja": "375",
"Radio TOK FM": "200",
"Radio Złote Przeboje": "201",
"Rock Radio": "202",
"Radio Pogoda": "203",
"Radio Kolor": "331",
"newonce.radio": "374",
"Halo.Radio": "372",
"Radio Kampus": "337",
"Radio Rockserwis FM": "379",
"Polish Radio London": "373",
"Radio Akadera": "332",
"Akademickie Radio LUZ": "334",
"Radio Fest": "335",
"Radio CCM": "336",
"Radio Centrum (Lublin)": "339",
"100% Hits": "64",
"4FUN Radio": "173",
"Freszzz: Zima 2021": "39",
"Hot Lista Open FM": "327",
"#popularne": "10",
"Po Polsku": "1",
"1001 Hits": "11",
"Największe Przeboje XX w.": "163",
"Ballady Wszech Czasów": "20",
"10s Hits": "352",
"00s Hits": "72",
"90s Hits": "14",
"80s Hits": "3",
"Classic Hits": "46",
"Top Wszech Czasów - Świat": "151",
"Top Wszech Czasów - Polska": "152",
"Tylko Polskie Przeboje": "111",
"Po Polsku 90": "369",
"Po Polsku 80": "79",
"Po Polsku 60/70": "17",
"Polskie Ballady": "165",
"Girl Power!": "364",
"K-pop": "147",
"Gwiazdy": "58",
"Latino Hits": "19",
"100% Ed Sheeran": "134",
"100% One Direction": "80",
"Dzień Dobry!": "69",
"Praca": "109",
"W Domu": "365",
"Szkoła": "347",
"Dobry Wieczór": "137",
"Dobranoc": "74",
"Muzyka do snu": "70",
"Weekend Hits": "127",
"Weekend Chill": "126",
"We Dwoje": "4",
"Happy": "120",
"Sad": "103",
"Relaks": "112",
"Joga": "362",
"Crema Café": "76",
"Nauka": "117",
"Koncentracja": "161",
"Chillout": "33",
"Ladies Café": "48",
"Love": "121",
"Sexy: Soul & R'n'B": "18",
"Spacer": "144",
"Hygge": "138",
"Retro Café": "25",
"Impreza": "2",
"500 Party Hits": "81",
"Dance": "31",
"House": "5",
"Trance": "7",
"Ladies Party": "102",
"Wesele": "110",
"Classic Party": "50",
"Klub 90": "8",
"Italo Disco": "27",
"Do Auta Club": "114",
"Disco Polo": "21",
"Impreza PL": "12",
"Disco Polo Freszzz": "57",
"Disco Polo Classic": "49",
"Polo & Dance": "128",
"SBM Radio": "384",
"Hip-Hop PL": "24",
"Hip-Hop Freszzz": "93",
"Miejska Stacja": "366",
"Top Wszech Czasów - Hip-Hop PL": "176",
"500 Hip-Hop Hits": "84",
"Trap USA": "354",
"Trap PL": "355",
"500 R'n'b Hits": "26",
"Hip-Hop USA": "23",
"Hip-Hop Klasyk": "107",
"Hip-Hop Ulica": "92",
"Taco i Quebo": "199",
"100% Chada": "198",
"100% O.S.T.R.": "47",
"500 Rock Hits": "82",
"Praca Rock": "104",
"Top Wszech Czasów - Rock": "153",
"Top Wszech Czasów - Rock PL": "186",
"Polska Rocks!": "177",
"Polski Rock": "29",
"Polski Rock Classic": "45",
"Radio Rak'n'Roll": "168",
"Rocks": "77",
"Giganci Rocka": "118",
"American Rock": "40",
"Grunge": "157",
"Rock Ballady": "61",
"Classic Rock": "32",
"500 Heavy Hits": "54",
"Classic Metal": "108",
"Ciężkie Brzmienia": "13",
"Do Auta Rock": "113",
"Punk Rock": "78",
"The Best of Happysad": "136",
"100% Dżem": "15",
"100% Kazik": "35",
"100% Grabaż": "73",
"100% Kora & Maanam": "158",
"100% Queen": "185",
"100% Guns N' Roses": "181",
"100% Metallica": "62",
"100% Iron Maiden": "182",
"100% Linkin Park": "42",
"500 Alternative Hits": "55",
"Alt PL": "36",
"Alt Freszzz": "6",
"Alt Café": "34",
"Alt Classic": "43",
"Alt Club": "9",
"The Best of Britpop": "159",
"100% Depeche Mode": "135",
"The Best of Coldplay": "145",
"500 Electronic Hits": "94",
"EDM Anthems": "361",
"Beats & Bass": "106",
"Dubstep": "68",
"Drum'n'Bass": "41",
"Trening": "101",
"Fitness": "65",
"Bieganie": "116",
"Cardio": "141",
"Muzyka Motywacyjna": "143",
"Kids - Muzyka & Ciekawostki": "16",
"Piosenki Dla Dzieci": "160",
"Piosenki Po Angielsku": "353",
"Kołysanki": "142",
"Pozytywki": "194",
"Szum": "193",
"500 Reggae Hits": "30",
"Polskie Reggae": "22",
"Jazz": "166",
"Smooth Jazz": "60",
"Muzyka Klasyczna": "67",
"Muzyka Filmowa": "38",
"Kraina Łagodności": "37",
"Szanty": "28",
"Biesiada": "59",
"Biesiada Śląska": "66",
"Odgłosy Natury": "52",
"100% Ukraina": "167",
"Ukraina Top 20": "191",
"Rock UA": "172",
"Dance UA": "187",
"Shanson": "169"
}

View File

@ -41,6 +41,9 @@ Pause
# mute # mute
XF86AudioMute XF86AudioMute
pamixer -t && pkill -RTMIN+1 dwmblocks pamixer -t && pkill -RTMIN+1 dwmblocks
# select radio
XF86Tools
play-radio
# volume control # volume control
XF86Audio{Raise,Lower}Volume XF86Audio{Raise,Lower}Volume
pamixer -{i,d}3 && pkill -RTMIN+1 dwmblocks pamixer -{i,d}3 && pkill -RTMIN+1 dwmblocks
@ -49,10 +52,10 @@ XF86Audio{Next,Prev}
playerctl {next,previous} && pkill -RTMIN+2 dwmblocks playerctl {next,previous} && pkill -RTMIN+2 dwmblocks
# pause/play # pause/play
{XF86AudioPlay,super + slash} {XF86AudioPlay,super + slash}
playerctl play-pause && pkill -RTMIN+2 dwmblocks mpc status | grep -q "playing\|paused" && mpc toggle || playerctl play-pause && pkill -RTMIN+2 dwmblocks
# stop # stop
XF86AudioStop XF86AudioStop
playerctl stop && pkill -RTMIN+2 dwmblocks mpc stop && playerctl stop && pkill -RTMIN+2 dwmblocks
ctrl + alt + {Left,Up,Down,period} ctrl + alt + {Left,Up,Down,period}
rotscreen {left,normal,inverted,right} rotscreen {left,normal,inverted,right}

29
.local/bin/scripts/play-radio Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh
# Select internet radio station and play it in mpd.
OPEN_FM_CHANNELS_LIST="$HOME/.config/openfm_channels.json"
STATIONS="$(sed 's/: .*//g; s/ /Open FM: /; s/"//g; s/}//g; s/{//g; /^$/d' "$OPEN_FM_CHANNELS_LIST")
newonce.radio
RMF FM
RMF Maxxx
Radio ZET"
station=$(echo "$STATIONS" | rofi -dmenu -i -l 20 -p ' Radio Station')
[ ! "$station" ] && exit
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" ;;
*)
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"
;;
esac
mpc clear
mpc add "$radio"
mpc play

View File

@ -1,15 +1,22 @@
#!/bin/sh #!/bin/sh
# if mpc status | grep -q "playing"; then # asdf
# mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[playing\\].*//g"
# elif mpc status | grep -q "paused"; then
# echo ""
# else
# echo ""
# fi
if playerctl --player=spotify status | grep -q "Playing"; then if playerctl --player=spotify status | grep -q "Playing"; then
playerctl metadata --format "{{ artist }} - {{ title }}" printf "%s" "Spotify: "
playerctl metadata --player=spotify --format "{{ artist }} - {{ title }}"
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')"
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"
elif mpc status -f "%file%" | grep -q "http://streamer.radio.co/s93b51ccc1/listen\|rmf_maxxx\|rmf_fm"; then
mpc status -f "%name%: %title%" | awk 'NR==1' | sed 's/ w .*//g; s/& .* -/-/g; s/feat. .* -/-/g; s/ft .* -/-/g; s/; .* -/ -/g; s/ (feat. .*//g; s/feat. .*//g; s/STOP_AD_BREAK//g'
elif mpc status -f "%file%" | grep -q "zet-old.mp3"; then
mpc status -f "%name%" | awk 'NR==1'
fi
elif playerctl --player=spotify status | grep -q "Paused"; then elif playerctl --player=spotify status | grep -q "Paused"; then
echo "" echo ""
else else