mpd – Music Player Daemon

Music Player Daemon (MPD) is a music player which allows for remote access from another computer. An example is a headless computer running MPD and using one of the available front ends to control it remotely. It also makes for a good media player for desktop computers, particularly if the user either does not use or frequently restarts X.

MPD does not stream audio; all playback occurs on the server where the music files are located. The remote client controls playback from a nearby location.

MPD uses a text file as a database in which to maintain the basic music file information when it is not running. Once the daemon is started, the database is kept completely in-memory and no hard disk access is necessary to look up or search for a song. This database does not allow arbitrary files to be added; music files must be above the music root directory and are only added to the database when the update command is sent to the server.

Install:

apt-get install mpd mpc

Edit config file/etc/mpd.conf:

port            "6600"
music_directory         "~/music"
playlist_directory      "~/.mpd/playlists"
db_file                 "~/.mpd/mpd.db"
log_file                "/var/log/mpd/mpd.log"
error_file              "/var/log/mpd/mpd.error"
user                    "mpd"
bind_to_address         "192.168.0.254" #only private interface

Create dir and set own:

mkdir -p ~/music/.mpd/playlists
chown -R mpd ~/music

Create DB:

/etc/init.d/mpd restart
mpd --create-db

Add all music to playlist and… play:

mpc update
mpc add /
mpc play

References

mpd –create-db
This will start the daemon. The ‘–create-db’ argument will read the contents of the root music directory and add the Music files to a text database. You should see the list of files being added into the DB. This may take some time to complete – based on size of your music collection.
mpc update
The command used here is ‘mpc’ – not ‘mpd’. We are using a command line client now. This command scans the root music directory for updates.
mpc add /
This command will add all the files in the music directory to the current playlist. Please note that the ‘/’ here means root music directory – and not the global linux root.
mpc play
This will start playing the files in the current playlist.

Links

Tags: ,

Leave a Reply