Site icon trendblog.net

Automatically download TV show episodes as soon as they air

Having a reliable and fast internet connection is an affordable luxury that opens up a lot of possibilities. Especially series and film lovers are able to download or stream their favorite shows or movies. Services like Netflix in combination with streaming devices such as Google Chromecast or Amazon Fire TV offer a great experience and are worth the small investment. But what if the show you really want to watch isn’t on Netflix? Or if Netflix isn’t available in your country? Well, then you have the option to search the web for the episodes and download (or stream) them yourself. By doing so, you might download copyrighted material. It’s up to you to do that.

If you’re following lots of different shows, then you need to search for a lot of new episodes every week to stay on top of everything. That can be very time-consuming and it’s not easy to keep an overview. With a little bit of money and time, however, you can completely automate this process and lean back while all your shows are being downloaded as soon as new episodes are available.

Download new episodes as soon as they’re available using a Raspberry Pi and Kodi [Mac & Windows]

So how does this work? The basic setup is a computer (in this case a Raspberry Pi) that checks 24/7 if new episodes are available and downloads them to your hard drive, media server or other kinds of storage. If you combine that with media streaming apps like Plex or Kodi, then you end up having a fully automated TV show experience. Below is a graphic showing an example of such a setup. Don’t be intimidated by the steps you don’t understand. After reading this guide, everything will make sense.

This article, divided into several parts, will guide you through the whole process of setting everything up. If you have some basic programming knowledge, this should be fairly easy. But even without such skills, you should be able to follow the steps (it’s mostly copy and paste).

It’s important to mention that this guide mentions Usenet, which can be used to download copyrighted material. We’re only interested in what’s possible with Usenet. It’s completely up to you what to do with that information and how to use Usenet. Google is your friend if you want to know more about it.

A basic example of a setup:

  1. The TV show manager Sonarr makes requests to an indexer and receives data about new episodes if available.
  2. Sonarr hands over that data to the Usenet downloader NZBGet, which then downloads the episodes.
  3. Sonarr and NZBGet are running on the Raspberry Pi.
  4. Downloaded content is automatically moved to your NAS media server.
  5. Your TV show folder is connected to a streaming device (e.g. Fire TV with Kodi installed).
  6. Logically at the end stands a TV, connected to the streaming device.

Table of content

The five parts of this guide will dive into the important steps of the graphic above.

  1. What you need to get started
  2. Install Raspbian on your SD card
  3. Setting up your Raspberry Pi
  4. Mounting/Connecting your Raspberry Pi to a media server
  5. Installing NZBGet and Sonarr

Okay, let’s get started!

Part 1: TV show automation hardware setup

We already covered this part in another article with some additional information. It might not hurt to check it out!

Hardware:

Optional:

Try to get your hands on a RPI 2 Model B. It’s performance is much better than its predecessor which allows faster download speeds and stability.

Software:

Besides the things above, you need a computer to access and setup the Raspberry Pi.

Once you have everything from the list above, move on to the next part which shows you how to install the operating system Raspbian on an SD card.

Part 2: How to install a Raspberry Pi operating system (Raspian) on an SD card

In this part, you’ll learn how to install the popular operating system ‘Raspbian’ on an SD card using a Mac or Windows machine. After doing so, you can continue setting up your Raspberry Pi.

Before you start, you (obviously) should have a microSD card and a computer with an SD card reader. Besides that, download the Raspbian image file directly from raspberry.com (don’t forget to unzip the image file!).  Done? Good, let’s get started.

For OS X users:

Put your microSD card into your card reader (and connect it to your Mac if your using an external reader). For this to work, your microSD should be empty and formatted in FAT32.

Go to your applications and open up Disk Utility (or just use Spotlight). Now we need to find the microSD card’s so called BSD number which looks like “diskn” where “n” is a number. To find it, select it (left side) and click on ‘Verify Disk’. Now, have a closer look at the appearing lines of text. There should be a line very similar to “/dev/rdisk1s1”. In this example, the BSD number would be “disk1”. With your microSD card still selected, click on ‘Unmount’ in the top menu bar of Disk Utility.

