Faire jouer une radio Internet en ligne de commande

Post Reply
Message
Author
musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

Faire jouer une radio Internet en ligne de commande

#1 Post by musher0 »

Bonjour.

Il y a au moins quatre possibilités pour faire jouer une station de radio
Internet en ligne de commande.

J'ai pondu un petit script qui détecte ce que vous avez et qui joue
Musique XIX. Si vous aimez pas la musique romantique, remplacez
l'adresse Internet par la station de votre choix, le principe est le même.

S.v.p. lire les commentaires dans le script, je ne souhaite pas me répéter.

Code: Select all

#!/bin/sh
# Musique-XIX.sh # Station de radio Internet française.
# Mais peut s'utiliser avec n'importe quelle station Internet.
#
# Requiert : mpv, mplayer, play (du progiciel SoundXchange [alias sox]) OU cvlc.
# Aussi un rxvt-unicode récent, par ex. la version 9.22, pour les effets de transparence.
#
# (c) Christian L'Écuyer, Gatineau (Qc), Canada, 23 sept. 2017. GPL3
# (Alias musher0 [forum Puppy].) # https://opensource.org/licenses/GPL-3.0
#################
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##########
####
QuoI="`ps | awk '$4 ~ /mpv|mplayer|cvlc/ { print $4 }'`"

if [ "$QuoI" != "" ]; then # commutateur
	killall -q $QuoI

else
	LarG="`xwininfo -root | awk '$1 ~/Width/ { print ($2/5)+80 }'`"
	COL="fg snow -bg grey75 -bd #BDBDBD -tr -tint grey45 -sh 101"
# bg black -fg cornsilk -tint firebrick4 	#### 	# 99 # 101 # 150
	FNT="fn xft:Monaco:pixelsize=14:antialias=true:hinting=true"
	FadE="fade 70 -fadecolor "#94A495""

	FluX="http://listen.radionomy.com/classique-xix.m3u" # ou autre

	cd /usr/bin
# Vous avez sûrement un des trois : mpv, mplayer ou cvlc.

	if [ -e mpv ];then
		rxvt -g 95x5-${LarG}-100 -$COL -$FNT -$FadE -title MusiqueXIX -e mpv $FluX 2>/dev/null

	elif [ -e mplayer ];then
		rxvt -g 95x5-${LarG}-100 -$COL -$FNT -$FadE -title MusiqueXIX -e mplayer -cache 1024 -playlist $FluX
# mplayer -cache 1024 -playlist < URL > # dans l'ordre : la cache avant la liste.
# -cache 2048 # -cache 8192 # Autres tailles de cache, si vous avez la patience
# d'attendre qu'elles se remplissent.

	elif [ -e cvlc ];then # Corrections apportées; merci, Fabrice.
		rxvt -g 95x5-${LarG}-100 -$COL -$FNT -$FadE -title MusiqueXIX -e cvlc -q http://listen.radionomy.com/classique-xix.m3u
		# mais pas de titre de pièce avec cvlc.
		# veut l'adresse au complet.

	elif [ -e play ];then
		rxvt -g 95x13-${LarG}-100 -$COL -$FNT -$FadE -title MusiqueXIX -e play -t mp3 $FluX
		# Mais pas de titre de pièce avec play non plus.
		# Play exige de connaître le type du flux.
	fi
fi
Pourquoi un tel script quand il y a tant de solutions avec fenêtre X ?
-- Pour avoir une fenêtre qui se fond dans le fond d'écran, qui ne dérange pas visuellement;
-- Pour ne pas trop prendre de resources;
-- Pour le plaisir d'en apprendre un peu plus sur les programmes sonores.

À+
Attachments
Musique-XIX.jpg
Ici, le lecteur de musique est mpv.
(33.33 KiB) Downloaded 146 times
Last edited by musher0 on Thu 28 Sep 2017, 00:30, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Pelo

c'est en anglais !

#2 Post by Pelo »

c'est en anglais ! et avec pup radio tu colles l'url dans la case URL, basta; ta radio est prête.
et comme dirait Medor, quand tu est sur le site de la radio, bien tu l'écoutes en directe, Quand je déboites une video, c'est pour la traficoter, mais la radio, bof..

On voit bien que tu veux programmer. Mais que programmer ? Demandes à tes users (passagers). Ya que moi qui réponds. Misère.
EEEH , OUI FM çà existe encore.
Attachments
OUI FM.jpg
OUI FM, ça rape dur !
(3.98 KiB) Downloaded 121 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Bah, pourquoi je reste sur ce forum non supervisé...
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#4 Post by musher0 »

musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
fabrice_035
Posts: 765
Joined: Mon 28 Apr 2014, 17:54
Location: Bretagne / France

#5 Post by fabrice_035 »

Mon interpréteur est plus capricieux, il détecte une petite erreur dans ton code, ligne 53 je crois

Code: Select all

elif [ -e cvlc];then 
moi il n'aime pas si il n'y a pas d'espace après cvlc

ça c'est ok

Code: Select all

elif [ -e cvlc ];then 
C'est fou quand même! Si je peux me permettre, avec cvlc l'option -q (pour quiet) évite les cochonneries du débugage à l'écran :?

Cdt.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#6 Post by musher0 »

C'est vraiment bien d'avoir des copains qui ont un oeil de lynx!!! :)
Merci.
Et pour l'option < -q > dans cvlc.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#7 Post by Argolance »

Bonsoir,
Le script, directement copié/collé en console pour voir, et hop, un beau morceau de Wagner!!! 8)
Moi je trouve ce petit script plutôt étonnant et génial. Il n'y que notre pauvre type de service (qui continue, imperturbable, envers et contre tous, à se tripoter à longueur de journée devant son ordinateur) pour s'en plaindre et le déprécier....
Consternant!
En tout cas, bravo musher0! :D et merci!

Cordialement.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#8 Post by musher0 »

De rien !
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
jplt_bis
Posts: 69
Joined: Mon 20 Feb 2017, 19:06
Location: Planete Terre

#9 Post by jplt_bis »

Le script marche à merveille.

D'autre bonnes idées ici de script : http://linuxfr.org/users/alfredletueur/ ... r-la-radio

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#10 Post by musher0 »

Merci jplt_bis.

Je découvre du même coup linuxfr.org. Magnifique mais bizarre forum. Ouf.

Je découvre aussi combien américanisé je suis. (Pour faire une phôte de
construction de phrase exprès...)

On en reparle sur l'autre fil ?

À la revoyure !
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#11 Post by musher0 »

@Fabrice :

J'ai apporté tes corrections au script dans le premier message.

À+
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply