media/mpd/ HomePage


MpcHelperScript SimplePythonWebApi

Multiple instances

mpd can be run as an unprivileged user process. Additionally, multiple instances can be run simultaneously. The main use here is that each one maintains separate state. I use the following script to create the mpd.conf and run that mpd, with ports in the range 6601..6999 (400 instances should be enough for anybody). Obviously you most likely don't want both playing at once.

#!/bin/bash
p="${1-1}"
# restrict port range to 6601..6999 -- 6600 is reservd for the default mpd
if (( p < 1 )) || (( p > 399 )); then echo "port $p must in the range 1..399"; exit 1; fi
(( p += 6600))
echo "Using port $p"
mpd_dir="$HOME/.mpd/mpd-$p"
mpd_conf="$mpd_dir/mpd-$p.conf"
mkdir -p "$mpd_dir"
sed -e "/^port/s/6600/$p/" -e "/^[a-z]*_file/s@~/.mpd@~/.mpd/mpd-$p@" ~/.mpd/mpd.conf >| "$mpd_conf"
mpd "$mpd_conf"

Ignoring Files and Directories

You can create .mpdignore files. For example

__pycache__

to ignore the __pycache__ folder python creates.