Now all you need to do is open up Terminal (in your Mac’s applications) and run the following line:

sudo dd bs=1m if=path_of_your_image.img of=/dev/diskn

Make sure to replace “n” from diskn with the right BSD number. Also, you need to include the complete path of your Raspbian image file. An easy way to find a file’s exact location is to drag and drop the file into the Terminal window.

So an example could look like that:

sudo dd bs=1m if=/Users/marc/Desktop/2014-12-24-wheezy-raspbian.img
of=/dev/disk1

After hitting Enter, you’ll be prompted to enter your system password (the one you use to log into your computer). Now, the image file is being transfered and installed on your microSD card. This can take a while. During the process you won’t see any feedback in your Terminal window so be patient until you see many new lines confirming a successful image transfer.

That’s it! You can now plug your microSD card into your Raspberry Pi.

In the next part we’ll show you how to do the initial setup of your Raspberry Pi.

For Windows users:

  1. Insert your microSD card into your card reader and find out its drive letter in Windows Explorer (for example G:).
  2. Download Win32DiskImager, unzip the downloaded file and run the utility file.
  3. Select the Raspbian image file you downloaded.
  4. Select the drive of your SD card in the ‘Device’ dropdown. Make sure you chose the correct one. Otherwise, you risk damaging the data on your hard drive.
  5. Select ‘Write’ and wait for the process to finish. That’s it!
  6. Now you can plug the SD card into your Raspberry Pi’s slot.

Part 3: Raspberry Pi basic “headless” setup without cables

In this part, we’ll guide you through the basic initial setup of a Raspberry Pi. If you’re using an ethernet cable and not a USB WiFi adapter on your Raspberry Pi, then skip the first step.

1. Setting up WiFi

Put your SD card with the installed operating system in your computer’s card reader. Open up your terminal and enter the following line:

sudo nano /path/to/sd/card/etc/network/interfaces

Make sure to type in the correct path to your SD card. An example could look like the following:

sudo nano /Volumes/sd-card-name/etc/network/interfaces

This command opens up the interfaces file inside your terminal using the nano text editor. Now make sure that its content looks like the following (replace the bold parts with your WiFi details):

auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "your-network-name"
wpa-psk "password-here"

Save the file by pressing “CTRL + X”, hitting “y” and pressing enter. Now you can put your microSD card into your Raspberry Pi’s card slot.

2. Hardware setup

This is an easy one. Make sure your microSD card is plugged into your RPi. Now either plug in a USB WiFi adapter or an ehternet cable connected to your router. Last thing to do is to plug in the power source to turn on your RPi.

3. SSH into your Raspberry Pi

In your terminal window, enter the following:

ssh pi@RPiIPaddress (example: ssh pi@192.168.1.32)

Replace ‘RPiIPaddress’ with your Raspberry Pi’s IP address. You can easily find its IP address in your router’s browser interface, for example.

The default password is “raspberry”.

4. Set user password and timezone

Enter and run

sudo raspi-config

Select ‘expand filesystem’, change the user password and select your timezone in internationalisation options.

5. Update your RPi

Run

sudo apt-get update && sudo apt-get upgrade

Now it’s the time to get a coffee as the update will take a while.

6. Set up automatic restart with Watchdog

Since your Raspberry Pi will be running most of the time, you should have an app that reboots it in case it becomes unresponsive. That’s what Watchdog is for.

Run the following to install Watchdog

sudo apt-get install watchdog

Then run

sudo modprobe bcm2708_wdog

Open up modules

sudo nano /etc/modules

and paste the following line to the end

bcm2708_wdog

Press CTRL + X, then “y” and enter to save and close the file.

Run the following line to add Watchdog to the startup programs

sudo update-rc.d watchdog defaults

