Next: , Previous: , Up: 服务   [Contents][Index]


12.9.28 音频服务

The (gnu services audio) module provides a service to start MPD (the Music Player Daemon).

Music Player Daemon

The Music Player Daemon (MPD) is a service that can play music while being controlled from the local machine or over the network by a variety of clients.

The following example shows how one might run mpd as user "bob" on port 6666. It uses pulseaudio for output.

(service mpd-service-type
         (mpd-configuration
          (user "bob")
          (port "6666")))
Scheme Variable: mpd-service-type

The service type for mpd

Data Type: mpd-configuration

Data type representing the configuration of mpd.

user (default: "mpd")

The user to run mpd as.

music-dir (default: "~/Music")

The directory to scan for music files.

playlist-dir (default: "~/.mpd/playlists")

The directory to store playlists.

db-file (default: "~/.mpd/tag_cache")

The location of the music database.

state-file (default: "~/.mpd/state")

The location of the file that stores current MPD’s state.

sticker-file (default: "~/.mpd/sticker.sql")

The location of the sticker database.

port (default: "6600")

The port to run mpd on.

address (default: "any")

The address that mpd will bind to. To use a Unix domain socket, an absolute path can be specified here.

outputs (default: "(list (mpd-output))")

The audio outputs that MPD can use. By default this is a single output using pulseaudio.

Data Type: mpd-output

Data type representing an mpd audio output.

name (default: "MPD")

The name of the audio output.

type (default: "pulse")

The type of audio output.

enabled? (default: #t)

Specifies whether this audio output is enabled when MPD is started. By default, all audio outputs are enabled. This is just the default setting when there is no state file; with a state file, the previous state is restored.

tags? (default: #t)

If set to #f, then MPD will not send tags to this output. This is only useful for output plugins that can receive tags, for example the httpd output plugin.

always-on? (default: #f)

If set to #t, then MPD attempts to keep this audio output always open. This may be useful for streaming servers, when you don’t want to disconnect all listeners even when playback is accidentally stopped.

mixer-type

This field accepts a symbol that specifies which mixer should be used for this audio output: the hardware mixer, the software mixer, the null mixer (allows setting the volume, but with no effect; this can be used as a trick to implement an external mixer External Mixer) or no mixer (none).

extra-options (default: '())

An association list of option symbols to string values to be appended to the audio output configuration.

The following example shows a configuration of mpd that provides an HTTP audio streaming output.

(service mpd-service-type
         (mpd-configuration
           (outputs
             (list (mpd-output
                     (name "streaming")
                     (type "httpd")
                     (mixer-type 'null)
                     (extra-options
                      `((encoder . "vorbis")
                        (port    . "8080"))))))))

Next: 虚拟化服务, Previous: 电源管理服务, Up: 服务   [Contents][Index]