-
Notifications
You must be signed in to change notification settings - Fork 200
Album Art on your LAN
MPDroid supports loading album cover artwork from your music directory across your local network. In order to do this, you need to install a webserver on the box running MPD, and configure it to serve files from your music directory.
For nginx, we also add a rule to only serve to IP addresses on your local network to keep this secure.
The following web server configs are written with an example MPD music_directory setting of "/home/mafrosis/MP3/", and a rewrite with the MPD server running at 192.168.1.102 on your LAN.
You don't need to specify IP addresses or domain names here - this is worked out from the MPD config.
Path to music is the part of the URL after the domain, where you're serving images from your music collection. It's there so you don't have to serve your cover images at root on your webserver.
The nginx config below demonstrates rewriting the path to /cover-art. In this case, the 'path to music' setting would be "cover-art".
Cover filename is the standardised name for album art throughout your collection. Using local artwork will happen if you have a convention for naming in your MP3 collection!
$ sudo aptitude install nginx
If you already have nginx configured on your server, you should only merge the location
block from below into your existing server
config and restart nginx.
For a new nginx install, copy the below into a new file at /etc/nginx/sites-available/mpd-cover-art.conf
:
server {
listen 80;
server_name 192.168.1.102;
location /cover-art/ {
root /home/mafrosis/MP3/;
rewrite /cover-art/(.*) /$1 break;
try_files $uri $uri;
allow 192.168.1.0/24;
deny all;
}
}
Now run the following commands to get nginx to pick up the new config:
$ sudo rm /etc/nginx/sites-enabled/mpd-cover-art.conf
$ sudo ln -s /etc/nginx/sites-available/mpd-cover-art.conf /etc/nginx/sites-enabled/
$ sudo /etc/init.d/nginx restart
$ sudo aptitude install lighttpd
For a new lighttpd install, copy the below into a new file at /etc/lighttpd/lighttpd.conf
:
server.port = 80
server.username = "http"
server.groupname = "http"
server.document-root = "/home/mafrosis/MP3/"
server.errorlog = "/var/log/lighttpd/error.log"
mimetype.assign = ( ".jpg" => "image/jpeg" )