2.1.1 Initial setup
Once you’ve installed the hard drive into the NAS and switched it on you’ll then need to run through the included ZyXel NAS Starter Utility. You’ll need to apply the default configuration. Once complete you should be able to find your NAS drive at http:\\nsa310\ and login using the default user/pass of admin/1234. I’d recommend changing this straight away via the Sharing>Users settings. You should also add a new share for downloads. Call this ‘downloads’, enable it and ‘make share public’. You can add additional shares here too if required, or just use the default music/video/photos. Next, from a PC navigate to the downloads share, e.g via Samba \\nsa310\downloads\ and create 3 folders: ‘incomplete’, ‘sickbeard’, ‘couchpotato’. Then create 2 folders in the \\nsa310\video\ share called: ‘TV Shows’ and ‘Movies’.
2.1.2 FFP Setup
Follow this guide to install the FFP package. This will give you SSH access and allow you to install various other packages and complete the rest of this tutorial. Essentially, you just download this file then place it here \\nsa310\admin\zy-pkgs\
You may need to browse to the root of your NAS first, and then navigate to that path where you will be prompted for a password (use the admin account password you just changed).
Once the file is in place, open a browser and navigate to http:\\nsa310\ and login. Expand the ‘Applications’ tree and select packages. Find the FFP package and install it. Once complete you can now SSH into the NAS as root using your admin account/password.
Slacker is a package manager that comes with FFP, to set it up you need to run this script and then enable all repos:
/ffp/sbin/uwsiteloader.sh
You should now go ahead and install nano and zyxel_utils which lets you tweak FFP.
slacker -Ui nano zyxel_utils
You can configure zyxel_utils by un-commenting various options in the zyxel_utils.sh file:
nano /ffp/start/zyxel_utils.sh
More info about zyxel_utils can be found here, while more info about FFP can be found here (once FFP is installed).
2.1.3 Transmission
While you’re in the ZyXel packages menu, install Transmission. Once installed, but not* enabled, you’ll need to configure the settings. You can just leave them at defaults, but I would recommend changing the download paths, adding a torrent completion script and adding a password, especially if you plan to access Transmission remotely. Edit the settings file:
nano /usr/local/zy-pkgs/config/Transmission/settings.json
Modify these settings in the file above, obviously chose a proper user/pass:
"download-dir": "/i-data/md0/downloads/"
"incomplete-dir": "/i-data/md0/downloads/incomplete/",
"rpc-authentication-required": true,
"rpc-password": "pass",
"rpc-username": "user",
"script-torrent-done-filename": "/ffp/home/root/torrentdone.sh"
The torrentdone.sh script doesn’t exist yet, but we’ll create that later.
Once you’ve changed and saved the settings, enable Transmission via the ZyXel admin page, then navigate to: http://nsa310:9091/ and hopefully you’ll be prompted to login and see the Transmission web interface. You can now test it is working by uploading a torrent file or providing a link to a torrent file or magnet link. You should find your download starts in the incomplete folder before being moved to the root of the downloads folder.
* transmission must be stopped/disabled before you can change the settings. If it is running, any changes you make won’t actually be saved.
2.1.3 Sickbeard
You basically need to follow the official SB install instructions here, but I have picked out the relevant parts, used The Pirate Bay fork by mr-orange and added NSA-310 specific instructions below:
First you need to install git, python, sqlite, wget and a few other packages so you can clone and then run Sickbeard.
slacker -Ua memiks:git-1.8.2.1 mz:python-2.7.2 mz:sqlite-3.7.10 s:wget-1.12 br2:curl-7.34.0 s:rtmpdump
Install the cheetah python template
wget http://pypi.python.org/packages/source/C/Cheetah/Cheetah-2.4.4.tar.gz
tar -zxvf Cheetah-2.4.4.tar.gz
cd Cheetah-2.4.4
python setup.py install
Clone sickbeard from git
cd ~
git clone http://github.com/mr-orange/Sick-Beard.git my-sickbeard-install
If you have issues with certificates with the above command, or when updating SB in the future then try running this beforehand:
export GIT_SSL_NO_VERIFY=true
Run Sickbeard
cd my-sickbeard-install
python SickBeard.py
If it’s successful, in a browser navigate to http://nsa310:8081/ and you’ll see the Sickbeard web interface, woohoo!
Configuring sickbeard
Hover over the cog in the top right and select ‘Search settings’ and set the ‘Search frequency’. This is how often you want Sickbeard to check for episodes. Mine is set to 300 minutes (5 hours) which seems to work quite well.
Next, select the ‘torrent search’ tab where you need to:
- check ‘search torrents’
- Select Transmission as the ‘Torrent method’
- Set the host to: http://localhost:9091/
- Enter the Transmission user/pass if you have one
- Set the ‘Transmission directory’ to: /i-data/md0/downloads/sickbeard/
Run the test and ensure it’s successful. If it fails, check your password is correct, if it is, then try changing the host to http://nsa310:9091/ or http://IP_of_NAS:9091/ They all point to the same place, but for some reason SB can be picky.
Once it’s working, move onto the ‘Search Providers’ settings and enable Pirate Bay and any other torrent sites you want/have logins for. Now click the ‘Configure Built-in Providers’ and ensure Pirate Bay is configured to use a proxy if your ISP blocks it.
Next, go to the ‘Post-Processing’ settings:
- Ensure “TV Download Dir” is blank (Sounds odd, but will be explained later)
- Uncheck ‘keep original files’ and ‘Scan and Process’
- Check ‘Move asscociated files’ (and ‘Rename episodes’ if you want)
Set up the options ‘Episode naming’ and ‘Metadata’ tabs if you wish to do so.
Now click the ‘Notifications’ settings and set up XBMC notifications.
- Enable
- Check ‘Notify on Snatch’ , ‘Notify on Download’ and ‘Update Library’
- Set XBMC IP:Port (This is the IP of your Pi)
- Set user/pass for XBMC if you have one
- Set anything else you want and also any other notifications you fancy (there are loads)
Hit ‘Test XBMC’ and ensure it’s successful. The Pi must be on with XBMC running and the web server enabled.
Adding TV Shows
Now you need to add your TV shows, you do this by going to ‘Show List’ and then ‘Add Shows’.
Click ‘Add New Show’ and follow the steps to choose the show, the directory and quality settings etc. The directory should always be set to the root of your TV Show folder, i.e like this: ‘/i-data/md0/video/TV Shows’
No need to specify a sub-directory of the TV show name, even if it already exists, as Sickbeard will take care of that.
Now, provided the show is currently on air and torrents are found on Pirate Bay, Sickbeard will snatch a torrent and send it to Transmission. It will notify XBMC and a popup will appear on your TV. The torrent will download to the incomplete download folder and be moved to the Sickbeard download folder when complete. Once a download completes, Transmission will run the ‘torrentdone.sh’ which we configured earlier. This script will handle the manual-postprocessing and update the XBMC library (more on that later).
2.1.3 Couchpotato
Couchpotato is similar to Sickbeard and requires git and python to install and run:
cd ~
git clone https://github.com/RuudBurger/CouchPotatoServer.git
python CouchPotatoServer/CouchPotato.py
With any luck, Couchpotato will be up and running and will have started a webserver here: http://nsa310:5050
Run through the wizard and set it up how you wish ensuring to:
- Set up Transmission with the same details as Sickbeard
- Ensure Transmission directory is set to: /i-data/md0/downloads/couchpotato/
In the rename downloaded movies section:
- Set ‘run every’ to 0
- Set the ‘To’ directory to /i-data/md0/video/Movies/
- Set the ‘From’ directory to /i-data/md0/downloads/couchpotato/
- Set ‘Force Every’ to 0
Once the wizard is complete, I’d suggest going to the settings and setting up ‘Notifications’ and changing ‘Quality’ settings to suit your requirements.
Now, search for a movie at the top and select a quality. With any luck, a torrent will be snatched and sent to Transmission, XBMC will be notified. The movie will finish downloading and be moved to the couchpotato download folder and the ‘torrentdone.sh’ will fire.
2.1.4 Post-Processing
Both Sickbeard and Couchpotato have automated post-processing which you may have noticed have been disabled in my setup. The reason for this is I didn’t like the way they run and how they interfere with other files you may have in your download folder (I lost a bunch of non-SB/CP downloads after either SB or CP “tidied up” after processing). So to avoid this happening again, I set up the SB and CP folders in the download share so they are separate from my other downloads. The other thing I didn’t like was how CP checks for completed downloads every x minutes. Set this option to check every 5 minutes and 99% of the time there will be nothing for it to process. Set it to every 5 hours and you could be waiting a few hours for CP to check for a complete download. It seems to make much for sense to fire up the post processing only when a download completes.
This is where the Transmission ‘torrentdone.sh’ script comes into play. My script will run whenever Transmission completes a download, be it CP, SB or a normal download I have started. The script triggers SB and CP to check their relevant download folders for any new content, it fixes some file permissions which I was having trouble with somewhere along the downloading process and also writes the details to a log file so you can check when it has run. This was mainly for debugging, but I’ve left it in as it may be useful. One other advantage of this script is it means your hard drive isn’t spinning up every x mins/hrs to check for completed downloads as it only runs when it’s actually needed. Note: the script pings your Raspberry Pi and only runs if the Pi is running. No point processing if the Pi isn’t up to scan the new media. See the ‘incremental scans’ section below to see how the script runs next time you boot the Pi.
So, create the ‘torrentdone’ script:
nano /ffp/home/root/torrentdone.sh
Paste this and edit the details to match your setup:
#!/ffp/bin/sh
logPath="/ffp/home/root/log_torrent.txt"
#######################################################################
# transmission has finished a download and moved it to either the downloads
# or CP/SB folders within it. Update file permissions:
#######################################################################
chmod -R a+w /i-data/md0/downloads/
chmod -R a+w /i-data/md0/video/
######################################################################
# Files have been moved and have correct permissions,
# now manually run post-processing for CP and SB
# to move the files to the correct location for XBMC and add to library
######################################################################
ping -c 1 192.168.0.8 #IP of your Raspberry Pi
rc=$?
if [[ $rc -eq 0 ]] ; then
echo $(date "+%d/%m/%y %H:%M") "- Couchpotato Renamer:" $(curl http://127.0.0.1:5050/api/<Enter your CP API Key here>/renamer.scan) >> $logPath
curl http://127.0.0.1:8081/home/postprocess/processEpisode?dir=/i-data/md0/downloads/sickbeard/ > /dev/null
echo $(date "+%d/%m/%y %H:%M") "- Sickbeard post processing ran" >> $logPath
else
#Pi is offline, it will scan for new media on next boot
echo $(date "+%d/%m/%y %H:%M") "- Raspberry Pi offline" >> $logPath
fi
#####################################################################
# Update permissions again as CP sets permissions as root
# and therefore files can't be edited by SMB clients
#####################################################################
sleep 10
chmod -R a+w /i-data/md0/video/
chmod -R a+w /i-data/md0/downloads/
echo "script complete"
If you use a username/password for Sickbeard, you will need to add it to the start of the URL, e.g. http://username:password@127.0.0.1:8081/…
You will find you Couchpotato API Key on the general settings page.
Make the script executable
chmod +x /ffp/home/root/torrentdone.sh
I’m sure there are better ways to handle post-processing and maybe I’ve been setting up SB/CP wrong, but this method seems to work ok for me and allows my hard drive to remain asleep the majority of the time.
2.1.5 Autostart Sickbeard and CouchPotato
Once SB and CP are installed and running without issues then you will want to start them automatically each time the NAS boots.
To do this you need to create a start up script on the NAS in /ffp/start/:
nano /ffp/start/startSBCP.sh
Then paste this
python /ffp/home/root/my-sickbeard-install/SickBeard.py --daemon
python /ffp/home/root/CouchPotatoServer/CouchPotato.py --daemon
You may need to modify the paths if you installed them in a different location
Finally, make the script executable:
chmod +x /ffp/start/startSBCP.sh
2.1.6 MySQL
The final bit of set up on the NAS is to install and configure a MySQL database to store XBMCs library.
This is a lot easier and quicker than it sounds! Login to the NAS admin panel and go to the packages settings. Install and enable ‘PHP-MySQL-phpMyAdmin’. Once complete, go to http://nsa310/pkg/phpmyadmin/ and login with the user/pass of root/1234.
Click the SQL tab at the top, paste this and hit go to create a user called xbmc.
CREATE USER 'xbmc' IDENTIFIED BY 'xbmc';
Told you it was easy!
2.1.7 Copying your existing media to the NAS
You’ll probably have some media on another PC/laptop or on external hard drives. You can copy this to the NAS and place in any of the network shares. By far the easiest way is to transfer your files from another machine via samba. i.e. navigate to \\nsa310\ and simply copy & paste your files over. If you have a USB device, plug it into your PC/laptop and copy & paste over to the NAS. You can plug USB devices into your NAS directly, but I found the copying process extremely slow and a pain in the ass, so I wouldn’t recommend it.
One tip though, make sure you use a wired connection from the PC/laptop to the NAS drive either directly or via a router/switch (preferably gigabit), to maximise the transfer speeds. I managed to get around 55 MB/s using this method which equates to almost 200 GB an hour.
Recent Comments