Mpd: Difference between revisions
From wikinotes
Line 28: | Line 28: | ||
sudo pacman -S mpd mpc ncmpcpp | sudo pacman -S mpd mpc ncmpcpp | ||
systemctl enable mpd --user | systemctl enable mpd --user | ||
mpc update | mpc update # update library | ||
usermod -a -G mpd ${USER} # add yourself to mpd user (for extra features) | |||
</source> | </source> | ||
}} | }} |
Revision as of 04:14, 19 July 2021
MPD (music player daemon) is a generic music-library backend that
can be controlled by various programs, and/or can stream to itself on other machines.
Documentation
commands http://www.musicpd.org/doc/protocol/command_reference.html#status_commands
Locations
~/.mpd/mpd.conf
config
Install
Linux
sudo pacman -S mpd mpc ncmpcpp systemctl enable mpd --user mpc update # update library usermod -a -G mpd ${USER} # add yourself to mpd user (for extra features)FreeBSD
sudo pkg install musicpd musicpc ncmpcpp
Config
Core
# ~/.mpdconf music_directory "/home/media/music" db_file "/home/media/.mpd/db" log_file "/home/media/.mpd/log" pid_file "/home/media/.mpd/pid" state_file "/home/media/.mpd/state" user "mpd"Audio Output
HTTPD Streaming
# Streaming Output # # this is copied verbatim from /usr/share/doc/mpd/mpdconf.example audio_output { type "httpd" name "My HTTP Stream" encoder "vorbis" # optional, vorbis or lame port "8000" bind_to_address "0.0.0.0" # optional, IPv4 or IPv6 # quality "5.0" # do not define if bitrate is defined bitrate "128" # do not define if quality is defined format "44100:16:1" max_clients "0" # optional 0=no limit }Listen to Stream
# adds 'track' representing stream mpc add http://foo.com:8000 # alternatively, use vlc http://foo.com/mpd.ogg
Clients
ncmpcpp cli (favourite) vimpc cli (runner up) cantata gui mpc cli
Extending
python
sudo pip install python-musicpdimport musicpd c = musicpd.MPDClient() c.connect('localhost', 6600) c.find('genre', 'Jazz') c.close()netcat
echo "currentsong" | nc 127.0.0.1 6600 echo "find genre Indie" | nc 127.0.0.1 6600 | grep -i "^Artist" | uniq -i
Troubleshooting
database error
You might be running two separate mpds, try
systemctl stop mpd
.