Mpd: Difference between revisions

From wikinotes
No edit summary
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 6: Line 6:
{| class="wikitable"
{| class="wikitable"
|-
|-
| commands || http://www.musicpd.org/doc/protocol/command_reference.html#status_commands
| official docs || https://mpd.readthedocs.io/en/latest/index.html
|-
| commands docs || http://www.musicpd.org/doc/protocol/command_reference.html#status_commands
|-
| output plugins || https://mpd.readthedocs.io/en/latest/plugins.html#output-plugins
|-
|-
|}
|}
Line 15: Line 19:
{| class="wikitable"
{| class="wikitable"
|-
|-
| <code>~/.mpd/mpd.conf</code> || config
| <code>~/.mpd/mpd.conf</code> || user config
|-
| <code>/usr/local/etc/musicpd.conf</code> || global config
|-
|-
|}
|}
</blockquote><!-- Locations -->
</blockquote><!-- Locations -->
= Ports =
<blockquote>
{| class="wikitable"
|-
| <code>6600</code> || default mpd control port
|-
|}
</blockquote><!-- Ports -->


= Notes =
= Notes =
Line 27: Line 42:
|-
|-
| [[mpd configuration]]
| [[mpd configuration]]
|-
| [[mpd extensions]]
|-
|-
| [[mpd troubleshooting]]
| [[mpd troubleshooting]]
Line 37: Line 54:
{| class="wikitable"
{| class="wikitable"
|-
|-
| [[ncmpcpp]] || cli (favourite)
| [[ncmpcpp]] || cli
|-
|-
| [[vimpc]] || cli (runner up)
| [[vimpc]] || cli
|-
|-
| [[cantata]] || gui
| [[cantata]] || gui
Line 46: Line 63:
|}
|}
</blockquote>
</blockquote>
= Install =
<blockquote>
{{ expand
| Linux
|
<source lang="bash">
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)
</source>
}}
{{ expand
| FreeBSD
|
<source lang="bash">
sudo pkg install musicpd musicpc ncmpcpp
</source>
}}
</blockquote><!-- Install -->
= Config =
<blockquote>
== Core ==
<blockquote>
<source lang="bash">
# ~/.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"
</source>
</blockquote><!-- core -->
== Audio Output ==
<blockquote>
=== HTTPD Streaming ===
<source lang="bash">
# 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
}
</source>
Listen to Stream
<source lang="bash">
# adds 'track' representing stream
mpc add http://foo.com:8000
# alternatively, use vlc
http://foo.com/mpd.ogg
</source>
</blockquote><!-- audio output -->
</blockquote><!-- Config -->
= Extending =
<blockquote>
== python ==
<blockquote>
<source lang="bash">
sudo pip install python-musicpd
</source>
<source lang="python">
import musicpd
c = musicpd.MPDClient()
c.connect('localhost', 6600)
c.find('genre', 'Jazz')
c.close()
</source>
</blockquote><!-- python -->
== netcat ==
<blockquote>
<source lang="bash">
echo "currentsong" | nc 127.0.0.1 6600
echo "find genre Indie" | nc 127.0.0.1 6600 | grep -i "^Artist" | uniq -i
</source>
</blockquote><!-- netcat -->
</blockquote><!-- extending -->
= Troubleshooting =
<blockquote>
== database error ==
You might be running two separate mpds, try <code>systemctl stop mpd</code> .
== pauses after every song ==
<blockquote>
you probably activated single mode by mistake.
<syntaxhighlight lang="bash">
mpc single off
</syntaxhighlight>
</blockquote><!-- pauses after every song -->
</blockquote><!-- troubleshooting -->

Latest revision as of 19:11, 6 February 2022

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

official docs https://mpd.readthedocs.io/en/latest/index.html
commands docs http://www.musicpd.org/doc/protocol/command_reference.html#status_commands
output plugins https://mpd.readthedocs.io/en/latest/plugins.html#output-plugins

Locations

~/.mpd/mpd.conf user config
/usr/local/etc/musicpd.conf global config

Ports

6600 default mpd control port

Notes

mpd install
mpd configuration
mpd extensions
mpd troubleshooting

Mpd Clients

ncmpcpp cli
vimpc cli
cantata gui
mpc cli