Hi adrii,
You can do it this way…
First create a file containing the extra mpd output definition in a convenient directory, eg /home. In my example below the full file name is
/home/your-extra-mpd.conf :
- Code: Select all
nano /home/your-extra-mpd.conf
The contents will be something like this:
- Code: Select all
#########################
## your-extra-mpd.conf ##
## FiFo ##
#########################
audio_output {
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
enabled "yes"
}
############################
## end your-exta-mpd.conf ##
############################
Then set the correct file protection:
- Code: Select all
chmod 644 /home/your-extra-mpd.conf
Then you need to add
one line to the file
/srv/http/app/libs/runeaudio.php, you need to look for the
function wrk_mpdconf. In this function (it’s a big one, so look carefully) you will find the following lines which will need to be modified:
- Code: Select all
// write mpd.conf file
$fh = fopen('/etc/mpd.conf', 'w');
fwrite($fh, $output);
fclose($fh);
// update hash
$redis->set('mpdconfhash', md5_file('/etc/mpd.conf'));
} else {
runelog('mpd.conf advanced mode ON');
}
break;
So open the
runeaudio.php file:
- Code: Select all
nano /srv/http/app/libs/runeaudio.php
The extra line of code which you need to add is:
- Code: Select all
$output .= file_get_contents('/home/your-extra-mpd.conf');
Modify runeaudio.php so that it looks like this:
- Code: Select all
// write mpd.conf file
$output .= file_get_contents('/home/your-extra-mpd.conf');
$fh = fopen('/etc/mpd.conf', 'w');
fwrite($fh, $output);
fclose($fh);
// update hash
$redis->set('mpdconfhash', md5_file('/etc/mpd.conf'));
} else {
runelog('mpd.conf advanced mode ON');
}
break;
That should do it.
You will need to reboot and modify something (anything) in the MPD UI to activate it. You can check the results by looking at the Debug UI (you may need to refresh the browser a few times to see the actual content), the
mpd.conf file is listed in full.
Note 1: You will
not be able to select the added output device from the MPD UI, it is always there and therefore should always be ON. Switching the output ON is done with the ‘enabled’ clause. In theory MPD has no problems with multiple outputs which are ON, but with the less powerful PI models (Zero and B+) it may not work correctly.
Note 2: It only works with MPD. So, for Spotify, Airplay and UPnP/DLNA this modification has no effect.
Note 3: You need something to read the FiFo pipe. Reading it effectively empties it. Otherwise it will grow until it fills your file system.
janui