Skip to content
dinkypumpkin edited this page Jul 16, 2020 · 24 revisions

Using the get_iplayer PVR with cron

Now is the time to set up get_iplayer to act as a PVR (you know Sky+, TiVo, series-link, etc, etc)! get_iplayer can be easily configured to automatically download your favourite BBC TV programmes just like any other PVR except that there are no limits on how many programmes you can 'record' simultaneously (OK, except your broadband speed maybe). You even get thirty days grace when you've forgotten to set up the PVR.

Here is a quick guide to setting it up. I'm assuming you have downloaded and installed get_iplayer as described here.

Setting up a PVR search

Use get_iplayer to search for the programme you wish to have downloaded. You can search based on the programme name (and can also limit to specific channels and categories etc). In my example I want to get the upcoming TV episodes of Doctor Who so I just type this:

get_iplayer 'Doctor Who' --type=tv

This results in:

Matches:

184:    Doctor Who Confidential: Series 4 - A Noble Return, 'BBC Three', Factual,Arts,Culture & the Media,TV, default
185:    Doctor Who Confidential: Series 4 - The Italian Job, 'BBC Three', Factual,Arts,Culture & the Media,TV, default
186:    Doctor Who Confidential - At Christmas, 'BBC Three', Factual,Arts,Culture & the Media,TV, default
187:    Doctor Who: Series 4 - Partners in Crime, 'BBC One', Drama,SciFi & Fantasy,TV, default
188:    Doctor Who: Series 4 - The Fires of Pompeii, 'BBC One', Drama,SciFi & Fantasy,TV, default
189:    Doctor Who - Voyage of the Damned, 'BBC One', Drama,SciFi & Fantasy,TV, default

OK, so I don't want those extra programmes on BBC Three, so I limit my search to BBC One only:

get_iplayer 'Doctor Who' --type=tv --channel='BBC One'

Now I just get these matches:

Matches:

187:    Doctor Who: Series 4 - Partners in Crime, 'BBC One', Drama,SciFi & Fantasy,TV, default
188:    Doctor Who: Series 4 - The Fires of Pompeii, 'BBC One', Drama,SciFi & Fantasy,TV, default
189:    Doctor Who - Voyage of the Damned, 'BBC One', Drama,SciFi & Fantasy,TV, default

Now I have the search I want, I can save this to the PVR search list by simply appending the --pvradd option:

get_iplayer 'Doctor Who' --type=tv --channel='BBC One' --pvradd='Dr Who'

If you want to list all the searches that you have saved just run:

get_iplayer --pvrlist

If you want to do some more advanced searches you might want to read this page for examples.

Getting the PVR to run automatically

There is one more thing you need to do to get the downloads to happen automatically. You only need to set this up once. You must ensure that this command runs on your PC on a regular basis:

/full/path/to/get_iplayer --pvr

Find /full/path/to/get_iplayer with which get_iplayer.

In Linux/BSD/macOS systems this can simply be achieved by adding the following lines to your crontab (run 'crontab -e'). Also, if you have local email delivery capability then you will also receive an email when new programmes are downloaded (set MAILTO below accordingly):

MAILTO="[email protected]"
0 * * * * /full/path/to/get_iplayer --pvr --quiet 2>> /tmp/get_iplayer.log

Find /full/path/to/get_iplayer with which get_iplayer.

This will ensure that the PVR checks for new matching programmes every hour, on the hour.

You should also set preferences on your system so that you know where the downloaded files will be saved:

get_iplayer --prefs-add --output='/home/jbloggs/videos/'

Do not run get_iplayer as root user via cron.

Logging new downloads

If you would prefer not to receive an email for new download, you can add an option to the cron command to keep track of new downloads in a log file.

0 * * * * /full/path/to/get_iplayer --pvr --quiet -c 'echo "$(date)    <name> <episode>" >> /home/jbloggs/log/iplayer' 2>> /tmp/get_iplayer.log

Find /full/path/to/get_iplayer with which get_iplayer.

You can then check the most recent downloads with tail ~/log/iplayer (or add this command to .bash_profile if you want to receive this update on login).

And finally, remember that this will only work when your computer is booted up and connected to the Internet!

Source: linuxcentre.net

Clone this wiki locally