MPD

From Gentoo-en
Jump to: navigation, search

From musicpd.org:

Music Player Daemon (MPD) is a flexible, powerful, server-side application for playing music. Through plugins and libraries it can play a variety of sound files while being controlled by its network protocol. For more information, read about what mpd is and is not.

Because of its minimal need for resources, both servers and desktop users use MPD. MPD does require some configuring to have it run correctly.

Installation

MPD carries a great deal of USE flags, some for various format support(aac, flac, ogg, etc.), other for various output methods(alsa, pulseaudio, jack, etc.). A pretend emerge will expose what USE flags are available:

emerge --pretend --verbose media-sound/mpd

Set those that suit your wants and needs and emerge it:

emerge --ask --verbose media-sound/mpd

Configuration

MPD can be run either as the system ( or root) or a user. be it your username or a specially made user.

media-sound/mpd installs a example /etc/mpd.conf used for configuring the system daemon. This file needs be copied to ~/.mpdconf if you want to configure MPD on a per-user basis. Make sure you read the comments in this file. as they will explain how to set up mpd as you wish.

See the mpd.conf man page for more:

man mpd.conf

System daemon

If you decided to use MPD as a system daemon, comment out "user" and "group" settings, and make sure it can access "music_directory","db_file","pid_file" and "state_file" a good set up is like such:

Code: /etc/mpd.conf
music_directory			"/home/<username>/music" #could also make this a shared folder, like /usr/share/music
playlist_directory		"/home/<username>/music/playlists" 
db_file				"/var/lib/mpd/database"
log_file			"/var/log/mpd/mpd.log"
pid_file			"/var/run/mpd/mpd.pid"
state_file			"/var/lib/mpd/state"

don't forget to add it to the default runlevel:

rc-update add mpd default

Clients

Visit the MPD wiki article on what clients are available.

Troubleshooting

For general troubleshooting refer to the excellent MPD troubleshooting section

If you're getting "connection refused" problems and you have compiled mpd with tcpd flag, dont forget to add

Code: hosts.allow
MPD: localhost 127.0.0.1 192.168.

to your hosts.allow folder, to allow access from localhost ( and the LAN with "192.168.X.X", omit this if this is not what you want. )

System-wide MPD & PulseAudio

If you want to run MPD system-wide with PulseAudio you have configure PulseAudio to also run as a system service. See the PulseAudio article System Server section for instruction.

See also