Simple Smart Playlists for MPD (that work!)

Update 2 Feb 2024: Check out version 2.

Let’s start with High Fidelity. Or Letterkenny. Or October Faction. Or Doom Patrol.

One thing all of these series have in common are wonderful and eclectic soundtracks. They don’t limit themselves to a single “sound” or “genre”. They might lean towards one genre, but you’ll suddenly get a song or two that is completely different in the mix.

I love this.

I first tried to recreate this feeling by making huge playlists, but it just never felt quite “right”. Then I remembered a program I wrote a while back – mpdq. It solved a lot of the problems I was having with “autoqueue” or “smart playlist creators” that I’d been having. No more relying on external services. less manual configuration needed, and no more opaque code.

But it still had problems. To function, it required scanning (and re-scanning) your whole music library. If you changed anything about your music library, you had to scan it all again. I realized there were entire sections of my music library that were being ignored. And there was still a significant amount of user input needed in “matching” genres together.

So I re-wrote it [1] with a few goals. First, to be specific to MPD (the music player daemon) [2]. Second, to be much more light-weight and have even fewer dependencies. Third, to be even easier to configure. Finally, I wanted it to be able to recreate the “feel” of those soundtracks I mentioned. I’ve had it running this last weekend, and I’m quite happy with what it’s been producing for me.

Instead of “matching” genres by hand, the only setup is a basic ini file and the creation of simple “instruction” files that can be as wide-ranging or as narrowly focused as you like. And you can have as many (or few) of those as you’d like. Here’s two examples to show what I mean:


This one will tell mpdq to select songs randomly from all genres – except it will never pick a song from “Classical” and will more frequently (roughly three times as often) pick a song from “Rock”.


This one tells mpdq to select songs only from “Industrial” and “Gothic” and not pick anything from all other genres.

To help with this, you can also have mpdq output an “example” instruction file that lists all the genres that are in your mpd music database. And since mpdq now just uses MPD’s database, any changes that MPD knows about, mpdq knows as well.

Also, because mpdq is now just straight up bash (and hopefully pretty well commented) it should be relatively easy to hack to work with other music players if you’d like.

You can find mpdq at GitHub, GitLab, or my own personal git repository! Enjoy!

Featured Photo by Spencer Imbrock on Unsplash

[1] If you used (or are interested) in the older version of mpdq, it’s still available in a subdirectory in the repositories.

[2] If you use Mopidy, the mopidy-mpd module might let this work with it. mpdq uses mpc to control MPD, so if you can get that to control Mopidy, you’re in luck.