Now open up the config file and uncomment two lines of text

sudo nano /etc/watchdog.conf
remove the # from the following lines:
max-load-1
watchdog-device

Close the text editor the same way as already mentioned above.

Start the program with

sudo service watchdog start

That’s it! Your Raspberry Pi is now ready for the next steps. As already mentioned, this is a basic setup. You can do much more like setting up a firewall and other security measures. But for this guide, this is optional and not necessary.

In the next part, we’ll show you how to mount an external hard drive or NAS media server to your Raspberry Pi and how to install the usenet downloader NZBGet.

Part 4: How to mount your media server or NAS drive to a Raspberry Pi

This step explains how you can mount (or connect) a home/media server, also called NAS (network attached storage) to your Raspberry Pi. The benefit of this procedure is that all downloaded episodes on your Raspberry Pi will be automatically moved onto your NAS. If your TV or streaming device (e.g. Amazon Fire TV, Kodi) is connected to your media server, then you can access and watch new episodes without lifting a finger.

Enabling NFS sharing protocol on your NAS

Now, before we mount your media server to your Raspberry Pi, you need to make sure that NFS sharing is enabled on your server. NFS stands for Network File System and allows your NAS to share directories with other clients and programs over a network. They can access, add and edit files on your server as if they were stored on them locally.

How do you do that? Well, that depends on the media server. Covering all popular NAS servers would be beyond the scope of this guide. As always, Google is your friend. Since I mentioned the WD MyCloud server before, I will go through the process based on that model as an example.

  1. Go to the MyCloud dashboard at http://wdmycloud.local/UI/.
  2. Go to Settings and select Network in the left sidebar menu.
  3. Under ‘Network services’, switch SSH to On and write down the username and password in the pop-up window
  4. Open up your terminal / command line on your computer and SSH into MyCloud. What?? Don’t panic, it’s actually quite easy. In your terminal or command line window, type in
    ssh root@MYCLOUDIP

    Replace the last part with your server’s IP, which you can find in Settings > Network. Now, type in the password you wrote down earlier. Now you’re logged in. Don’t do anything you don’t understand here as this could deal serious damage to your NAS.

  5. Once logged in, open the exports file by typing the following
    sudo nano /etc/exports

    Add the following line at the bottom of the text editor

    /nfs/SHAREDFOLDER 192.168.0.0/24(rw,subtree_check,secure)

    Replace SHAREDFOLDER with an existing folder on your MyCloud that you want to be shared (e.g. /nfs/TVShows). Also, replace the IP address (192.168.0.0) with your network’s IP. If your router’s IP is 192.168.1.0, for example, then replace the third number with ‘1’. The last number should stay ‘0’.
    Save the changes with CTRL + X, then hit ‘Y’ and ‘Enter’.

  6. That should be it. Remember that this is an example for the MyCloud NAS from Western Digital. If you have a different device, then search for instructions on Google.

Mounting your NAS to your Raspberry Pi

Alright, let’s get to it. For demonstration purposes I will use the following as the IP address of your NAS: 192.168.0.50. Obviously, you need to replace that with the correct one. Another assumption is that the folder on your NAS that should be shared with your Raspberry Pi is named ‘TVShows’ and is located in your MyCloud’s root folder.

  1. Log into your Raspberry Pi (SSH into it). If you don’t know what this means, check out the previous part of this guide.
  2. Now we need to create a folder on your Raspberry Pi that will be connected with the TVShows folder on your NAS. Create this folder with the following line
    sudo mkdir /home/pi/TVShows

    To keep things easy I chose /home/pi/ as the directory and the same folder name as on your NAS. Feel free, however, to use a different location or name.

  3. Open the fstab file in the nano text editor by typing the following
     sudo nano /etc/fstab
  4. Copy and paste the following line at the bottom
    192.168.0.50:/nfs/TVShows /home/pi/TVShows nfs nouser,atime,auto,rw,dev,exec,suid 0   0

    Make sure to use the correct IP address of your NAS and to correct the folder locations and/or name if you chose something different. If you want to add a second folder (e.g. /nfs/Movies) then simply add the same line under the first and replace the folder name.

    Save the file with CTRL+X, then ‘Y’ and ‘Enter’.

  5. Now, we need to mount all partitions that are in your fstab file. Execute the following
    sudo mount -a

    If this process is successfull then you should see nothing but a new empty line. Several people with a Raspberry Pi Model 2 encountered a problem at this step. They got a message saying that the mounting process wasn’t successful. What helped most of them was to execute the following:

    sudo rpcbind start

    This should spit out something along “Starting rpcbind   [OK]”. Now, repeat the sudo mount -a command.

  6. That’s it. Now, whenever you place something into the TVShows folder on your Raspberry Pi, it will show up in the TVShows folder on your NAS.

