Command to regenerate mpd.conf

Hi

After changing /volumio/app/plugins/music_service/mpd/mpd.conf.tmpl it is possible to regenerate /etc/mpd.conf by going to the Web UI and in Settings > Playback Options and clicking on Save in the Audio Output section.

I would like to trigger the regeneration from a bash script. Is there a command that will cause /etc/mpd.conf to be regenerated?

Thanks

Adrian.

Does anyone have any thoughts on this? It doesn’t have to be a single command, a small script would be fine. I just want to be able to automate the change so I can make an installer for Volumio.

Adrian.

What is it that you’re trying to achieve by editing the template? That’s not really designed to be a user-editable file, and it may break updates for you.

Hi

I have a project that includes an audio visualiser (spectrum display)

Volumio does not provide a way to configure a copy of the playing audio, which is needed for audio visualisation.

An incomplete, but easy and reliable way to make a copy is by adding an audio output section to /etc/mpd.conf, which means editing mpd.conf.tmpl.

The changes can be undone, to allow updates, by running

volumio updater restorevolumio

(not that this command changes /etc/mpd.conf !)

Any other suggestions for making a (software) copy of the playing audio would also be welcome. The following thread looks at the use of ALSA configuration, but is tricky to give instructions for, and I am not sure if the configuration will be overwritten by Volumio or plugins

Adrian.

Next Volumio based on buster will use a new alsa layout. It will be very easy to create a plugin to route audio output to a pipe. It is already in test with the peppymeter plugin. Don’t waste time with mpd.conf.

It sounds like what you want will be the new support for pluggable ALSA contributions from Volumio plugins coming in the buster development stream. I know that @balbuze is doing something similar for peppy to provide a vu meter right now, so perhaps he will be best placed to help.

Hi balbuze and timothyjward

Thanks for your replies. It is great that there is a solution to this on the horizon.

For now though, I would like to make it easy to install mpd_oled on the current Volumio. I am therefore still interested in whether anybody knows how to trigger the regeneration of /etc/mpd.conf on the command line.

Adrian.

Call a node script that opens a web-socket and calls the endpoint directly… You should get away with something like this…

const io = require('socket.io-client');
const socket = io.connect('http://localhost:3000');

// Call the endpoint
const endPoint = { 'endpoint': 'music_service/mpd', 'method': 'createMPDFile', 'data': '' };
socket.emit('callMethod', endPoint);

// Sleep and exit as I don't feel like figuring out the correct push response.
setTimeout(() => process.exit(0), 1000);

Hi ashthespy

Thanks for the script, this is the kind of solution I am looking for, but I was unable to get it to work.

I copied the code to a file called mpd_conf_regen.js and then tried to run it with

node mpd_conf_regen.js

This gave an error

Error: Cannot find module 'socket.io-client'

So I ran

npm install socket.io-client

The command then silently completed, but /etc/mpd.conf was not regenerated. I do not know what to change to make it work.

Adrian.

I don’t know for certain but a while back I had to change to

npm install socket.io-client@^1.7.4

To get my scripts working again

Hi Old_Duffer

It worked!

With the current version nothing happens, and no messages in the Volumio log. With version 1.7.4 everything works perfectly.

Thanks very much (and again to ashthespy)!

I’ll now see there is an alternative way to make the call.

Adrian.

Indeed, you need to match the 1.7.y version that Volumio still uses, or the pre-existing module from /volumio/node_modules

Hi ashthespy

I copied the script to a new directory, and checked it failed with the socket.io-client error. I then ran

ln -s /volumio/node_modules/

And the script ran correctly. That will be just fine then!

Thanks

Adrian.