Yet Another Jukebox

28 Feb 2016

LShift  Python  Tools 

Originally posted at

LShift has for a significant part of it’s history (at least 9 years, according to the blog post in 2006 about an earlier version) had an in-office jukebox. When I arrived here to begin with in 2010, there was the aforementioned earlier version, written in Erlang, and I have anecdotal reports of predecessors to that. I started making patches to the Erlang one, including support, but eventually got annoyed with it enough that one Xmas I started a rewrite. This created Not Invented Here (named because of a joking conversation about how many new technologies a replacement LShift jukebox should contain) which is a Django app, primarily with the goal of getting other people to contribute to the overhead of adding things (by using something friendlier than Erlang), which worked a little bit. It still has a number of both bugs (spidering of new music doesn’t work reliably) and missing much wanted features (Youtube playback for one) that I wasn’t finding any fun in thinking about fixing, and I eventually came to the conclusion I hadn’t gone far enough with the use of off-the-shelf technology.

I’ve therefore created mopidy-jukebox. As the name suggests, it’s based off of Mopidy “an extensible music server written in Python”. I went through the many and varied frontends for Mopidy, and found the Mopidy-MusicBox-Webclient, which got pretty close to what we needed for a frontend – it looks nice, the search is decent – but it is still designed towards the single-person use case. I’ve forked it and started ripping parts out so it better fits our use (many people picking tracks, but they should all be by default just added to the end of the queue, not override the queue). The other item we needed was playback over HTTP from everyone’s machines, for compatibility with the existing music libraries. Mopidy doesn’t have this out of the box, and I couldn’t find a plugin to do this, so I ended up doing this in a way we’ve talked about for a while for the existing jukebox, namely by writing an extension to cache files from the music libraries on people’s machines and then just handing it over to the Mopidy local file scanning. I then extended out further the Musicbox frontend to allow new sources to be added and status of them to be determined. I even added in Chef cookbooks, so that I could install it all on a Raspberry Pi and use my Raspberry Chef work with it (which has now been extended to support Berkshelf).

So, we now have Youtube support, and the caching library does the incredibly lazy (and immensely reliable!) option of shelling out to wget’s mirroring capability, so that hopefully won’t require much additional maintenance in the future. Of course, now we’ll find more things we don’t do yet and will have to decide how to do things like integrate in Slack support

Previously: Raspberry Chef Next: Talky Jukebox bot