Page 1 of 3 123 LastLast
Results 1 to 10 of 29

Thread: HOWTO: Install and Customize Music Player Daemon in Ubuntu

  1. #1
    Join Date
    Nov 2004
    Beans
    Hidden!
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Smile HOWTO: Install and Customize Music Player Daemon in Ubuntu

    What is Music Player Daemon ?

    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. 8)

    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 06:49 PM.

  2. #2
    Join Date
    Oct 2004
    Beans
    Hidden!

    Re: HOWTO: Install and Customize Music Player Daemon in Ubuntu

    Looks pretty slick! If I get bored with rhythmbox I'll try this out

  3. #3
    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?

  4. #4
    Join Date
    Nov 2004
    Beans
    Hidden!
    Distro
    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?

  5. #5
    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.

  6. #6
    Join Date
    Nov 2004
    Beans
    Hidden!
    Distro
    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.

  7. #7
    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.

  8. #8
    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

  9. #9
    Join Date
    Oct 2004
    Location
    Alkmaar, The Netherlands
    Beans
    44
    Distro
    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

  10. #10
    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!

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •