Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old November 16th, 2004   #1
zenwhen
Quad Shot of Ubuntu
 
zenwhen's Avatar
 
Join Date: Nov 2004
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
Smile HOWTO: Install and Customize Music Player Daemon in Ubuntu

What is Music Player Daemon ?

Quote:
Music Player Daemon (MPD) allows remote access for playing music (MP3, Ogg Vorbis, FLAC, AAC, Mod, and wave files) and managing playlists. MPD is designed for integrating a computer into a stereo system that provides control for music playback over a local network. It is also makes a great desktop music player, especially if you are a console junkie, like frontend options, or restart X often.
Why should I use it instead of Rhythmbox or Muine?

MPD is light on your resources, and high on extensibility. The daemon is easy to interact with, develop front ends for, and configure with intuitive configuration scripts. If that doesn't convince you, perhaps the pretty screenshots and features coming later in this thread will.

Where can I get Ubuntu compatible packages?

I took the liberty of tarring up the files needed to set MPD up in Ubuntu as I have it set up. You can get them here.
(You could also get them from the Debian unstable repos but I think the Ubuntu devs here would eat my face if I gave a HOWTO on that. )

Once you have that, untar it and cd into the dir. You will then need to install the three debs. Be sure you are in the dir containing mpd-ubuntu.tar.gz and execute these commands:

Code:
tar xvfz mpd-ubuntu.tar.gz
cd mpd-ubuntu
dpkg -i mpd_0.11.5-1_i386.deb
dpkg -i mpc_0.11.1-2.1_i386.deb
dpkg -i gmpc_0.11.2-2_i386.deb
nano mpd.conf
Now that you have this configuration file open, edit "PATH TO YOUR MUSIC DIRECTORY" to contain the actual path to your music directory. Hit control +o then control + x, and then execute this command:

Code:
sudo cp mpd.conf /etc
Now, drop the .mpd DIR and the .gmpc.cfg FILE from mpd-ubuntu into your home dir.

Next, you will want to look at the help text for mpd.

Code:
zenwhen@sunball:~ $ mpd --help

usage:
   mpd [options] <port> <music dir> <playlist dir> <log file> <error file>
   mpd [options] <conf file>
   mpd [options]   (searches for ~/.mpdconf then /etc/mpd.conf)

options:
   --help             this usage statement
   --no-daemon        don't detach from console
   --stdout           print msgs to stdout and stderr
   --create-db        force (re)creation database and exit
   --update-db        create database and exit
   --no-create-db     don't create database
   --verbose          verbose logging
   --version          prints version information
It is always a good idea to look at the -help, --help, or -h option of any new program you install. I don't mean that to be insulting to you if you aren't quite new to Linux, but this is just a good habit to form.

The command we were looking for was "--create-db". So run:

Code:
mpd --create-db
This loads all of your music into MPD's database file. You can make playlists, and control your MPD with the application GMPC (gnome media player daemon client), which we installed earlier. You will find it in your application -> Multimedia menu, and can also run it with the command "gmpc" from the terminal.

This is what your nice GTK themed front end looks like:



Using this to manage MPD and update your database will make using MPD effortless, and its playlist options are as as good as any, though not as complicated. You may have noticed a set of panel luanchers there on that screenshot that look like media player controls. Those are custom application launchers added to the gnome panel with a right click that point to some of these commands that can be sent to MPC (the command line media player daemon client) :

Code:
mpc                         Displays status
mpc add <filename>          Add a song to the current playlist
mpc del <playlist #>        Remove a song from the current playlist
mpc play <number>           Start playing at <number> (default: 1)
mpc next                    Play the next song in the current playlist
mpc prev                    Play the previous song in the current playlist
mpc pause                   Pauses the currently playing song
mpc stop                    Stop the currently playing playlists
mpc seek <0-100>            Seeks to the position specified in percent
mpc clear                   Clear the current playlist
mpc shuffle                 Shuffle the current playlist
mpc move <from> <to>        Move song in playlist
mpc playlist                Print the current playlist
mpc listall [<song>]        List all songs in the music dir
mpc ls [<dir>]              List the contents of <dir>
mpc lsplaylists             Lists currently available playlists
mpc load <file>             Load <file> as a playlist
mpc save <file>             Saves a playlist as <file>
mpc rm <file>               Removes a playlist
mpc volume [+-]<num>        Sets volume to <num> or adjusts by [+-]<num>
mpc repeat <on|off>         Toggle repeat mode, or specify state
mpc random <on|off>         Toggle random mode, or specify state
mpc search <type> <queries> Search for a song
mpc crossfade [sec]         Set and display crossfade settings
mpc update                  Scans music directory for updates
mpc version                 Reports version of MPD
The icons are from RedHat's Bluecurve icon set. I tarred them up for your use with the launchers. You can grab them here.

You will have to start mpd with the "mpd" command before this system for music playing works. You can either add a launcher to run that command, run it from the terminal whenever you start up, or you can add it to "gnome-session-properties" as a startup command.

