Created
August 1, 2023 13:37
-
-
Save chussenot/7a6351b43362fc2229097444000e0b6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
declare -A radios=( | |
["france_info"]="http://direct.franceinfo.fr/live/franceinfo-midfi.mp3" | |
["france_musique"]="http://direct.francemusique.fr/live/francemusique-midfi.mp3" | |
["france_inter"]="http://direct.franceinter.fr/live/franceinter-midfi.mp3" | |
["france_culture"]="http://direct.franceculture.fr/live/franceculture-midfi.mp3" | |
["fip"]="http://direct.fipradio.fr/live/fip-midfi.mp3" | |
["rtl2"]="http://streaming.radio.rtl.fr/rtl2-1-44-64.mp3" | |
["nova"]="http://broadcast.infomaniak.net/radionova-high.mp3" | |
["mouv"]="http://direct.mouv.fr/live/mouv-midfi.mp3" | |
) | |
choose_radio() { | |
local radio_options=() | |
for radio in "${!radios[@]}"; do | |
radio_options+=("$radio" "") | |
done | |
local selected_radio | |
selected_radio=$(whiptail --title "Radios!" --menu "Choose your option" 10 60 4 "${radio_options[@]}" 3>&1 1>&2 2>&3) | |
if [[ -n $selected_radio ]]; then | |
local url=${radios["$selected_radio"]} | |
mplayer "$url" &> /dev/null | |
else | |
echo "You chose Cancel or closed the dialog." | |
fi | |
} | |
choose_radio | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment