Serving in-file covers to MPD

It’s been quite a while that I’m using a MPD server on my raspberry + hifiberry [1] to play my digital music on my amps. It works very well, the sound is very good and I can control it with my phone, laptop, tablet etc…  That is great.

What is less great is that MPD does not transmit covers to its clients (there is already an issue on MPD’s github [2] to let MPD natively find them).

What most clients do is asking you to setup a HTTP server above your music folder so that they can request the cover file with a query like:

GET /music/path/The%20Black%20Keys/Turn%20Blue/cover.jpg HTTP/1.1

This has 2 drawbacks:

  1. You need to leave an access to your music folder to the HTTP server. I’m not found of this. Some people worked around this [3] but meh…
  2. I don’t use cover files next to the songs. Whenever I rip a CD, I like to add the cover within the song files, so that it is nicely shown on my smartphone.

So I made a very simple python app to deal with this : mpdcoverserver. It has two options: a port and a music folder.

When the HTTP server receives :

GET /The%20Black%20Keys/Turn%20Blue/cover.jpg HTTP/1.1

it goes to <music folder>/The Black Keys/Turn Blue/, takes the first song, extracts the cover from it and serves it.

…Very simple…

You an find it there 🙂 : https://github.com/ochurlaud/mpdcoverserver

References

[1] https://www.hifiberry.com/
[2] https://github.com/MusicPlayerDaemon/MPD/issues/42
[3] https://github.com/uriel1998/yolo-mpd/blob/master/webserver_covers.sh

1 comment

  • Rasi

    MPD will have the ability to serve covers stored inside of audio files in next major release. Also cover.{png,jpg} files inside of the album folder will be supported.

Leave a Reply to Rasi Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.