Automating Downloading with a Raspberry Pi

I jumped on the bandwagon when the Pi was released as just about every other tech/nerd did as well.

After the long wait, when the unit finally arrived I was unsure of what to do with it – until a friend of mine introduced me to Sick Beard, Couch Potato and Sabnzbd Plus.

I had already set up my Pi to run Raspbmc for XBMC but found it was slow and I did not need it to be my media center as I already have 2 Apple TV’s running Firecore.

Being lazy, instead of reinstalling Raspbmc with another OS I decided to adjust it so I didnt have to take the SD card out of the Pi and could just use SSH to configure everything.

This isnt a full guide it is just a list of what to be aware of.

Booting – Raspbmc loads xbmc automatically on boot, it is loaded by a script in /etc/init.d, if you dont want xbmc to run on boot any more delete these scripts and it wont, i think it would be nearly impossible to run everything and xbmc so I would suggest deleting the init.d scripts for it

Performance – Raspbmc is set to have a significant ammount of ram used for the GPU, if you dont change this (like I did not to begin with) Sick Beard and SabNZBPlus will crash. To change these settings use:

sudo nano /boot/config.txt
change gpu_mem_256=256 to gpu_mem_256=64
change gpu_mem_512=512 to gpu_mem_512=128

Reboot and run free -m or run top and you will notice a significant increase in available RAM, enough for Sab and Sick Beard to run, I decided not to run couchpotato but it should be enough for it as well.

Directories – It is best to make a directory structure that is easy to mange, most people make an incoming folder for incoming downloaded then completed/category (e.g. TV) for completed downloads. Keeping this structure will make it easier for Sick Beard to scrape and easier to configure.

Storage – There are a few options for this, some people run USB hubs with Storage drives attached to the Pi. Most people I assume will be using Samba shares.

***You need to istall cifs-utils or mounting samba will not work, you will most likely need to edit /etc/apt/source.list to install packages from apt***

These are the lines from my sources.list

deb wheezy main contrib non-free
deb squeeze main contrib
deb-src wheezy main contrib non-free rpi

I made mount points for the samba shares I have, mapped them in fstab but then found that sab could not write even though from the command line I could make directories and files as the user sab ran as. I found that I needed to add the user uid to the fstab line and then writing worked fine. Here is an example:

// /mnt/completed cifs defaults,uid=1000

uid=1000 on my pi is the user that sab runs as, I suggest you use the uid that your sabnzbdplus install works under.

Once you edit fstab, instead of rebooting you can run sudo mount -a to reload fstab and it will tell you if there are any errors.

To check your mount points are owned by the right user run ls -al in the /mnt directory (if thats where you made your mount points, you should have made them there). The third column will show the user the share was mounted by, if this is not your sab user, you have your uid wrong in fstab.

I hope this helps the people that have had the same issues I have, I ended up reading through many different sites and brushing up on a lot of linux commands to get this all running so I thought brief explanations in one place would make it easier for other people attempting the same thing.