IR Remote Controller Plugin and extra remote controll

I successfully tested the following code:[code]#!/bin/node

var io = require(‘socket.io-client’);
var socket = io.connect(‘http://localhost:3000’);
socket.emit(‘clearQueue’);
var fs = require(‘fs’);
var content = fs.readFileSync(’/data/favourites/my-web-radio’);
var webradios = JSON.parse(content);
var radio = webradios.find(o => o.name === process.argv[2]);

if (radio == null) {
socket.disconnect();
} else {
socket.emit(‘addPlay’, {‘service’:radio.service,‘title’:radio.name,‘uri’:radio.uri});
socket.on(‘pushState’, function() { socket.disconnect(); } );
}

setTimeout(function() { socket.disconnect(); }, 500);

[/code]
To create a .js file with the code above in e.g. /usr/local/bin connect to volumio via ssh and open the nano editor:

nano /usr/local/bin/yourscript.js

Copy and paste the code into nano then close nano saving the file:

Ctrl+x y Return
The script needs socket.io-client. If it has not been installed yet run npm install socket.io-client
After that lircrc can call the script with the name of the desired webradio station (which has to be be added to “My Web Radios” before of course) as parameter:

config = /usr/local/bin/yourscript.js "yourwebradio"

Edit:
The example above covers selecting a radio station from my web radios and not from radio favourites. But that is easily possible, too. Just change “var content = fs.readFileSync(’/data/favourites/my-web-radio’);” to var content = fs.readFileSync('/data/favourites/radio-favourites'); and “socket.emit(‘addPlay’, {‘service’:radio.service,‘title’:radio.name,‘uri’:radio.uri});” to socket.emit('addPlay', {'service':radio.service,'title':radio.title,'uri':radio.uri});