CherryMusic for music streaming

Category: Linux

A lightweight Python alternative to Subsonic with an HTML5 user interface

I have been a happy user of Subsonic for several years now, which allowed me to stream my music collection while I'm working away from home. One of the great things about it is that it doesn't force you to insert your collection into a library of any kind, it just uses folder navigation, which in an insane world is the sanest choice!

Java requirement

Subsonic requires Java which means it's not the lightest of applications, and on a low end linux box it tends to hog quite a lot of processing power while streaming or scanning music files. The linux machine I am running it on doubles as an XBMC media centre for playing videos and music in the home, which also has quite a large footprint. This has lead me to poke my head out to see what else there is that would fit the bill. 

Enter CherryMusic

Python seems to be a good fit for lightweight server software, I'm already using a variety of others that work very well and don't tend to dominate the system, which is why I started looking for a Python solution. CherryMusic stands out as one of the more mature and respected of the crowd, and because the installation looked straightforward I went ahead and gave it a try.

Playing nicely with Nginx

With most server software that provides a service on a port, I use Nginx to proxy a subdomain to the relevant port. This prevents the need to open up a ton of ports on my home router, as all traffic goes through port 80 as normal websites do. Here's the nginx configuration which goes in /etc/nginx/sites-enabled/cherrymusic:

server {
    listen   80;

    server_name cherrymusic.turnedonbydefault.com;

    location ~ {
        proxy_pass http://127.0.0.1:4041;
    }
}

This did cause a small problem though, when I was going through the CherryMusic setup, the form field to enter a port was disabled, presumably because it detected I was connected without specifying a port. When I clicked the "Next" button to continue the setup, it would not continue, and scrolled the page up to the port field, which was disabled and empty. As I was using chrome I went into the DOM inspector and removed the disabled attribute, then entered 4041 in the field, which allowed it to continue.

First impressions

It scanned my music folders in a few minutes, which was pretty decent considering it totals over a terabyte of data. The Bootstrap UI is a little different to Subsonic, but quite usable, I didn't find any problems finding my way around. One of the first options I enabled was the transcoding to 128Kbps as my upload bandwidth is sadly lacking. Straight away it started failing and the javascript console was littered with errors.

Enabling transcoding on Ubuntu 14.04

Some extra packages were needed to make all this happen, after a bit of a hunt I grabbed a PPA for FFMPEG and then installed the following packages to enable full functionality:

apt-get install vorbis-tools lame flac imagemagick faad mpg123 ffmpeg

Mobile

Another thing I like to do is listen to music on my Android phone. The interesting thing about CherryMusic is that it has an HTML5 player interface, which means it should work on most modern browsers, meaning it isn't dependant on an Android / iPhone app. I initially tried with the Javelin browser which I have taken a like to recently for it's simplicity, the application worked but the music wouldn't play. Using the Chrome browser I found no problems though, and I was quite surprised that switching off the screen let the music play on. One thing that is lacking is the means to download music to play offline, but this was always a nice feature of Subsonic that I just never used.

Performance

I'm happy to report that while writing this post and listening to Booka Shade, the load on the server is barely registering - result! Don't forget you can use Nethogs to monitor the bandwidth that is being consumed by CherryMusic if you are curious what it is doing to your connection.

Although this is not running on a Raspberry Pi, I would imagine it's an ideal music streaming solution because of the small footprint, I may even consider offloading this task completely to my Pi at some point.

It's early days, but I'm quite happy with CherryMusic, once I've broken fully I will remove Subsonic and Java from my server completely.

Thursday May 1, 2014

comments powered by Disqus