Using Podget to download podcasts for Plex on TrueNAS

Plex has support for podcasts and web shows (which I henceforth will refer to as video podcasts) but I’ve never been a fan of their implementation. You can only listen to podcasts offline on Android (I have at least not seen a download feature on other platforms that I use) and there are constant problems with resuming playback where I left off. For video podcasts I have never seen an option to download them on any platform.

Therefore I have been searching for an alternative solution that still would work with Plex and that solution is called Podget. Podget is basically just a bash-script that can download any podcast that supplies a RSS-feed. So the idea is that Podget will download the episodes into a folder Plex can read from. Here is how I set it up in a jail on TrueNAS.

Start by logging in to your TrueNAS admin panel and create a new custom jail, we are not using a plugin for this.

  1. Because of my network configuration I will be using the advanced jail creation option.
  2. Give the jail a name, for instance podget.
  3. Make sure you set jail type to Clone Jail. You can read more about the differences in the TrueNAS forum.
  4. Choose the latest available release.
  5. Since we are downloading podcasts this jail will need networking.
    1. Activate VNET.
    2. Activate Berkely Packet Filter.
    3. Set vnet_default_interface to none.
    4. Set IPv4 interface to vnet0.
    5. Pick an IP-address and netmask.
  6. I’m putting this jail on a VLAN so I have already created a bridge I want to use with it. Therefore I go to Network Properties and then change interfaces to vnet0:mybridge. Here is some more information about using jails with VLANs.
  7. Create the jail.

Now I like to switch over to using SSH instead. So SSH to your TrueNAS server and then start the jail if you haven’t already.

iocage start podget

Enter the jail.

iocage console podget

Install some dependencies.

pkg install bash wget coreutils gsed gmake ca_root_nss nano

Download Podget from Github and unpack it.

wget https://github.com/dvehrs/podget/archive/master.zip
unzip master.zip

Remove the zip and then install Podget.

rm master.zip
cd podget-master
gmake
gmake install

Now lets create a Podget user which we will use to run the command in production. Run the adduser command and answer the questions. I used the following options.

  • Username: podget
  • Password: random
  • Full name: podget
  • Uid: default
  • Class: default
  • Home: default
  • Home mode: default
  • Shell: bash
  • Locked: no

When the user is created enter the jail and save the UID of the Podget user, you will need it later.

su - podget
id podget

We should now go back to the TrueNAS admin interface and create a dataset where we will store our podcasts. This dataset will be mounted into both the Podget and Plex jails so that Podget can download to it and Plex can read from it.

When you have created the dataset you need to edit the ACL for it. You do that by going to Storage -> Pools -> find the dataset and click on the three dot icon to the right of it -> Edit ACL. Add another ACL Item and set the following permissions for it:

  • Who: User
  • User: The UID you saved earlier, in my case 1001.
  • ACL Type: Allow
  • Permission Type: Basic
  • Permissions: Full Control
  • Flags Type: Basic
  • Flags: Inherit

What you are doing here is granting the Podget user full control of what is stored on this dataset, that way it can write podcasts to it. There are more settings on this page you should go through and make sure they are set the way you want them to be. If you are unsure what everything does I recommend you watch this video.

You will need to add one more ACL Item to grant the Plex jail access to the dataset. Start by finding out the UID for the Plex user.

iocage console nameofplexjail
id plex

In my case the UID is 972, so create another ACL Item with the exact same settings as the previous one but change the user to 972.

When you have created the dataset shutdown the Podget jail. Then edit the mount points and add a new mount point for the dataset you just created. You can add a mount point if you go to Jails -> maximize the jail -> Mount points -> Actions -> Add. I will mount it under /mnt/podcasts inside the jail but you can mount it wherever you like.

Start the jail again and open up a console to it again like we did before.

Switch to the new user, run Podget once to initialize it and then edit the Podget configuration file. I’m using nano here but you can use whatever editor you are comfortable with, but you might have to install it first.

su - podget
podget
nano .podget/podgetrc

Change the DIR_LIBRARY variable to the mount point (/mnt/podcasts) you just created. This will tell Podget to store your podcasts in that folder instead. This file contains a lot of configuration options, make sure to read through it later and change it to suit your needs.

Add the podcasts you want to download to the file called serverlist. Here is an example of how I configured my serverlist.

https://feeds.twit.tv/sn_video_hd.xml VIDEO Security Now
https://feeds.twit.tv/ww_video_hd.xml VIDEO Windows Weekly
https://feeds.twit.tv/twit.xml AUDIO This Week in Tech

Here I use the category feature in Podget to sort audio podcasts into a folder called AUDIO and video podcasts into a folder called VIDEO. This way I can create two libraries in Plex, one for audio and one for video.

Run Podget again to download the podcasts you defined and then clear out the ones that were created in your home folder when you ran Podget the first time.

podget
rm -rf ~/POD

Now it’s time to add our podcasts to Plex. Shutdown the Plex jail and add a new mount point to it, just like we did with the Podget jail earlier. You can mount it to any path you want inside the jail but I will continue using the /mnt/podcasts path.

Start the Plex jail again and go to the Plex web interface where you can add new libraries. In my case I added a library for video podcasts and one for audio podcasts. The path for video podcasts will be /mnt/podcasts/VIDEO and the path for audio podcasts will be /mnt/podcasts/AUDIO. The podcasts you downloaded earlier should show up in Plex when you have created the libraries.

But you still need to run the Podget command in order to download new podcasts, we want this to be run automatically so we need to create a cron job.

iocage console podget
su - podget
crontab -e

My cron job looks like this.

0 * * * * /usr/bin/podget

It runs once every hour, at that time it will download new podcasts and clear out old ones. Plex will then discover them according to the settings you have set for the Plex media scanner.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.