MPD shuffle-rest

When I listen to music, I generally like to shuffle my playlist. Sometimes I’ll add new music to my playlist, and I want to shuffle that music into my playlist as well.

The problem is that I don’t want to listen to music that I’ve already listened to recently, but if I shuffle the playlist again, that will probably happen. I use MPD as my music player, and the client I’m using doesn’t have the functionality I want (shuffling just the songs I haven’t listened to yet).

Today I hacked together a quick solution to the issue using Python and python-mpd. You can check it out here: shuffle_range.py

Usage is pretty simple:

    shuffle_range.py rest

This will shuffle all songs after the current one. You can also shuffle a specific range if you’d like:

    shuffle_range.py 42 1024

This will shuffle songs numbered from 42 to 1024.

Like I said, this was a pretty quick hack, so there isn’t much error-checking going one. There’s nothing to stop you from getting an exception if you pass in numbers that aren’t in range, and I honestly don’t know what will happen with an empty playlist or whatnot. It works for what I wanted, though, so that’s good enough for me.

blog comments powered by Disqus