After that, you will be able to run GMPC, have a nice pop-up window whenever the song changes, control it in a winamp like fashion with he GUI, and control it from your taskbar. You can control it from the terminal without booting into X with the mpc commands listed above, and can control it with FoxyTunes.

If you noticed that I said the word "control" a lot in that last paragraph, you are right. MPD gives you total control over your music library, and gives you the ability to control it from wherever you wish, however you wish, access it how you wish, and from any OS you wish using any desktop environment you wish. There are also clients for all of the major desktop environments; including KDE and even Windows.

I will answer any questions you raise to the best of my ability. Enjoy!

Edit: Made a change thanks to MPD dev shank. Hey shank.

Last edited by zenwhen; November 16th, 2004 at 01:49 PM..
zenwhen is offline   Reply With Quote
Old November 16th, 2004   #2
panickedthumb
Cloned
 
panickedthumb's Avatar
 
Join Date: Oct 2004
Location: /home
My beans are hidden!
Ubuntu 9.04 Jaunty Jackalope
Send a message via ICQ to panickedthumb Send a message via AIM to panickedthumb Send a message via MSN to panickedthumb Send a message via Yahoo to panickedthumb Send a message via Skype™ to panickedthumb
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

Looks pretty slick! If I get bored with rhythmbox I'll try this out
panickedthumb is offline   Reply With Quote
Old November 19th, 2004   #3
Erikhh
5 Cups of Ubuntu
 
Join Date: Nov 2004
Beans: 28
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

I got interested in mpd and downloaded the files, but i doesnt work. Cant even do:
mpd --create-db
without getting an error message.

There are also problems with the channels. What do I do wrong?
Erikhh is offline   Reply With Quote
Old November 19th, 2004   #4
zenwhen
Quad Shot of Ubuntu
 
zenwhen's Avatar
 
Join Date: Nov 2004
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

What was the error you got when you ran the command?

Did you point the conf file to your music dir?

Could you describe your "channels" problem in more detail?
zenwhen is offline   Reply With Quote
Old November 20th, 2004   #5
Erikhh
5 Cups of Ubuntu
 
Join Date: Nov 2004
Beans: 28
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

It couldn't create playlists

The problem with the channels seems to be, that mpc couldn't "connect" or what you call it.
Erikhh is offline   Reply With Quote
Old November 25th, 2004   #6
zenwhen
Quad Shot of Ubuntu
 
zenwhen's Avatar
 
Join Date: Nov 2004
My beans are hidden!
Ubuntu 7.10 Gutsy Gibbon
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

Erikhh, come into #mpd on irc.freenode.org sometime. Your issue could likely be handled easier there.
zenwhen is offline   Reply With Quote
Old November 26th, 2004   #7
Erikhh
5 Cups of Ubuntu
 
Join Date: Nov 2004
Beans: 28
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

Thanks for your concern. At the moment I have given up, because it got too complicated, but I'll try and go to the adress you mention.
Erikhh is offline   Reply With Quote
Old December 18th, 2004   #8
Whippet
First Cup of Ubuntu
 
Join Date: Dec 2004
Beans: 1
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

Thank you for you very nice How to. I finally got mpd with gmpc running
Whippet is offline   Reply With Quote
Old December 18th, 2004   #9
crun
Just Give Me the Beans!
 
crun's Avatar
 
Join Date: Oct 2004
Location: Alkmaar, The Netherlands
Beans: 44
Ubuntu 7.10 Gutsy Gibbon
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

Hi Zenwhen. I really like the way MPD works so far, a great new way to organize your playlists.

Concerning the install howto: when the .mpd dir gets created, the subdirectory "playlists" isn't included. This causes an error when running "mpd --create-db". I created the dir with

$ cd .mpd
$ mkdir playlists
$ chmod -R 700 playlists

and then moved the whole .mpd dir to my home folder. After this, "mpd --create-db" runs fine.

Once again, thanks for a great program
crun is offline   Reply With Quote
Old December 23rd, 2004   #10
AllTom
First Cup of Ubuntu
 
Join Date: Dec 2004
Beans: 7
Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

I like to use the init scripts that come with MPD so I get music as soon as I turn on my computer. Under Ubuntu, my home directory and all my folders automatically have o+r permissions set, so having all my music in /home/tom/media/audio/music/ is fine. In /etc/mpd.conf I change the following variables from their defaults:

Code:
music_directory         "/home/tom/media/audio/music"
playlist_directory      "/etc/mpd/playlists"
log_file                "/etc/mpd/mpd.log"
error_file              "/etc/mpd/mpd.error"
db_file         "/etc/mpd/mpd.db"
state_file              "/etc/mpd/mpdstate"
user            "mpd"
Then, as root, I run

Code:
# useradd -G audio mpd
# mkdir /etc/mpd
# mkdir /etc/mpd/playlists
# chown -R mpd:audio /etc/mpd
# /etc/init.d/mpd start-create-db
At this point, the database is created in /etc/mpd/mpd.db and the daemon started immediately. I can still use gmpc to control it, but now it is a service that can be started automatically on boot.. Have fun!
AllTom is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:33 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry