How to install Couchpotato, Sickbeard and Headphones on the Raspberry Pi

couch-potatoHow to automate downloading files with couchpotato (movies), sickbeard (series) and headphones (music) for the raspberry pi. In this guide i’ll only use torrents.

First we need to install git

sudo -s

apt-get install git python2.7 python-cheetah python-openssl

Couchpotato

Create user and download couchpotato and move the folder to a more logic place

useradd --system --user-group --no-create-home couchpotato && git clone https://github.com/RuudBurger/CouchPotatoServer.git && mv CouchPotatoServer /usr/local/couchpotato && chown -R couchpotato:couchpotato /usr/local/couchpotato && mkdir /var/couchpotato && chown -R couchpotato:couchpotato /var/couchpotato

Let’s start couchpotato

su couchpotato -c "/usr/local/couchpotato/CouchPotato.py --data_dir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini"

After running this, you won’t see anything. That means it’s running from the current terminal. So that’s when you can test it by going to your raspberry pi’s ip and portnumber with your browser. Example: http://192.168.1.1:5050

If it works, you can quit couchpotato in the terminal with CTRL+C in the terminal.

Alright, it’s time to make a start and stop service with (remove the space between < <'endmsg, somehow wordpress puts a space between).

This will create a file to start and stop the service:

cat > etc/init.d/couchpotato < <'endmsg' #!/bin/sh ### BEGIN INIT INFO # Provides: CouchPotato # Required-Start: $network $remote_fs $syslog # Required-Stop: $network $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start CouchPotato at boot time # Description: Start CouchPotato. ### END INIT INFO case "$1" in start) echo "Starting CouchPotato." /usr/bin/sudo -u couchpotato -H /usr/local/couchpotato/CouchPotato.py --daemon --data_dir=/var/couchpotato --config_file=/var/couchpotato/couchpotato.ini ;; stop) echo "Shutting down CouchPotato." p=`ps aux | grep -v grep | grep CouchPotato.py | tr -s \ | cut -d ' ' -f 2` couch_api_key=`grep -m 1 api_key /var/couchpotato/couchpotato.ini | cut -d ' ' -f 3`; couch_port=`grep -m 1 port /var/couchpotato/couchpotato.ini | cut -d ' ' -f 3`; wget -q --delete-after http://localhost:${couch_port}/api/${couch_api_key}/app.shutdown while ps -p $p > /dev/null; do sleep 1; done
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0
endmsg

Set the right permissions on the just created file with:

chmod 755 /etc/init.d/couchpotato

Add to crontab to start at startup with (not necessary) :

crontab -e

Insert at the end of the file:

@reboot /etc/init.d/couchpotato start

Start couchpotato with

/etc/init.d/couchpotato start

Now, type in the ip adress of your pi and chosen port number in your webbrowser. You can configure the rest in the interface.
Example:
http://192.168.1.1:7000

Thanks to http://www.cylindric.net/blog/raspberrypi-adding-sabnzbd-sickbeard-and-couchpotato/

Sickbeard

Here's how to install sickbeard. It's mostly the same as couchpotato.

If you're still sudo skip the following, otherwise:

sudo -s

This is the official one, use it with usenet. Create user, download Sickbeard and set the correct permissions

useradd --system --user-group --no-create-home sickbeard && git clone git://github.com/midgetspy/Sick-Beard.git && mv Sick-Beard /usr/local/sickbeard && chown -R sickbeard:sickbeard /usr/local/sickbeard && chmod ug+rw /usr/local/sickbeard/autoProcessTV/ && mkdir /var/sickbeard && chown sickbeard:sickbeard /var/sickbeard

This one has more support for torrents. Create user, download Sickbeard and set the correct permissions

useradd --system --user-group --no-create-home sickbeard && git clone git://github.com/bricky/Sick-Beard.git && mv Sick-Beard /usr/local/sickbeard && chown -R sickbeard:sickbeard /usr/local/sickbeard && chmod ug+rw /usr/local/sickbeard/autoProcessTV/ && mkdir /var/sickbeard && chown sickbeard:sickbeard /var/sickbeard

Start the service to test

su sickbeard -c "/usr/local/sickbeard/SickBeard.py --datadir=/var/sickbeard --config=/var/sickbeard/sickbeard.ini"

To quit press CTRL+C

Change the port number with:

vi /var/sickbeard/sickbeard.ini

Look for web_port and change the port in something you want. You can also change web_username and web_password to secure your web interface.

Wait a minute and check your raspberry pi ip with the changed port. Example: 192.168.1.1:5000
Default port is 8081.

Alright, when all went well you can create a startup script with(remove the space between < <'endmsg, somehow wordpress puts a space between):

cat > /etc/init.d/sickbeard < <'endmsg' #!/bin/sh ### BEGIN INIT INFO # Provides: SickBeard # Required-Start: $network $remote_fs $syslog # Required-Stop: $network $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start SickBeard at boot time # Description: Start SickBeard. ### END INIT INFO case "$1" in start) echo "Starting SickBeard." /usr/bin/sudo -u sickbeard -H /usr/local/sickbeard/SickBeard.py -d --datadir /var/sickbeard --config /var/sickbeard/sickbeard.ini ;; stop) echo "Shutting down SickBeard." p=`ps aux | grep -v grep | grep SickBeard.py | tr -s \ | cut -d ' ' -f 2` if [ -n "$p" ]; then sb_api_key=`grep -m 1 api_key ${sb_config} | cut -d ' ' -f 3`; sb_port=`grep -m 1 web_port ${sb_config} | cut -d ' ' -f 3`; wget -q --delete-after http://localhost:${sb_port}/api/${sb_api_key}/\?cmd=sb.shutdown while ps -p $p > /dev/null; do sleep 1; done
fi
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac

exit 0
endmsg

Set the right permissions with:

chmod 755 /etc/init.d/sickbeard

Add to crontab to start at startup with:

crontab -e

Insert:

@reboot /etc/init.d/sickbeard start

Save with CTRL+O and quit with CTRL+X

Start with:

/etc/init.d/sickbeard start

It should be up and running now.

Headphones

If you're still sudo skip the following, otherwise:

sudo -s

Create user, download headphones and set the correct permissions

useradd --system --user-group --no-create-home headphones && git clone git://github.com/rembo10/headphones.git && mv headphones /usr/local/headphones && chown -R headphones:headphones /usr/local/headphones && chmod ug+x /usr/local/headphones/Headphones.py && mkdir /var/headphones && chown -R headphones:headphones /var/headphones

su headphones -c "/usr/local/headphones/Headphones.py --datadir=/var/headphones --config=/var/headphones/headphones.ini"

Test it by going to your raspberry pi's ip and port number. Default is 8181. Quit the service in the terminal with CTRL+C.

Change USER, HOST and PORT, if you want to. I changed it to headphones with default port number.

Copy the start and stop file with:

cp /usr/local/headphones/init.ubuntu /etc/init.d/headphones

Change the data and config dir with:

vi /etc/init.d/headphones

Change the following lines somewhere at the top:
HP_HOME=/usr/local/headphones/
HP_DATA=/var/headphones

Change permissions with:

chmod 755 /etc/init.d/headphones

Add to crontab to start at startup with:

crontab -e

Insert:

@reboot /etc/init.d/headphones start

Start with:

/etc/init.d/headphones start

It will give an error about not finding the etc/default/headphones folder

Done!

  • TheEmperor

    Hi,

    I followed your instructions and cp and sb worked great!

    However, headphones is not starting automatically. It starts fine if I run /etc/init.d/headphones start but not after rebooting the RPi.

    I’m a Linux-Newbie, so I’m a bit helpless on where to look and would really appreciate some help!

    Thanks and kind regards,
    Robert

    • Hai

      Hi Robert,

      You can add a cronjob for this task, lookup cronjob start at reboot 🙂

      • Hai

        It’s something like crontab -e and then @reboot /etc/init.d/headphones

Sidebar