View RSS Feed


mpd-configure: generate a bit perfect mpd configuration with a single command

Rate this Entry
Hi there,

All those new (and maybe even older) to music player daemon (mpd), linux and alsa, I've published a free script which with a single command generates a configuration file for mpd, which turns it in to an bit perfect music streamer.

The only requirement is that you have a working linux installation with mpd installed. After opening up a terminal screen, paste the following commands to generate and display a mpd configuration. When multiple audio cards (including USB DACs) are found, the script will ask you which one you want to use:

## make the directory where you want to download the script
mkdir /tmp/mpd-configure
## change to that directory
cd /tmp/mpd-configure
## download and unpack the script and other files needed
wget -O - | tar --strip-components=1 -zxf -
## run the script (the resulting configuration file will be displayed on the screen
bash mpd-configure
The script can be used in a fully automated fashion, by setting command line parameters and/or environment variables. In the following example, the result is saved to the system wide mpd configuration file `/etc/mpd.conf`, uses the first available USB Audio Class interface, sets the `music_directory` to `/srv/media/music` and the mpd 'home' directory (including its 'database') to `/var/lib/mpd`. In the case `/etc/mpd.conf` already exists, the script will make a backup of it:

## become root if neccessary
[[ $EUID -eq 0 ]] || sudo su
## set the paths to the music and mpd data directories and run the script,
## saving the output to `/etc/mpd.conf` while creating a backup of that file
## in case it exists:
CONF_MPD_MUSICDIR="/srv/media/music" CONF_MPD_HOMEDIR="/var/lib/mpd" \
bash ./mpd-configure --limit usb --noprompts --output "/etc/mpd.conf"
## restart mpd to use the new file
systemctl restart mpd
## done (press ENTER)
Some background information:

Regards and enjoy the music,