Il me manque un outil simple pour écouter un flux radio internet, si quelqu'un a une idée, ce serait génial!
Salut sogal,
j'ai un script fonctionnant avec moc que j'utilise depuis plusieurs années pour écouter et changer les adresses de flux en cas de besoin playmoc. L'auteur de celui-ci est jpdipsy, merci à lui.
il faut créer un fichier radios.cfg dans ~/.config je poste le miens pour exemple, mais le script te permets de rentrer ce que tu veux en tapant playmoc ajout ou playmoc efface et playmoc liste affiche les radios avec zenity pour faire ton choix d'écoute, il y a des descriptions du fonctionnement en commentaire dans ce script:
dans /usr/local/bin on met ça en le rendant executable biensur:
playmoc:
#!/bin/bash
#Crée par JPDipsy
fichier="$1"
function verifserveur
{
if [ -z "$(pgrep -u $USER mocp)" ];then
if [ -e $HOME/.moc/pid ];then rm $HOME/.moc/pid;fi
mocp -S
fi
}
function lirefich
{
mocp -l "$fichier"
}
if [ -z "$1" ];then
(echo "playmoc.sh argument fichier ou adresse
les arguments : radio, liste, ajout, efface
fichieraudio **(console)
ex: playmoc.sh ~/Musique/fichier.mp3
playlist.m3u **(console)
ex: playmoc.sh ~/Musique/maplaylist.m3u
addresseradio **(console)
les playlistes .m3u sont prisent en charge (pas les pls)
ex: playmoc.sh \"http://ice.somafm.com/groovesalad\" attention aux \" \"
ex: playmoc.sh \"http://www.tv-radio.com/station/france_inter_mp3/france_inter_mp3-128k.m3u\"
radio nomderadio **(console)(pour les radios dans la base)
ex: playmoc.sh radio rtl
liste ** liste les radios de la base (zenity) et joue si une radio est choisie
ajout ** ajoutez vos radios (zenity)
ex: Radio : groove Url http:// : http://ice.somafm.com/groovesalad
ex: Radio : finter Url http:// : http://www.tv-radio.com/station/france_inter_mp3/france_inter_mp3-128k.m3u
efface ** efface une radio de la base (zenity)
Un .bak est créé dans votre ./config") | zenity --text-info --title='Utilisation de playmoc.sh' --width=800 --height=480
exit
fi
case "$1" in
"radio")
if [ -e ~/.config/radios.cfg ];then
fichier=$(grep "$2=" ~/.config/radios.cfg | cut -d = -f2)
if [ -z "$fichier" ];then
echo "Désolé cette radio n'existe pas dans la base"
exit
else
verifserveur
lirefich
fi
else
echo "Désolé je ne trouve pas la base ?"
fi
;;
"liste")
if [ -e ~/.config/radios.cfg ];then
liste=$(cat ~/.config/radios.cfg |cut -d = -f1);radio=$(zenity --list --height=400 --text="choisissez une radio" --title="Vos radios" --column=radio $liste)
if [ ! -z "$radio" ];then
fichier=$(grep "$radio=" ~/.config/radios.cfg | cut -d = -f2)
if [ "$(echo ${fichier##*.})" == "m3u" ];then
wget -O /tmp/radio "$fichier"
fichier=$(echo "http://"$(cat /tmp/radio|grep -m 1 http | cut -d / -f3-))
rm /tmp/radio
verifserveur
lirefich
else
verifserveur
lirefich
fi
fi
else
echo "Désolé je ne trouve pas la base ?"
fi
;;
"ajout")
radio=$(zenity --forms --width=500 --title='Ajout de radio dans la base' --text="Entrez le nom de la radio et l'url (m3u accepté) " --add-entry="Radio :" --add-entry="Url http:// :" --separator="=")
if [ $? = "1" ];then exit ;fi
quest=$(zenity --question --width=500 --title='Ajout de radio dans la base' --text="Ajout de : $radio Est-ce correct ?")
if [ $? = "1" ];then exit ;fi
url=$(echo $radio|cut -d = -f2-)
nomradio=$(echo $radio|cut -d = -f1)
if [ "$(echo ${url:0:7})" != "http://" ];then zenity --info --text="addresse éronnée";exit;fi
#si playlist rechercher addresse
if [ "$(echo ${url##*.})" == "m3u" ];then
wget -O /tmp/radio "$url"
addr=$(echo "http://"$(cat /tmp/radio|grep -m 1 http | cut -d / -f3-))
radio=$(echo "$nomradio=$addr")
##verifier addresse valide
fi
echo "$radio" >> ~/.config/radios.cfg
sort ~/.config/radios.cfg -o ~/.config/radios.cfg
;;
"efface")
if [ -e ~/.config/radios.cfg ];then
liste=$(cat ~/.config/radios.cfg |cut -d = -f1)
radio=$(zenity --list --height=400 --text="Choisissez une radio à enlever" --title="Modifier base" --column=radio $liste)
if [ $? = "1" ];then exit ;fi
quest=$(zenity --question --width=500 --title='Modifier base' --text="Enlever cette radio : $radio Est-ce correct ?")
if [ $? = "1" ];then exit ;fi
if [ ! -z "$radio" ];then
sed -i".bak" "/$radio/d" ~/.config/radios.cfg
sort ~/.config/radios.cfg -o ~/.config/radios.cfg
fi
fi
;;
* )
if [ "$(echo ${fichier##*.})" == "m3u" ];then
if [ "$(echo ${fichier:0:5})" = "http:" ];then
wget -O /tmp/radio "$fichier"
fichier=$(echo "http://"$(cat /tmp/radio|grep -m 1 http | cut -d / -f3-))
rm /tmp/radio
verifserveur
lirefich
else
verifserveur
mocp -c
mocp -a "$fichier"
mocp -p
fi
else
verifserveur
lirefich
fi
;;
esac
exit
dans ~/.config
radio.cfg:
Couleur3=http://stream.srg-ssr.ch/m/couleur3/mp3_128
Eu1=http://e1-live-mp3-128.scdn.arkena.com/europe1.mp3
FIP-FR=http://direct.fipradio.fr/live/fip-midfi.mp3
FM43=http://fm43.ice.infomaniak.ch:80/fm43-64.aac
FM4=http://mp3stream1.apasf.apa.at:8000
France-Info=http://direct.franceinfo.fr/live/franceinfo-midfi.mp3
FR-INT=http://direct.franceinter.fr/live/franceinter-midfi.mp3
FunRadio=http://streaming.radio.funradio.fr/fun-1-44-128
ihaveadream=http://panel.radio-ihaveadream.com:8000/?type=http&nocache=392/;stream/1
JazzRadio=http://jazzradio.ice.infomaniak.ch/jazzradio-high.mp3
LeDjam=http://ledjamradio.ice.infomaniak.ch/ledjamradio.mp3
lounge-radio=http://195.141.102.222:8040
meuh=http://radiomeuh.ice.infomaniak.ch/radiomeuh-128.mp3?lang=en-US%2cen%3bq%3d0.5
Néo=http://stream.radioneo.org:8000
Nostalgie=http://mp3.live.tv-radio.com/nostalgie/all/nos_113812.mp3
Nova=http://broadcast.infomaniak.net/radionova-high.mp3
NRJ=http://cdn.nrjaudio.fm/audio1/fr/30001/mp3_128.mp3?origine=fluxradios
Radio24=http://icecast.radio24.ch/radio24-rc-96-aac
RTS=http://stream.srg-ssr.ch/m/la-1ere/mp3_128
somafm=http://ice1.somafm.com/fluid-128-mp3
Voilà c'est tout, j'espère que ça te plait ++
Dernière modification par ragamatrix (18-06-2018 09:48:36)