J'ai découvert Roon (https://roonlabs.com/) il y a quelques mois. Si vous n'avez jamais entendu parler de Roon, il s'agit d'un logiciel vous permettant d'organiser et d'écouter votre musique favorite sur votre Mac/PC, iPhone, ainsi que sur votre chaîne hifi.
Je couvrirai Roon plus en détails dans un prochain billet, mais jetez un oeil sur leur site, c'est vraiment intéressant. Retenez juste qu'il fonctionne avec vos chansons stockées en local, et pour le streaming avec Tidal et Qobuz.
Une de mes fonctionnalités préférées, c'est la création automatique des métadonnées. En clair, sur base d'informations simples tel que l'interprète et le nom d'un titre, Roon vous retrouve la bio de l'auteur, l'album complet (avec les crédits associés), les concerts à venir, les artistes similaires etc.
C'est le rêve pour moi qui adore écouter des webradios ! Imaginez le scénario suivant: je suis confortablement en train d'écouter FIP (ma webradio préférée avec Radio Paradise), le titre me plaît et en une fraction de secondes - le temps de prendre mon iPhone et d'ouvrir l'app Roon - et hop, j'ajoute cette chanson à ma playlist.
Ok, on peut le faire avec Shazam et Spotify, mais c'est autrement plus fastidieux.
Le rêve ? Oui et non, du moins pas encore: le problème, c'est que FIP ne diffuse pas les informations sur les titres en cours dans les flux audios disponibles hors de son application. En clair:
- soit vous utilisez l'application FIP et vous avez accès à ces infos (et un lien vers Apple Music, Spotify ou Deezer), mais dans ce cas vous vous passez de Roon puisque cette app peut uniquement streamer en AirPlay
- soit vous utilisez Roon (ou TuneIn, même principe d'ailleurs), et vous n'avez pas accès à ces infos.
En fait, il existe un moyen relativement simple de pouvoir utiliser Roon (ou TuneIn), d'écouter FIP et de voir les informations.
En gros, ce moyen consiste à déployer un serveur de streaming audio (icecast2) pour "relayer" le flux audio FIP, mais en y ajoutant les infos qu'on aura récupérées d'autre part sur le site de FIP.
Je vous explique ? C'est parti.
Vous aurez besoin d'un Raspberry PI. Pour ma part, je suis parti sur un RPI PI 4
Et bien entendu de Roon et d'un compte Qobuz ou Tidal.
Préparation du Raspberry PI
Téléchargez l'application "Raspberry PI Imager", disponible ici: https://www.raspberrypi.org/downloads/
Démarrez cette application. Choisissez l'image que vous souhaitez utiliser; pour ma part j'ai choisi Ubuntu 20.04 LTS en 64 bits. Choisissez votre carte SD, lancez l'écriture et patientez.
Connectez-vous en ssh à votre Raspberry. Login: ubuntu, Mot de passe: ubuntu.
Ubuntu va vous demander de changer votre mot de passe, faites-le.
Installation de icecast2 sur leRaspberry PI
Ensuite, on procède à l'installation de icecast. Entrer:
> sudo apt-get update
> sudo apt-get install -y icecast2
Icecast va vous demander si vous voulez procéder à la configuration (répondre Y), puis quelques infos de configuration: le nom (j'ai laissé localhost), et les mots de passe suivants: "source password", "relay password" et "administration password". Choisissez vos mots de passe et notez les précieusement.
Mise en place du relais de FIP sur icecast2
Il s'agit maintenant de mettre en place le "relais" sur icecast. Pour ce faire, modifiez le fichier /etc/icecast2/icecast.xml, pour ajouter les lignes suivantes juste avant le tag final </icecast> :
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fip-hifi.aac?id=radiofrance</mount>
<local-mount>/fip</local-mount>
</relay>
Enfin, redémarrez icecast2 en entrant:
sudo systemctl restart icecast2.service
Vérifiez que tout est ok en allant, avec votre browser, sur la page suivant: http://IP_de_votre_Raspberry:8000. Vous devriez voir ceci:
Rendez-vous à présent sur l'adresse suivante: http://IP_de_votre_Raspberry:8000/fip. Vous devriez pouvoir écouter FIP :)
Installation de node-red sur le Raspberry PI
Je suis un fan absolu de node-red, qui permet de faire plein de petites choses sympas ! En l'occurrence, il va nous permettre de récupérer et d'injecter les metadata dans le flux que vous venez de créer.
Entrez la commande suivante sur votre Raspberry (merci Rémi !)
> sudo apt install build-essential git bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
> sudo systemctl enable nodered.service
Si tout s'est bien passé, on retrouve node-red à la page suivante: http://IP_de_votre_Raspberry:1880
Il s'agit maintenant d'ajouter un plugin à node-red pour nous permettre de récupérer les infos. Allez dans le menu en haut à droite, et sélectionnez "Manage Palette".
Dans le menu qui apparaît, recherchez Web Watch dans l'onglet "Install".
Cliquez sur Install. Une fois l'installation terminée, l'écran ressemble à ceci:
Importez le flow ci-dessous (bouton Menu, choisir Import)
[{"id":"ad011cd7.32bae","type":"tab","label":"Radio metadata","disabled":false,"info":""},{"id":"dcc2c1b.142af4","type":"rbe","z":"ad011cd7.32bae","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":400,"y":660,"wires":[["d961aaf3.803308"]]},{"id":"d961aaf3.803308","type":"switch","z":"ad011cd7.32bae","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":570,"y":660,"wires":[["5cb37aca.805904"],[]]},{"id":"e13c4a6b.421178","type":"function","z":"ad011cd7.32bae","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":660,"wires":[["dcc2c1b.142af4"]]},{"id":"5cb37aca.805904","type":"function","z":"ad011cd7.32bae","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nvar title = playing_item.subtitle;\n\nmsg.payload = artist + \"%20-%20\" + title;\n\nreturn msg;","outputs":1,"noerr":0,"x":810,"y":660,"wires":[["b02a1176.0457b"]]},{"id":"a053d628.eddc38","type":"Web watch in","z":"ad011cd7.32bae","name":"FIP","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A7%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":90,"y":660,"wires":[["e13c4a6b.421178"]]},{"id":"aaa382ef.8e787","type":"http request","z":"ad011cd7.32bae","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":1150,"y":660,"wires":[[]]},{"id":"b02a1176.0457b","type":"function","z":"ad011cd7.32bae","name":"","func":"msg.url = \"http://admin:XXX@127.0.0.1:8000/admin/metadata?mount=/fip&mode=updinfo&song=\" + msg.payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":970,"y":660,"wires":[["aaa382ef.8e787"]]}]
Modifiez le mot de passe: remplacez "XXX" par le mot de passe que vous avez défini pour "admin" sur icecast2.
Enfin, cliquez sur Deploy au-dessus à droite de l'écran. C'est fini pour node-red !
Ajout de la radio sur Roon ou TuneIn
Il ne vous reste plus qu'à ajouter votre nouvelle radio sur Roon ou sur TuneIn. L'URL est le suivant:
http://IP_de_votre_Raspberry:8000/fip
Mise à jour 03/05/2020
On me demande s'il est possible d'ajouter toutes les webradios FIP. La réponse est oui.
Tout d'abord, modifiez le fichier /etc/icecast2/icecast.xml en ajoutant les relais suivants:
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fip-hifi.aac</mount>
<local-mount>/fip</local-mount>
</relay>
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fiprock-hifi.aac</mount>
<local-mount>/fiprock</local-mount>
</relay>
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fipjazz-hifi.aac</mount>
<local-mount>/fipjazz</local-mount>
</relay>
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fipgroove-hifi.aac</mount>
<local-mount>/fipgroove</local-mount>
</relay>
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fipworld-hifi.aac</mount>
<local-mount>/fipmonde</local-mount>
</relay>
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fipnouveautes-hifi.aac</mount>
<local-mount>/fipnouveaute</local-mount>
</relay>
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fipreggae-hifi.aac</mount>
<local-mount>/fipreggae</local-mount>
</relay>
<relay>
<server>icecast.radiofrance.fr</server>
<port>80</port>
<mount>/fipelectro-hifi.aac</mount>
<local-mount>/fipelectro</local-mount>
</relay>
Et surtout, modifiez la ligne suivante:
<sources>2</sources>
Par:
<sources>10</sources>
Enfin, utilisez le flow node-red suivant au lieu de celui mentionné dans le post initial:
[{"id":"115e4b1a.1cf765","type":"tab","label":"FIP Metadata","disabled":false,"info":""},{"id":"54f1b57b.327b5c","type":"Web watch in","z":"115e4b1a.1cf765","name":"FIP Rock","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A64%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":120,"y":420,"wires":[["c5de1806.0fba58"]]},{"id":"c5de1806.0fba58","type":"function","z":"115e4b1a.1cf765","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":420,"wires":[["9e55aa1f.5649d8"]]},{"id":"9e55aa1f.5649d8","type":"rbe","z":"115e4b1a.1cf765","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":470,"y":420,"wires":[["d75fd719.d131e8"]]},{"id":"d75fd719.d131e8","type":"switch","z":"115e4b1a.1cf765","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":420,"wires":[["92443a1.3d394c8"],[]]},{"id":"67a664b0.3ff0dc","type":"Web watch in","z":"115e4b1a.1cf765","name":"FIP","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A7%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":110,"y":380,"wires":[["dbe197f1.40d598"]]},{"id":"dbe197f1.40d598","type":"function","z":"115e4b1a.1cf765","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":380,"wires":[["9e75d6c.37f8e28"]]},{"id":"9e75d6c.37f8e28","type":"rbe","z":"115e4b1a.1cf765","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":470,"y":380,"wires":[["7bbb4554.00124c"]]},{"id":"7bbb4554.00124c","type":"switch","z":"115e4b1a.1cf765","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":380,"wires":[["cfebdd7b.a00d"],[]]},{"id":"cfebdd7b.a00d","type":"function","z":"115e4b1a.1cf765","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nartist = encodeURIComponent(artist);\nvar title = playing_item.subtitle;\ntitle = encodeURIComponent (title);\nmsg.payload = artist + \"%20-%20\" + title;\nmsg.radio = \"fip\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":380,"wires":[["56082fc5.5bd3b"]]},{"id":"56082fc5.5bd3b","type":"function","z":"115e4b1a.1cf765","name":"PASSWORD","func":"msg.url = \"http://admin:XXX@X.X.X.X:8000/admin/metadata?mount=/\" + msg.radio + \"&mode=updinfo&song=\" + msg.payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":1030,"y":380,"wires":[["fa437cc7.4741b"]]},{"id":"fa437cc7.4741b","type":"http request","z":"115e4b1a.1cf765","name":"","method":"GET","ret":"txt","paytoqs":false,"url":"","tls":"","persist":false,"proxy":"","authType":"","x":1250,"y":380,"wires":[[]]},{"id":"8e76ff91.02633","type":"Web watch in","z":"115e4b1a.1cf765","name":"FIP Jazz","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A65%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":120,"y":460,"wires":[["f8fbe84b.84fe88"]]},{"id":"f8fbe84b.84fe88","type":"function","z":"115e4b1a.1cf765","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":460,"wires":[["db27695b.796488"]]},{"id":"db27695b.796488","type":"rbe","z":"115e4b1a.1cf765","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":470,"y":460,"wires":[["a7e77708.cfe808"]]},{"id":"a7e77708.cfe808","type":"switch","z":"115e4b1a.1cf765","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":460,"wires":[["d00ea452.a72748"],[]]},{"id":"c6d8f057.db2cc","type":"Web watch in","z":"115e4b1a.1cf765","name":"FIP Groove","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A66%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":130,"y":500,"wires":[["a22afd1c.459e9"]]},{"id":"a22afd1c.459e9","type":"function","z":"115e4b1a.1cf765","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":500,"wires":[["8b9041df.396d4"]]},{"id":"8b9041df.396d4","type":"rbe","z":"115e4b1a.1cf765","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":470,"y":500,"wires":[["7dc934a9.696fec"]]},{"id":"7dc934a9.696fec","type":"switch","z":"115e4b1a.1cf765","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":500,"wires":[["61983815.2086c8"],[]]},{"id":"7a216d3c.35cd34","type":"Web watch in","z":"115e4b1a.1cf765","name":"FIP World","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A69%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":120,"y":540,"wires":[["bb44e5f4.484658"]]},{"id":"bb44e5f4.484658","type":"function","z":"115e4b1a.1cf765","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":540,"wires":[["be0552ff.037"]]},{"id":"be0552ff.037","type":"rbe","z":"115e4b1a.1cf765","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":470,"y":540,"wires":[["dead01b7.fabb6"]]},{"id":"dead01b7.fabb6","type":"switch","z":"115e4b1a.1cf765","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":540,"wires":[["e29802cd.16e8c"],[]]},{"id":"92443a1.3d394c8","type":"function","z":"115e4b1a.1cf765","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nartist = encodeURIComponent(artist);\nvar title = playing_item.subtitle;\ntitle = encodeURIComponent (title);\nmsg.payload = artist + \"%20-%20\" + title;\nmsg.radio = \"fiprock\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":420,"wires":[["56082fc5.5bd3b"]]},{"id":"d00ea452.a72748","type":"function","z":"115e4b1a.1cf765","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nartist = encodeURIComponent(artist);\nvar title = playing_item.subtitle;\ntitle = encodeURIComponent (title);\nmsg.payload = artist + \"%20-%20\" + title;\nmsg.radio = \"fipjazz\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":460,"wires":[["56082fc5.5bd3b"]]},{"id":"61983815.2086c8","type":"function","z":"115e4b1a.1cf765","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nartist = encodeURIComponent(artist);\nvar title = playing_item.subtitle;\ntitle = encodeURIComponent (title);\nmsg.payload = artist + \"%20-%20\" + title;\nmsg.radio = \"fipgroove\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":500,"wires":[["56082fc5.5bd3b"]]},{"id":"e29802cd.16e8c","type":"function","z":"115e4b1a.1cf765","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nartist = encodeURIComponent(artist);\nvar title = playing_item.subtitle;\ntitle = encodeURIComponent (title);\nmsg.payload = artist + \"%20-%20\" + title;\nmsg.radio = \"fipmonde\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":540,"wires":[["56082fc5.5bd3b"]]},{"id":"b760ebf4.22f9d8","type":"Web watch in","z":"115e4b1a.1cf765","name":"FIP Nouveauté","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A70%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":140,"y":580,"wires":[["dbda1513.7715c8"]]},{"id":"dbda1513.7715c8","type":"function","z":"115e4b1a.1cf765","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":580,"wires":[["dd750d05.6701b"]]},{"id":"dd750d05.6701b","type":"rbe","z":"115e4b1a.1cf765","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":470,"y":580,"wires":[["ffffebf2.a1e118"]]},{"id":"ffffebf2.a1e118","type":"switch","z":"115e4b1a.1cf765","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":580,"wires":[["746624c.91e51dc"],[]]},{"id":"746624c.91e51dc","type":"function","z":"115e4b1a.1cf765","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nartist = encodeURIComponent(artist);\nvar title = playing_item.subtitle;\ntitle = encodeURIComponent (title);\nmsg.payload = artist + \"%20-%20\" + title;\nmsg.radio = \"fipnouveaute\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":580,"wires":[["56082fc5.5bd3b"]]},{"id":"60516020.d4097","type":"Web watch in","z":"115e4b1a.1cf765","name":"FIP Reggae","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A71%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":130,"y":620,"wires":[["6ebaae45.3d42c"]]},{"id":"6ebaae45.3d42c","type":"function","z":"115e4b1a.1cf765","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":620,"wires":[["de180da2.09714"]]},{"id":"de180da2.09714","type":"rbe","z":"115e4b1a.1cf765","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":470,"y":620,"wires":[["d50320cb.6eb37"]]},{"id":"d50320cb.6eb37","type":"switch","z":"115e4b1a.1cf765","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":620,"wires":[["d167a7b5.27b718"],[]]},{"id":"d167a7b5.27b718","type":"function","z":"115e4b1a.1cf765","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nartist = encodeURIComponent(artist);\nvar title = playing_item.subtitle;\ntitle = encodeURIComponent (title);\nmsg.payload = artist + \"%20-%20\" + title;\nmsg.radio = \"fipreggae\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":620,"wires":[["56082fc5.5bd3b"]]},{"id":"3ff5b004.3a94b","type":"Web watch in","z":"115e4b1a.1cf765","name":"FIP Electro","url":"https://www.fip.fr/latest/api/graphql?operationName=Now&variables=%7B%22bannerPreset%22%3A%22600x600-noTransform%22%2C%22stationId%22%3A74%2C%22previousTrackLimit%22%3A3%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%228a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8%22%7D%7D","interval":"2","headers":"{\n\t\"User-Agent\": \"request\"\n}","username":"","password":"","body":"json","active":true,"x":130,"y":660,"wires":[["b079e5cb.653bf8"]]},{"id":"b079e5cb.653bf8","type":"function","z":"115e4b1a.1cf765","name":"","func":"if (msg.payload.data.now.playing_item.title == null)\n msg.payload.data.now.playing_item.title = \"\";\nreturn msg;","outputs":1,"noerr":0,"x":330,"y":660,"wires":[["6c83b9c6.b2d408"]]},{"id":"6c83b9c6.b2d408","type":"rbe","z":"115e4b1a.1cf765","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload.data.now.playing_item.title","x":470,"y":660,"wires":[["9b822e8f.54b79"]]},{"id":"9b822e8f.54b79","type":"switch","z":"115e4b1a.1cf765","name":"","property":"payload.data.now.song.__typename","propertyType":"msg","rules":[{"t":"eq","v":"SongOnAir","vt":"str"},{"t":"eq","v":"TimelineItem","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":640,"y":660,"wires":[["37726581.afa06a"],[]]},{"id":"37726581.afa06a","type":"function","z":"115e4b1a.1cf765","name":"","func":"msg.topic = \"/metadata\";\n\nvar playing_item = msg.payload.data.now.playing_item;\nvar artist = playing_item.title;\nartist = encodeURIComponent(artist);\nvar title = playing_item.subtitle;\ntitle = encodeURIComponent (title);\nmsg.payload = artist + \"%20-%20\" + title;\nmsg.radio = \"fipelectro\";\nreturn msg;","outputs":1,"noerr":0,"x":830,"y":660,"wires":[["56082fc5.5bd3b"]]}]
Pensez à modifier le mot de passe et l'adresse IP dans le noeud 'PASSWORD'.
Les radios suivantes sont disponibles:
http://IP_de_votre_Raspberry:8000/fip
http://IP_de_votre_Raspberry:8000/fiprock
http://IP_de_votre_Raspberry:8000/fipjazz
http://IP_de_votre_Raspberry:8000/fipgroove
http://IP_de_votre_Raspberry:8000/fipmonde
http://IP_de_votre_Raspberry:8000/fipnouveaute
http://IP_de_votre_Raspberry:8000/fipreggae
http://IP_de_votre_Raspberry:8000/fipelectro
Vous trouverez dans le lien ci-dessous les logos de FIP et des webradios (merci Rémi !):
Bon amusement !
Merci Sebastien, j'ai donc ajouté le flux audio FIP Pop avec les paramètres ICECast que tu indiques. Pour récupérer les meta dans Node-Red via l'API RadioFrance le stationId de FIP Pop est 78 j'ai donc utilisé:
https://www.fip.fr/latest/api/graphql?operationName=Now&variables={"bannerPreset"%3A"600x600 noTransform"%2C"stationId"%3A78%2C"previousTrackLimit"%3A3}&extensions={"persistedQuery"%3A{"version"%3A1%2C"sha256Hash"%3A"8a931c7d177ff69709a79f4c213bd2403f0c11836c560bc22da55628d8100df8"}}
Tout fonctionne très bien !
Hello heroldgray, c'est assez facile à ajouter :)
Dans le fichier icecast.xml, ajouter la source suivante:
<relay> <server>icecast.radiofrance.fr</server> <port>80</port> <mount>/fippop-hifi.aac</mount> <local-mount>/fippop</local-mount> </relay>
Et dans node-red, copier un des flux FIP et le modifier pour l'adapter à FIP POP.
Dis moi si pas clair, au besoin je modifierai mon billet avec les instructions complètes mises à jour.
Hello Sebastien, merci beaucoup pour ce très bon tuto ! L'utilisation de Node-Red est extrêmement convaincante et robuste. Juste un détail, pour FIP il manque la radio Pop.
Pour le flux audio j'imagine que le point de montage ICECast chez RF est fippop-hifi.aac mais plus difficile d'extrapoler l'adresse de l'API pour récupérer les metadonnées, aurais-tu cette adresse ou une ressource pour la trouver ? Merci encore.