2016-08-17 05:09:57 +02:00
|
|
|
Music Player Daemon
|
|
|
|
===================
|
|
|
|
|
|
|
|
[Music Player Daemon][1] (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.
|
|
|
|
|
2016-08-19 05:34:51 +02:00
|
|
|
:+1: [easypi/mpd-arm][2] works on Raspberry Pi very well.
|
2016-08-17 05:09:57 +02:00
|
|
|
|
|
|
|
## docker-compose.yml
|
|
|
|
|
|
|
|
```yaml
|
2021-02-09 10:58:42 +02:00
|
|
|
version: "3.8"
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
|
|
|
mpd:
|
|
|
|
image: vimagick/mpd
|
|
|
|
ports:
|
|
|
|
- "6600:6600"
|
|
|
|
- "8800:8800"
|
|
|
|
volumes:
|
|
|
|
- ./data/config:/root/.config
|
|
|
|
- ./data/music:/var/lib/mpd/music
|
|
|
|
- ./data/playlists:/var/lib/mpd/playlists
|
|
|
|
devices:
|
|
|
|
- /dev/snd
|
|
|
|
restart: unless-stopped
|
2016-08-17 05:09:57 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Server Setup
|
|
|
|
|
|
|
|
```bash
|
2021-02-09 10:58:42 +02:00
|
|
|
$ mkdir -p ~/fig/mpd/{config,music,playlists}
|
2016-08-18 07:00:40 +02:00
|
|
|
$ cd ~/fig/mpd/
|
2016-08-19 05:34:51 +02:00
|
|
|
|
2021-02-09 10:58:42 +02:00
|
|
|
$ wget https://upload.wikimedia.org/wikipedia/commons/d/d5/Pop_Goes_the_Weasel.ogg -O data/music/test.ogg
|
2016-08-19 05:34:51 +02:00
|
|
|
|
2021-02-09 10:58:42 +02:00
|
|
|
# FIXME: OUTDATED
|
2016-08-18 07:00:40 +02:00
|
|
|
$ curl -s -X POST -H 'Content-Length: 0' http://www.shoutcast.com/Home/Top |
|
|
|
|
jq '.[].ID' |
|
|
|
|
parallel --eta -k curl -s 'http://yp.shoutcast.com/sbin/tunein-station.m3u?id={}' |
|
|
|
|
sed '1!s@#EXTM3U@@' |
|
2021-02-09 10:58:42 +02:00
|
|
|
cat -s > data/playlists/shoutcast.m3u
|
2016-08-19 05:34:51 +02:00
|
|
|
|
2021-02-09 10:58:42 +02:00
|
|
|
$ cat > data/playlists/microphone.m3u << _EOF_
|
2016-08-19 05:34:51 +02:00
|
|
|
#EXTM3U
|
|
|
|
#EXTINF:-1,microphone
|
|
|
|
alsa://plughw:1,0
|
|
|
|
_EOF_
|
|
|
|
|
2016-08-17 05:09:57 +02:00
|
|
|
$ docker-compose up -d
|
2016-08-19 05:34:51 +02:00
|
|
|
$ docker-compose exec mpd sh
|
|
|
|
>>> mpc help
|
|
|
|
>>> mpc update
|
|
|
|
>>> mpc ls | mpc add
|
|
|
|
>>> mpc repeat on
|
|
|
|
>>> mpc random on
|
|
|
|
>>> mpc
|
2016-08-20 10:00:05 +02:00
|
|
|
>>> mpc clear
|
|
|
|
>>> mpc lsplaylists
|
|
|
|
>>> mpc load shoutcast
|
|
|
|
>>> mpc play
|
2016-08-19 05:34:51 +02:00
|
|
|
>>> exit
|
2016-08-17 05:09:57 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
## Client Setup
|
|
|
|
|
|
|
|
- Android: https://play.google.com/store/apps/details?id=com.namelessdev.mpdroid
|
|
|
|
- Desktop: http://rybczak.net/ncmpcpp/
|
|
|
|
|
2016-08-17 18:54:11 +02:00
|
|
|
```yaml
|
|
|
|
Host: x.x.x.x
|
|
|
|
Port: 6600
|
|
|
|
Streaming host: x.x.x.x
|
|
|
|
Streaming port: 8800
|
|
|
|
```
|
|
|
|
|
2016-08-17 05:09:57 +02:00
|
|
|
## Read More
|
|
|
|
|
|
|
|
- <https://wiki.archlinux.org/index.php/Music_Player_Daemon>
|
2016-08-17 18:54:11 +02:00
|
|
|
- <https://wiki.archlinux.org/index.php/Music_Player_Daemon/Tips_and_tricks>
|
2016-08-17 05:09:57 +02:00
|
|
|
- <https://wiki.archlinux.org/index.php/Streaming_With_Icecast>
|
|
|
|
- <https://stmllr.net/blog/streaming-audio-with-mpd-and-icecast2-on-raspberry-pi/>
|
2016-08-18 20:31:46 +02:00
|
|
|
- <https://www.musicpd.org/doc/user/input_plugins.html>
|
2016-08-17 05:09:57 +02:00
|
|
|
|
|
|
|
[1]: https://www.musicpd.org/
|
2016-08-19 05:34:51 +02:00
|
|
|
[2]: https://hub.docker.com/r/easypi/mpd-arm/
|