I made and use this script on my PureOS laptop. Nowadays works almost without changes in Librem 5
I use three files to have a desktop shortcut (internetradio.desktop internetradio.png internetradio.sh)
open gedit or another text editor and write the following and save as internetradio.desktop file:
[Desktop Entry]
Name=Internet Radio
Type=Application
Terminal=True
Icon=/home/purism/.local/share/icons/internetradio.png
Exec=/home/purism/5librem/internetradio.sh
Categories=Utility;
internetradio.desktop file should be in /home/purism/.local/share/applications/
Be sure to put the path were the bash script file will be stored ( i.e. Exec=/myhome/path/internetradio.sh
the bash script file:
#!/bin/bash
# Listen internet radio stations. By Antonio Paternina Alvarez. Press the number/letter of the station on menu. When running press Ctrl-C to stop, SPACEbar to see the menu. To exit menu press the [.] on your keyboard.
#---------------define variables---------
tit=" Internet Radio"
line="--------------------"
uno=" 1. ADVenir Bolivia"
dos=" 2. Altiplano AdVenir Bolivia"
tres=" 3. AMANECER VZLA *"
cuat=" 4. FAITH FM BELIZE"
cinc=" 5. GLOBAL FAMILY NETWORK - Guyana"
seis=" 6. La Perla"
siet=" 7. LA VOZ Internacional VZLA"
ocho=" 8. Los Angeles del valle"
nuev=" 9. MELODIES OF PRAYER-GUAM"
opcA=" A. NT Argentina"
opcB=" B. NT Bolivia"
opcC=" C. NT Brazil"
opcD=" D. NT Chile"
opcE=" E. NT Ecuador"
opcF=" F. NT Paraguay"
opcG=" G. NT PerĂş"
opcH=" H. NT Uruguay"
opcI=" I. RA España"
opcJ=" J. RADIO SWISS CLASSIC"
opcK=" K. RADIOSOL.ORG"
opcL=" L. Silohradio.com Bogotá"
opcM=" M. Terceiro Anjo BR"
opcN=" N. WTPM 92.9FM"
oFin=" . Exit"
#---------user defined function----------
show_menu() {
echo -ne "\033];$tit\007" # Set terminal window title
clear
# echo "$tit"
# echo "$line"
echo "$uno $oFin"
echo "$dos"
echo "$tres"
echo "$cuat"
echo "$cinc"
echo "$seis"
echo "$siet"
echo "$ocho"
echo "$nuev"
echo "$opcA"
echo "$opcB"
echo "$opcC"
echo "$opcD"
echo "$opcE"
echo "$opcF"
echo "$opcG"
echo "$opcH"
echo "$opcI"
echo "$opcJ"
echo "$opcK"
echo "$opcL"
echo "$opcM"
echo "$opcN"
}
read_options() {
# read input from keyboard and take a action. # invoke the uno() when user select 1 from the menu option. # ffmpeg -i $url -f mp3 -ar 44100 -ac 2 - ab 96000 - | ffplay -i -
local choice
while IFS= read -rn1 choice
do
show_menu
case $choice in
1) echo -ne "\033];$uno\007"; ffmpeg -i "https://stream.eleden.com/radioadvenir.aac/radioadvenir.aac.stream/chunklist_w663415479.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
2) echo -ne "\033];$dos\007"; ffmpeg -i "https://stream.eleden.com/altiplano.aac/altiplano.aac.stream/chunklist_w1630781586.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
3) echo -ne "\033];$tres\007"; ffmpeg -i "https://stream.eleden.com/veamanecer.aac/veamanecer.aac.stream/chunklist_w1395968203.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
4) echo -ne "\033];$cuat\007"; ffmpeg -i "https://stream.eleden.com/faithfm.aac/faithfm.aac.stream/chunklist_w1908339108.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
5) echo -ne "\033];$cinc\007"; ffmpeg -i "https://stream.eleden.com/tgfnradio.aac/tgfnradio.aac.stream/chunklist_w1295062531.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
6) echo -ne "\033];$seis\007"; ffmpeg -i "https://stream.eleden.com/gcristovienejm.aac/gcristovienejm.aac.stream/chunklist_w540088881.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
7) echo -ne "\033];$siet\007"; ffmpeg -i "https://stream.eleden.com/lavoz106.aac/lavoz106.aac.stream/chunklist_w308032128.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
8) echo -ne "\033];$ocho\007"; ffmpeg -i "https://stream.eleden.com/glosangelesdv.aac/glosangelesdv.aac.stream/chunklist_w1013177295.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
9) echo -ne "\033];$nuev\007"; ffmpeg -i "https://stream.eleden.com/melodiesop.aac/melodiesop.aac.stream/chunklist_w1945295462.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -i -nodisp -i - ;;
a) echo -ne "\033];$opcA\007"; ffmpeg -i "https://stream.live.novotempo.com/radio/smil:rntBuenosAiresAR.smil/chunklist_b128000_slspa.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
b) echo -ne "\033];$opcB\007"; ffmpeg -i "https://stream.live.novotempo.com/radio/smil:rntCochabambaBO.smil/chunklist_b64000_slspa.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
c) echo -ne "\033];$opcC\007"; ffmpeg -i "https://stream.live.novotempo.com/radio/smil:radionovotempo.smil/chunklist_b96000_slpor.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
d) echo -ne "\033];$opcD\007"; ffmpeg -i "https://stream.live.novotempo.com/radio/smil:rntChillanCL.smil/chunklist_b64000_slspa.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
e) echo -ne "\033];$opcE\007"; ffmpeg -i "https://stream.live.novotempo.com/radio/smil:rntQuitoEC.smil/chunklist_b64000_slspa.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
f) echo -ne "\033];$opcF\007"; ffmpeg -i "https://stream.live.novotempo.com/radio/smil:radionuevotiempo.smil/playlist.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
g) echo -ne "\033];$opcG\007"; ffmpeg -i "https://stream.live.novotempo.com/radio/smil:rntLimaPE.smil/chunklist_b128000_slspa.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
h) echo -ne "\033];$opcH\007"; ffmpeg -i "https://stream.live.novotempo.com/radio/smil:rntMontevideoUY.smil/chunklist_b64000_slspa.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
i) echo -ne "\033];$opcI\007"; ffmpeg -i "http://n0c.radiojar.com/aesy2chkb?rj-ttl=5&rj-tok=AAABc-Q0lmcABCwhSI7mTJi3fA" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
j) echo -ne "\033];$opcJ\007"; ffmpeg -i "https://stream.eleden.com/radioswissc.aac/radioswissc.aac.stream/chunklist_w1239878985.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
k) echo -ne "\033];$opcK\007"; ffmpeg -i "https://stream.eleden.com/wzol.aac/wzol.aac.stream/chunklist_w1537564109.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
l) echo -ne "\033];$opcL\007"; ffmpeg -i "http://stream.eleden.com:1935/siloh.aac/siloh.aac.stream/playlist.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
m) echo -ne "\033];$opcM\007"; ffmpeg -i "https://stream.eleden.com/gterceiroanjo.aac/gterceiroanjo.aac.stream/chunklist_w772186788.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
n) echo -ne "\033];$opcN\007"; ffmpeg -i "https://stream.eleden.com/wtpm.aac/wtpm.aac.stream/chunklist_w1374238332.m3u8" -f mp3 -ar 44100 -ac 2 -ab 96000 - | ffplay -nodisp -i - ;;
.) exit 0 ;;
*) echo "Error..." && sleep 1
esac
done
}
# --------------------
# Step 3. Trap Ctrl+C, Ctrl+Z and quit singles
# ------------------------------
trap '' SIGINT SIGQUIT SIGTSTP
# ------------------------------
# Step 4. Main Logic - Infinite loop
# ------------------------------
while true
do
show_menu
read_options
done
----------------------------------------------
CHOOSE A image for your desktop shorcut and put it in /home/purism/.local/share/icons
Give execution attributes to internetradio.sh with
chmod +x internetradio.sh
That is all. The script will show a menu to choose the internet radio using numbers 1 to 9 and letters A to N. To exit just press the “.” dot
To exit/change to another station running Simple press Ctrl+C then press any key to see the menu again.
the icon i made:
Internetradio on the upper right on this screen shot:
the menu to select radio station:
Radio Station NT Paraguay playing
NT Paraguay radio station stop by pressing Ctrl-C
Playing option F. Radio Swiss Classical