Creating Xbian image with CouchPotato, SickRage and Transmission for Raspberry Pi / Raspberry Pi 2

**UPDATE - New official SickRage repository included! (jan2016)**

Creating Xbian image on MicroSD/SD card

Recommended microsd card size is 8gb with maximum speed of reading and writing around 40Mbps. Try to use external hd for downloading Movies, TV Shows … Firtsly I used the same SD card for downloading Movies, TV Shows and after three months I get some bad sectors and boot problems.

1. Download Xbian installer from http://www.xbian.org/getxbian/

2. Select version: Xbian 2014.12.15 rpi (recommended latest stable version without step 3.) For Raspberry Pi 2, use image for Pi2 model, don't use image from Raspberry Pi 1!

Additional information: Some early version cannot be updated and you have to manualy change update repos (this was problem around dec. 2014 - feb. 2015, latest stable versions have been fixed)

3. Insert your microSD/SD card into Raspberry Pi, go through wizard! (if you don't finish wizard, you won't be able to connect via ssh).

Connecting to ssh via Mac Os X Terminal

Change ip address of your xbian (default username - xbian).

ssh xbian@192.168.x.x
Enter password: raspberry

Steps to use commands in right order:

1. Check and get new updates

sudo apt-get update
2. Install package p7zip for extraction zip files
sudo apt-get install p7zip-full
3. Upgrading all packages to the latest version
sudo apt-get upgrade –y

4. Installing CouchPotato:

sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" xbian-package-couchpotato

5. Installing Transmission:

sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" xbian-package-transmission

6. Install dependencies:

sudo apt-get install python-cheetah git-core -y

If for some strange reason this code doesn't work, please go to: http://www.htpcguides.com/install-sickrage-raspberry-pi-usenet-torrent-tv/ and copy it from there. Then will definitely work.

7. Install a working unrar for the Raspberry Pi:

wget http://sourceforge.net/projects/bananapi/files/unrar_5.2.6-1_armhf.deb

8. Install the unrar package:

sudo dpkg -i unrar_5.2.6-1_armhf.deb

9. Git clone the SickRage installation into Raspbian:

sudo git clone https://github.com/SiCKRAGE/SickRage.git /opt/sickrage

10. Make Xbian owner:

sudo chown -R xbian:xbian /opt/sickrage

11. Test to see if it works:

python /opt/sickrage/SickBeard.py –d

12. Install Upstart:

sudo apt-get install upstart
Confirm with Yes

13. Create the SickRage upstart script file

sudo nano /etc/init/sickrage.conf

Paste this SickRage upstart script Raspbmc Note: if you are running Raspbmc remove the setuid and setgid lines. Change the exec line to su – pi -c “exec /opt/sickrage/SickBeard.py”

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

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

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

respawn

exec /opt/sickrage/SickBeard.py
Hit Ctrl+x, press Y and then Enter

14. Run the service to see if it works:

sudo service sickrage start

15. You should see a message like this:

sickrage start/running, process 14827

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

sudo reboot

Extra information:

At step 4. you can use one of these packages:

nzbget

sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" xbian-package-nzbget

sickbeard

sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" xbian-package-sickbeard

headphones

sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" xbian-package-headphones

This include all of them with couchpotato and transmission

sudo apt-get install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" xbian-package-download

Default port of packages:

Transmission: http://x.x.x.x:9091/

NZBGet: http://x.x.x.x:9092/

Headphones: http://x.x.x.x:9093/

Sick Beard: http://x.x.x.x:9094/

CouchPotato: http://x.x.x.x:9095/

CouchPotato Wizard: http://x.x.x.x:9095/wizard

SickRage: http://x.x.x.x:8081/

If you have some problems with SickRage, you could try this:

Removing folder:

cd /
cd opt
sudo rm -r -f sickrage

Now repeat steps from 9 to 14.

Samba write access:

1. Connect to Xbian via terminal or Putty.

1. Enter default username: xbian and password: raspberry or raspberrz

2. At the prompt, enter:

sudo nano /etc/usbmount/usbmount.conf
3. In Nano (a text editor) find the line:

SMBSHARE=no

4. Change

SHARERW=no
to
SHARERW=yes
5.Exit Nano and save (Control+X, Y).

6.Reboot

sudo reboot
7.You should now be able to connect to you Pi in Windows using SMB with \\XBIAN\ or \\192.168.1.149\ (check your ip on Xbian) or find your Pi in your Network and have write permission.

Samba share protected with password

In default is enabled Public=Yes, but with this option on windows, doesn't require password and guest user have full permission, to disable this, follow these steps:

If you want to check if this is enable, type command:

