MPD: Music Player Daemon

About:

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 also makes a great desktop music player, especially if you are a console junkie, like frontend options, or restart X often.

@ MPD homepage

Overview:

Não estou aqui para explicar o que é  - Todos percebem que é um leitor de música.
Mas sim apresentá-lo e indicar as instruções de como o instalar.

Instalação/Configuração:

# apt-get install mpd sonata
Agora vem a parte chata e um bocado confusa. É preciso configurar o mpd antes de o poder utilizar. Para começar vamos editar o ficheiro /etc/mpd.conf. Recomendo que façam uma cópia de segurança do ficheiro inicial para prevenir futuros deslizes e evitar que se ande a procurar o mpd.conf pela web.
# cp /etc/mpd.conf /etc/mpd.conf.backup
# nano /etc/mpd.conf

  1. REQUIRED PATHS & OPTIONAL PATHS
    Neste passo é necessário configurar as directorias segundo o local onde está localizada a nossa música. No campo music_directory coloquem a directoria da vossa música (apenas dá para colocar uma) e nas restantes copiem deste exemplo.
    ######################## REQUIRED PATHS ########################
    # You can put symlinks in here, if you like. Make sure that
    # the user that mpd runs as (see the 'user' config parameter)
    # can read the files in this directory.
    music_directory      “/home/os.meus.documentos/music”
    playlist_directory   “~/.mpd/playlists”
    db_file              “~/.mpd/tag_cache”
    log_file             “~/.mpd/mpd.log”
    error_file           “~/.mpd/errors.log”
    pid_file             “~/.mpd/pid”

    ################################################################
    #
    ######################## OPTIONAL PATHS ########################
    #
    # If specified, MPD will save its current state (playlist,
    # current song, playing/paused, etc.) at exit. This will be
    # used to restore the session the next time it is run.
    #
    state_file “~/.mpd/state”
    #
    ################################################################
  2. DAEMON OPTIONS
    Coloquem no campo user o nome do vosso user (no meu caso é qaz). Descomentem os restantes.
    ######################## DAEMON OPTIONS ########################
    #
    # If started as root, MPD will drop root privileges and run as
    # this user instead.  Otherwise, MPD will run as the user it was
    # started by.  If left unspecified, MPD will not drop root
    # privileges at all (not recommended).
    #
    user                            “qaz”
    #
    # The address and port to listen on.
    #
    bind_to_address                 “localhost”
    port                            “6600″

    #
    # Controls the amount of information that is logged.  Can be
    # “default”, “secure”, or “verbose”.
    #
    log_level                       “default”
    #
    ################################################################
  3. AUDIO OUTPUTS & MIXER
    Descomentem as linhas do vosso output. No meu caso é alsa.
    ########################## AUDIO OUTPUT ########################
    #
    # MPD supports many audio output types, as well as playing
    # through multiple audio outputs at the same time.  You can
    # specify one or more here.  If you don't specify any, MPD will
    # automatically scan for a usable audio output.
    #
    # See <http://mpd.wikia.com/wiki/Configuration#Audio_Outputs>
    # for examples of other audio outputs.
    #
    # An example of an ALSA output:
    #
    audio_output {
    type                    “alsa”
    name                    “My ALSA Device”

    #        device                  “hw:0,0″     # optional
    #        format                  “44100:16:2″ # optional
    }
    #
    # An example of an OSS output:
    #
    #audio_output {
    #        type                    “oss”
    #        name                    “My OSS Device”
    #        device                  “/dev/dsp”   # optional
    #        format                  “44100:16:2″ # optional
    #}
    #
    # An example of a shout output (for streaming to Icecast):
    #
    #audio_output {
    #        type                    “shout”
    #        name                    “My Shout Stream”
    #        host                    “localhost”
    #        port                    “8000″
    #        mount                   “/mpd.ogg”
    #        password                “hackme”
    #        quality                 “5.0″
    #        bitrate                 “128″
    #        format                  “44100:16:1″
    #        user                    “source”                # optional
    #        description             “My Stream Description” # optional
    #        genre                   “jazz”                  # optional
    #        public                  “no”                    # optional
    #}
    #
    # Force all decoded audio to be converted to this format before
    # being passed to the audio outputs.
    #
    #audio_output_format             “44100:16:2″
    #
    ################################################################
    #
    ############################# MIXER ############################
    #
    # MPD needs to know what mixer settings to change when you
    # adjust the volume.  If you don’t specify one here, MPD will
    # pick one based on which ones it was compiled with support for.
    #
    # An example for controlling an ALSA mixer:
    #
    mixer_type                      “alsa”
    mixer_device                    “default”
    mixer_control                   “PCM”

    #
    # An example for controlling an OSS mixer:
    #
    #mixer_type                      “oss”
    #mixer_device                    “/dev/mixer”
    #mixer_control                   “PCM”
    #
    # If you want MPD to adjust the volume of audio sent to the
    # audio outputs, you can tell it to use the software mixer:
    #
    #mixer_type                      “software”
    #
    ################################################################
  4. OTHER OPTIONS
    Descomentem as duas entradas.
    ######################### OTHER OPTIONS ########################
    #
    # The metadata types MPD will recognize.
    #
    metadata_to_use                  “artist,album,title,track,name,genre,date,composer,performer,disc”
    #
    # Enable this if you wish to use your MPD created playlists in
    # other music players.
    #
    save_absolute_paths_in_playlists “no”
    #
    ################################################################
  5. Outras configurações
    Ficaram como estão por default. Para evitar dúvidas aqui fica o MEU resultado final.

Agora temos de adicionar o nosso user (qaz no meu caso) ao grupo mpd (a necessidade deste passo desconheço):
# groupadd mpd
# gpasswd -a qaz mpd

Certifica-te que a pasta ~/.mpd não necessita de previlégios root.

Agora iremos fazer a base de dados - poderá demorar algum tempo.
$ mpd --create-db
Neste momento já tens o mpd completamente instalado e configurado.
$ mpd

Frontend:

Necessitamos apenas agora de um frontend. Vou escolher o Sonata.

Sonata is an elegant GTK+ music client for the Music Player Daemon (MPD).

@ Sonata Homepage

Screenshot do sonata. Clica na imagem para mais imagens.

O Sonata também requer alguma configuração. Mas primeiro lança-lo:
$ sonata
Vão até as preferências e no separador MPD insiram as vossas configurações. MEU caso ficará:

  • Name: qaz
  • Host: localhost
  • Port: 6600
  • Password: (em branco)
  • Music dir: /home/os.meus.documentos/music/

Se necessário matem os dois processos (killall) e lancem de novo mpd e sonata.

Referências:
» Techzone/Zwame
» ArchLinux Wiki
» MPD homepage

Meus ficheiros:
» http://dotfiles.org/~uterrorista/%2Fetc%2Fmpd.conf

FeedBack:
Se tiverem alguma dúvida ou reparo no tutorial não hesitem - os comentários são para isso mesmo :P

Popularity: 90% [?]

Sem entradas relacionadas no Linuxdeb. Outros:

One Response to “MPD: Music Player Daemon”

  1. Says:

    [...] public links >> playback João Gonçalves: MPD: Music Player Daemon First saved by foundit | 1 days ago Apple Issues Software Update for MacBook Air, Fixes Video [...]


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>