The Ultimate Server Part 9 - Headphones

This post was last updated on 12/30/2014

Believe it or not, we are nearing completion on our server. Now that TV and movies are all taken care of, we move on to the last bit: music. Just like we have Sonarr for TV and CouchPotato for movies, we have a program called Headphones to handle our music collection.

Installing Python

Headphones requires Python 2.7 to run, so we will need to install that first. We will be downloading it from python.org, specifically the 64-bit 2.7.8 version. While installing, use all of the default settings.

Installing Headphones

To be perfectly frank, Headphones is a lot less polished than the other two applications. We don't get the benefit of an installer, so we have to do a little more heavy lifting to get it in place. No worries though, just stick with the guide and we'll have you done in no time.

The first thing we are going to do is grab the latest build off of the Github repository. On the right sidebar, you'll see a button that says Download ZIP. Click that open the file after downloading. In the zip, you will see a single folder titled headphones-master. Extract that folder to your user folder. In my case, that would be C:\Users\foxingworth. Once you have that folder extracted, you can rename it to simply headphones.

Now go into that folder and you will see a file called Headphones.py. As long as you kept all the default settings while installing Python, you should be able to double-click that file. After a second, Headphones will open in your browser. Windows Firewall will again pop its nose into our business, click Allow access.

Since we manually downloaded the build from the repo, it does not know what version it is. In the lower right corner, click the Update link and wait a few seconds for that to finish. If nothing happens within 20 seconds or so, click the headphone icon in the upper left and it should take you back to the interface.

Before we start adding music, we have to go through our usual step of configuring a bunch of stuff (yay!).

Click the cog in the upper right to enter the configuration page.

Web Interface tab

  • Change HTTP Port to 38084
  • Set a username and password to protect our interface
  • Uncheck Launch Browser on Startup