sudo testparm -s

First you have to change password and enable username for samba share:

Change password for username:

sudo smbpasswd -a xbian

Enable account:

sudo smbpasswd -e xbian

sudo net conf setparm xbmc-backup "guest ok" no

Try this if step before didn't worked:

sudo net conf setparm Name_Of_USB_Drive "guest ok" no

Now there shouldn't be anymore: Public = Yes, check with:

sudo testparm -s

Reboot sytem:

sudo reboot 

Try on Windows, open Explorer (WIN+E), at address bar type \\ip.of.your.xbian and try to open folder. Now should ask for username and password.

Change username and password for Transmission:

sudo service transmission stop
cd /
cd etc
cd transmission
sudo nano settings.json

find rpc-password= “insertyournewpassword“

find rpc-username= “insertyournewusername”

CTRL+X, Y in ENTER

sudo service transmission start

Access to web gui remote to Transmission:

cd /
cd etc
cd transmission
sudo nano settings.json

find

"rpc-enabled": no,

change to

"rpc-enabled": yes,

find

"rpc-whitelist": "here are some ip addresses that could access to transmission",

change it if you want to access from everywhere. Change to:

"rpc-whitelist": "*.*.*.*",

Option to enable or disable restriction of rpc-whitelist:

Enabled:

"rpc-whitelist-enabled": true,

Disabled:

"rpc-whitelist-enabled": false,

CouchPotato

In settings must be different folder for downloaded movies, otherwise movies wouldn't be moved/copied to your folder!! (Settings→Downloaders→Transmission→Directory)

Example:

/home/xbian/downloads/Movies/

If Xbian Config Gui doesn't start in XBMC/KODI

rename 30_packages.py to 30_packages.tmp

xbmc

mv /usr/local/share/xbmc/addons/plugin.xbianconfig/categories/30_packages.py /usr/local/share/xbmc/addons/plugin.xbianconfig/categories/30_packages.tmp

kodi

mv /usr/local/share/xbmc/kodi/addons/plugin.xbianconfig/categories/30_packages.py /usr/local/share/xbmc/kodi/addons/plugin.xbianconfig/categories/30_packages.tmp

Script for removing finished torrents

1. Step, stop transmission:

sudo service transmission stop

2. Go to /etc/transmission:

cd /etc/transmission

3. Create script file:

sudo nano autoremove.sh

4. Copy and paste text below, change “yourusername” and “yourpassword” to your user and password for transmission. After you paste it and edit, press “ctrl+x”, “y” and “enter” (be careful how is text copied, it must be same as here, otherwise will not work correctly):

#!/bin/sh
# the folder to move completed downloads to port, username,
# password
SERVER="9091 --auth yourusername:yourpassword"

# use transmission-remote to get torrent list from
# transmission-remote list use sed to delete first / last line
# of output, and remove leading spaces use cut to get first
# field from each line
TORRENTLIST=`transmission-remote $SERVER --list | sed -e '1d;$d;s/^ *//' | cut --only-delimited --delimiter=" " --fields=1`
transmission-remote $SERVER --list

# for each torrent in the list
for TORRENTID in $TORRENTLIST
do
echo Processing : $TORRENTID

# check if torrent download is completed
DL_COMPLETED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "Percent Done: 100%"`

# check torrents current state is
STATE_STOPPED=`transmission-remote $SERVER --torrent $TORRENTID --info | grep "State: Seeding\|Stopped\|Finished\|Idle"`
echo $STATE_STOPPED

# if the torrent is "Stopped", "Finished", or "Idle" after
# downloading 100%"
if [ "$DL_COMPLETED" ] && [ "$STATE_STOPPED" ]; then

# move the files and remove the torrent from Transmission
echo "Torrent #$TORRENTID is completed"
echo "Removing torrent from list"
transmission-remote $SERVER --torrent $TORRENTID --remove
else
echo "Torrent #$TORRENTID is not completed. Ignoring."
fi
done

5. Edit settings.json:

sudo nano settings.json

6. Search for:

"script-torrrent-done-enabled": false,

Now change “false” to “true”

"script-torrrent-done-enabled": true,

7. Set path to script in settings.json. Search for:

"script-torrent-done-filename":"",

Add path:

"/etc/transmission/autoremove.sh"

Now looks something like this:

"script-torrent-done-filename": "/etc/transmission/autoremove.sh",

8. Run transmission service:

sudo service transmission start

Script was founded on xbian forum

Link: http://xbian.org/forum/thread-2781.html

Steps for SickRage were taken from this site:

http://www.htpcguides.com/install-sickrage-raspberry-pi-usenet-torrent-tv/