Now, you should have a working Raspberry Pi which is connected to your media server. All downloaded media will be automatically moved onto the NAS and can be easily watched on your TV and other connected devices.

In the last part we’ll give you the resources to install and set up the Usenet downloader NZBGet and Sonarr on your Raspberry Pi.

Part 5: Installing Sonarr and NzbGet for total TV show automation

You’re still with us? Great! You’re almost there. The last thing you need to do is to install the applications that will take care of checking for new shows, downloading them to your Raspberry Pi and moving them to your media server.

Sonarr, NZBGet, Usenet, Indexer… – what?

Alright, before you start you should actually know what the involved parties are and what they’re supposed to do.

Sonarr (former NZBDrone) is a so-called PVR (personal video recorder) for Usenet or Torrent users, which checks multiple RSS feeds (also called Indexer) for new episodes of the shows you’re following. The great thing about Sonarr is its nice and clean user interface and features such as a episode calendar.

NZBGet is a robust and lightweight Usenet downloader which, as the name already says, is responsible for downloading the episodes that Sonarr finds. Although NZBGet and Sonarr are two separate programs, they are connected and communicate with each other. Below is a basic example of how they work together:

  1. You add a TV show to the Sonarr database.
  2. Sonarr keeps quering the indexer’s “feed” looking for episodes which are still missing.
  3. As soon as Sonarr finds a new or missing episode in the quality you want, it sends an instruction to NZBGet to download it.
  4. NZBGet downloads the episode, extracts it and moves it to a specified folder.
  5. Sonarr checks the NZBGet’s process and marks the episode as downloaded.

Usenet provider & paid indexer

To access Usenet’s file-sharing service, you need to sign up at one of the many Usenet providers such as Supernews or UsenetServer. You’ll need the account details of such a provider while setting up NZBGet.

The other thing you might need is to sign up at one or two paid indexers which cost around $10 a year. The advantage of those is that you usually don’t have problems with finding new episodes. Free services are less reliable when it comes to that. Most paid indexers are invite-only platforms, so it might take a little bit of work to get an invite. A good place to start is the subreddit /r/usenetinvites.

Install Sonarr and NZBGet on your Raspberry Pi

HTPC Guides has very detailed guides about installing and setting up both Sonarr and NZBGet. Since we couldn’t explain it any better, please check out their guides to go through the installation and setup of both applications:

If you’re going through the whole process with a Raspberry Pi 2 model, then we recommend having a look at this Reddit post before installing Sonarr.

Should you run into problems feel free to ask for help in the comments or check the Usenet subreddit for answers.

Some last words

Well, that’s all there is to know about setting up your Raspberry Pi to automatically download TV shows. I hope you were able to set everything up without any major issues. Even if it takes you more than one try, it’ll be worth it. Once it works, you’ll notice the huge plus side of this setup – the convenience. I hope you’ll enjoy it!

One more thing: As already mentioned in the first part of this guide, Usenet can be used to download copyrighted material. It’s up to you what you do with this guide. We’re only interested in what’s possible with a Raspberry Pi.

Exit mobile version