Raspberry Pi – adding a cron job to run get_iplayer automatically

Finally getting round to automating my get_iplayer on my pi PVR with cron.

First find where your get_player PVR runs from by typing the following into the terminal

echo $PATH get_iplayer --pvr
my output was: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games get_iplayer --pvr

I had previously tried using:

cd ~/get_iplayer; ./get_iplayer –pvr

but this failed to work, so I recommend the echo path output string.

Next to write the cron job (adding the output file log location)

* 2,14 * * * PATH=./usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games get_iplayer --pvr  >>/home/pi/cron_log.txt

The 2,14 refers to 2am and 2pm, so the command will run at these times. See this wikipedia entry for further explanation and examples. Also note the “.” after the “=” this is required. The second part refers to the process you want to run (eg: run the PVR) and finally the “>” is where to save the output log to.

So now to add the cron job, open the terminal and type

crontab -e

The nano text editor should then open, the just add the line above to automate the PVR and save the output to /home/pi/cron_log.txt so you can check to see that everything is working as expected as the terminal window will not show the processes running. The double “>>” will ensure the new programmes are apended to the file rather than overwriting the file each time the process is run.

Now wait for 2am or 2am and check the log (alternatively set the time for a few minutes in the future to check its all working).

My previous post about get_iplayer here

More info about get_iplayer available on Square Penguin

 

 

Raspberry Pi and get_iplayer

get_iplayer is a great piece of software that downloads bbc iplayer programmes to a local hard drive it also runs great on a raspberry pi. To set-up I followed these instructions: http://raspi.tv/2014/get_iplayer-raspberry-pi-update

Once installed open the terminal and run

get_iplayer --cat films

This will then return all the films currently available on iplayer, then to download, note the Number and run:

get_iplayer --get 1582 --modes best --type=tv --file-prefix="<nameshort>-<.senum>-<.episodeshort>" --output "/media/WD/tv/films"

Continue reading