MPD(Music Player Daemon)是带服务器端的音乐播放器,采用C/S架构。它和传统的播放器不同,mpd会作为一个守护进程运行在后台,通过本地或远程客户端软件来控制mpd播放音乐。
Music Player Daemon (MPD) is a flexible, powerful, server-side application for playing music. Through plugins and libraries it can play a variety of sound files while being controlled by its network protocol.
Ubuntu安装配置MPD
使用apt安装:
$ sudo apt-get install mpd
启动mpd服务:
$ sudo systemctl start mpd
配置mpd:
配置文件位于 /etc/mpd.conf
$ sudo vim /etc/mpd.conf
每个选项上都有详细的注释。下面列出一些基本的配置选项:
音乐文件目录(包含子目录):
music_directory "/home/your_user/Music"
如果你只在本地使用:
bind_to_address "localhost"
如果你通过网络使用:
bind_to_address "192.168.0.106"
mpd使用的端口:
port "6600"
如果要设置访问密码:
password "your_password"
重启mpd
$ sudo systemctl restart mpd
客户端
MPD的客户端有很多,有基于命令行的,也有基于GTK/QT。
下面介绍两个最流行的mpd客户端。
Cantata(基于QT)
Ubuntu安装Cantata:
$ sudo apt-get install cantata
配置:
Ncmpcpp:基于命令行的mpd客户端。
安装ncmpcpp:
$ sudo apt-get install ncmpcpp
创建配置文件:
$ mkdir ~/.ncmpcpp
$ cd ~/.ncmpcpp
$ vim config
ncmpcpp_directory = "~/.ncmpcpp"
mpd_host = "localhost"
mpd_port = "6600"
mpd_music_dir = "/home/snail/Music/"
运行ncmpcpp:
$ ncmpcpp
其它客户端:https://www.musicpd.org/clients/