Install Headphones Raspberry Pi for Usenet Torrent Music

Headphones is the automated audio downloader helper. Headphones can grab audio index files and send them to your usenet or torrent downloader.  If you prefer Usenet, then I recommend NZBGet since it works well on low powered devices like the Raspberry Pi though you can use it with Sabnzbd as well. If you are torrenting you can have Headphones work with transmission or uTorrent. A guide for transmission will be created in the near future.

If you are trying to figure out which hardware would work best for you, consider reading the Pi benchmarks.

Usenet Provider
Backbone
Retention
Speed
Connections
VPN
Monthly
Annual
UsenetServer
UsenetServer
2265
Unlimited
20
Yes
$10
$95.40
Usenetlink
Cloudgate
2000
100 Mbit
30
No
$15
$140
Astraweb
Astraweb
2264
Unlimited
20
No
$7.50
$96.00
UsenetBucket
XS News
1100
40 Mbit
25
No
€4.95
€60.00
Frugal
Blocknews
600
Unlimited
60
No
$4.99
$50.00

Install Headphones Raspberry Pi

Update Raspbian on the Pi

sudo apt-get update

Upgrade any software packages

sudo apt-get upgrade -y

Install dependencies

sudo apt-get install git-core -y

Git clone the Headphones installation into Raspbian

sudo git clone https://github.com/rembo10/headphones.git /opt/headphones

Make pi the owner

sudo chown -R pi:pi /opt/headphones

Test to see if it works

python /opt/headphones/Headphones.py

You should be able to access Headphones at http://ip.address:8181

You may get the error

No handlers could be found for logger "headphones"

You may also see this error if the owner of the directory isn’t pi

Datadir must be writeable '/opt/headphones'

You can press Ctrl+C to kill the process if the Headphones did run

Headphones also sometimes listens on the loopback adapter only (127.0.0.1) which means you won’t be able to access it remotely from other machines on your network. You can update it with this command:

sed -i "/http_host = /c\http_host = 0.0.0.0" /opt/headphones/config.ini

Autostart Headphones on Raspberry Pi

Headphones init.d Script

The init.d method is what we will use for Wheezy

First create the default configuration file which the init.d script will use for its various parameters

sudo nano /etc/default/headphones

Add these values, pi is your user to run Headpones as and 8181 is the port it will listen on

HP_USER=pi
HP_HOME=/opt/headphones
HP_PORT=8181

Ctrl+X, Y and Enter to save

Copy the default Headphones init.d script

sudo cp /opt/headphones/init-scripts/init.ubuntu /etc/init.d/headphones

Make the Headphones init.d script executable

sudo chmod +x /etc/init.d/headphones

Update init to use the headphones script

sudo update-rc.d headphones defaults

You can now start headphones like this

sudo service headphones start

Headphones Upstart Script

Upstart can complicate things on your system so it is not recommended unless you have problems with the init.d script

Install Upstart if you understand the risks

sudo apt-get install upstart

Enter Yes, do as I say! to confirm the upstart installation

Create the Headphones upstart script file

sudo nano /etc/init/headphones.conf

Paste this Headphones upstart script

Raspbmc Note: if you are running Raspbmc remove the setuid and setgid lines

#author "HTPCGuides.com"
#description "Upstart Script to run Headphones as a service on Ubuntu/Debian based systems"

#Set username for the process. Should probably be what you use for logging in
setuid pi
setgid pi

start on runlevel [2345]
stop on runlevel [016]

respawn

exec /opt/headphones/Headphones.py

Hit Ctrl+x, press Y and then Enter

Run the service to see if it works

sudo service headphones start

You should see a message like this
headphones start/running, process 14827

You may get this error

initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
headphones: unrecognized service

You may still not be able to access it unless you reboot

sudo reboot

It can take a minute or two before the web interface is ready after booting, just be patient :).

It will be available at http://ip.address:8181 on the Raspberry Pi.

Troubleshoot Headphones Web Interface Access

If you find that the Headphones web interface is not showing up it may be listening on the localhost address rather than any network address available (0.0.0.0)

Stop the Headphone service

sudo service headphones stop

Open the Headphones configuration file

nano /opt/headphones/config.ini

Find the http_host line and change localhost to 0.0.0.0 and save the new configuration

http_host = 0.0.0.0

Then restart Headphones

sudo service headphones restart