Download settings tab

  • Usenet
    • SABnzbd Host: http://localhost:38080
    • SABnzbd Username and Password: whatever you set them to
    • SABnzbd API key: API key found in SABnzbd > Config > General
    • SABnzbd Category: headphones
    • Music Download Directory: C:\Users\yourusername\Downloads\Incomplete\headphones
    • Usenet Retention: whatever your provider says, usually around 2200-2500
  • Torrents
    • Leave Black Hole checked (headphones doesn't have native Deluge support)
    • Black Hole Directory: C:\Users\yourusername\Downloads\Torrents
    • Open Magnet Links: checked
    • Minimum seeders: 2
    • Music Download Directory: C:\Users\yourusername\Downloads\Torrents
    • Keep Files for Seeding: checked
    • Prefer: NZBs

Search providers tab

  • Check Use Newznab
    • Enter http://nzbzombie.com as Newznab Host. Enter the appropriate API key. Click Add Newznab.
    • Enter http://www.usenet-crawler.com as Newznab Host. Enter the API key. Click Add Newznab.
    • Enter https://www.oznzb.com as Newznab Host. Enter the API key.
  • Check Use The Pirate Bay. Set the Seed Ratio to 1.
  • Check Use Kick Ass Torrents. Set the Seed Ratio to 1.

Quality & Post Processing tab

  • Set the Quality to your preferred setting. Lossless refers to FLAC files. If you don't know what those are, then just leave it set to Highest Quality excluding Lossless.
  • For Ignored Words, add sponsored (these releases are titled in a way that will freeze up SABnzbd)
  • Check Move downloads to Destination Folder
  • Check Rename files
  • Check Correct metadata
  • Check Delete leftover files
  • Check Embed album art in each file
  • Check Embed lyrics
  • Set Path to Destination Folder to whatever your Music folder is. For example, mine is S:\Music

Advanced Settings tab

  • Change Folder Format to $Artist/$Year - $Album
  • Change File Format to $Disc$Track - $Title
  • Check Automatically include extras when adding an artist. On the pop up, check Ep (and any other extras intrigue you)
  • Check Automatically mark all albums as wanted
  • Change the Musicbrainz Mirror dropdown to custom. Change the Host field that shows up to musicbrainz.tranquilbase.org (the official Musicbrainz site is very unreliable and slow)

All of our settings are now set. If you haven't been doing so already, click the Save Changes button. There's one last thing we need to do to Headphones, and we don't want it running for this, so click the Shut Down button at the top or bottom of the page.

Making Headphones start with Windows

Headphones doesn't automatically start with Windows, and it unfortunately doesn't give us an easy button to press to make it do so. The other thing you may have noticed is that while Headphones is running, it has that annoying Python debug window running. We are going to tackle both of those problems in this next part.

Press your Start button in Windows and type schedule tasks. This will open the Task Scheduler application that you may or may not have seen in the past. On the right side, click the Create Task option.

Set the Name to Headphones. Under Security options, change to Run whether user is logged on or not. Now check Hidden which is in the lower left corner.

Switch to the Triggers tab and click the New... button. When the New Trigger window pops up, change the Begin the task drop down to At startup and press OK. This is enough to make sure it is always running, but I've run into a bug where headphones just totally stops responding after a few days and needs to be rebooted. A little web searching has shown that I'm not the only one with the problem. If you encounter this, click New... to add another trigger and set the Being the task drop down to On a schedule. Set the schedule to be Daily. Set the Start time to tomorrow morning at 4:00:00 AM or anytime you're certain you won't be using the application. Check the Stop task if runs longer than option and change it to 1 day. This will force headphones to be restarted daily, and theoretically always be accessible.

Switch to the Actions tab and click the New... button. For Program/script, type in C:\Python27\python.exe (assuming you let Python install to that location).  For Add arguments (optional), type in C:\Users\yourusername\headphones\Headphones.py. For Start in (optional), type in C:\Users\yourusername\headphones. When you press OK, your window should look similar to this:

Finally, switch to the Settings tab and uncheck the Stop the task if it runs longer than option. Also make sure that If the task is already running, then following rule applies is set to Stop the existing instance. Click OK. In order to create the task, it will ask you for your Windows password.

Now in the left panel, click Task Scheduler Library. You should see your Headphones task in the list in the center, and it should say Ready. Right-click on it and select Run. If all goes according to plan, you'll see it switch to Running and you should see nothing happen. That's good, we wanted nothing to happen. Headphones is actually running in the background now, and that annoying Python window is just hidden from our view. You can close out of the Task Scheduler now.

Using Headphones

Open up a browser and navigate to http://localhost:38084. After authenticating, you should now be at the main interface. The first thing to do is reopen the config and go back over all the settings. I guarantee a few weren't saved. Remember when I said this program wasn't as polished as the other two, here is an example. Luckily, after saving a second time, I haven't had a problem of them reverting again.

With that out of the way, click the headphones icon button to get back to home. After playing around with Sonarr and CouchPotato, you are probably well qualified to navigate this one already. Just to be thorough, I'll give some quick pointers.

This is your search bar. It doesn't have any fancy AJAX loading like our other programs, so you'll have to enter the full artist name and then click Search. Headphones has a nasty habit of not looking like it's loading when it really is, so give it a second even if it looks stuck. On the results page, you'll see all possible matches. Click the one that you were looking for.

This will automatically add this band to your collection and show you their band page. If you watch the bottom of the page, you'll notice that it's automatically adding all of the albums as wanted. The interface doesn't update in real-time, so refresh the page after a minute and you should see most, if not all, switch over to snatched.

If you click one of the album names, you will get a bunch of buttons at the top of the page which are helpful in finding different releases should one not be right or fail to download.

After some music downloads, check your Music folder and make sure things are being renamed and moved into their place properly.

Great! Now go back through and all of your favorite bands.

In our next (and final part), we will learn how to stream all of this media, and we will tie together a few loose ends.