Parochial: working around limits on DLNA players

30 Sep 2019

Python  Tools 

Originally posted at

A little while ago we acquired a internet-connected radio for our kitchen. We intended on using it for a variety of it’s capabilities, and my particular interest was it’s DLNA support. I figured I’d just be able to point it at my music collection and it would all be fine right? laughs  As I’m writing a blog post about this, you can guess it didn’t go quite as hoped. My primary use case is “play me something random while I deal with something domestic”, and I just want a random shuffle through my entire collection. However, if you throw some 10,000 tracks at the Revo, it gets unhappy and complains about exceeding it’s limits (which are not documented). Experiments with the track collections from artists I own a lot of tracks of also indicate that somewhere in the region of 200 tracks it becomes slow as well, so I decided to find a way to give myself shorter, but still randomly chosen playlists to work around all this.

So, DLNA, or to give it its full title, the ‘Digital Living Network Alliance‘, consists of a group of companies coming together to determine how their equipment might interoperate (notably not including Apple, who produced the Digital Audio Access Protocol instead). Primarily this uses the UPnP standards, particularly the UPnP AV sections to make disparate media devices share content over a local network. The main open source implementation of such matters was Coherence (although other things like VLC can do playback), but unfortunately this appears to have been largely abandoned. Luckily someone picked it up and, barring a couple of minor issues, it was in good shape, and usable for my purposes.

I put together a new item of what Coherence calls a backend, named Parochial which takes the existing MediaStore backend (to perform song cataloguing and metadata organisation), and then generates a playlist of a fixed maximum size (50 songs by default), thus providing a feed that the Revo won’t protest too much at. It also every so often (five minutes by default) removes one of the songs from the playlist and adds in a new one, thus providing continual rotation through my collection at a fast enough speed for my uses.

There’s still some issues—I can’t release to pypi because of some upstream issues, can’t upgrade to Python 3 because of some dependencies that need repairing, and the MediaStore doesn’t detect newly added tracks—but I’ve been running this now for about a week, and it seems to do what I need.

Previously: Strife: Using OAuth to make a Discord profile page Next: Wasted potential of The Turing Test