Tuesday 5 June 2012

Raspberry Pi - get_iplayer - setup and running

Anyway...  Im using get_iplayer as part of my solution to get my Raspberry Pi to create and distribute a podcast of the stuff I want to listen to / watch, but there are so many options, settings and modes I thought it a good idea to write them down not only for my benefit but for those that might want to re-create.

For instructions on how to install get_iplayer, check out this blog.

SWF Verification
In June 2013, BBC iPlayer changed to use SWF Verification (see this post for more information),  If you haven't already you need to setup the certificate by running.

./get_iplayer --prefs-add --rtmp-tv-opts="--swfVfy http://www.bbc.co.uk/emp/releases/iplayer/revisions/617463_618125_4/617463_618125_4_emp.swf"

Options
get_iplayer has 2 methods of telling it what options you want to use:

Passing them on the command line

./get_iplayer --output="/path/to/output/to" --type=tv,radio --etc

Setting preferences which get_iplayer then uses as defaults using the -pref--add command

./get_iplayer --prefs-add --output="/path/to/output/to"

I found setting preferences to be really useful otherwise every time you want to run get_iplayer your  command is going to be VERY long.

The options I set up were:
  • set the default types to search as tv and radio
  • set the cache expiry time to 1 hour (its 4 by default)
  • output downloads to a specific directory
  • output radio downloads to a specific directory
  • output to series sub-directories (e.g. all episodes of one series in one sub-directory)
  • format file-names to use a simpler naming structure and include the series and episode as S00E00
# set default type to tv & radio
./get_iplayer --prefs-add --type=tv,radio
# set cache expiry to 1 hour
./get_iplayer --add-prefs --expiry=3600
# set output directory
./get_iplayer --prefs-add --output="/default/output/path"
# set specific output directory for radio
./get_iplayer --prefs-add --outputradio="/output/path/for/radio"
# you can also set specific output directory for tv with
./get_iplayer --prefs-add --outputtv="/output/path/for/tv"
# set to use sub-directories
./get_iplayer --prefs-add --subdir
# set file name format
./get_iplayer --prefs-add --file-prefix="<nameshort>-<episodeshort>-<senum>-<pid>

Check out the get_iplayer documentation for more info on settings.

NOTE - preferences are user specific, so if you use get_iplayer as root, remember to set preferences logged in as root or use sudo.

Web User Interface

I am using get_iplayer's web user interface which is really easy to use and can be run with a simple command, allowing you to search, queue and record programmes from a web browser.

perl /installed/path/get_iplayer.cgi --port=1935 --get_iplayer=/installed/path/get_iplayer

If you are going to run the Web UI as a daemon (background task) you can do so by adding an & to the end of the command, but it would also be worth logging to a file as the applicatio produces a LOT of output messages.

perl /installed/path/get_iplayer.cgi --port=1935 --get_iplayer=/installed/path/get_iplayer 2>> /logfile/path/logfile.log &

Running PVR

I am using get_iplayer's PVR functions to allow me to record complete series of programmes.  Using the Web UI, I can search for a programme then use the 'queue' or 'add series' command, then when get_iplayer is called using the --pvr option is searches for all my series' or queued downloads and downloads them all at once and by scheduling this to run periodically I could automate the download process.

/installed/path/get_iplayer --pvr


7 comments:

  1. FYI get_iplayer update the BBC Olympics Coverage uses 'mediaselector/5 URLs' and a very good patch for get_iplayer 2.82 as some coverage is over 230 mins or over 4GB in HD file size user can now start/stop in any location of the stream.

    Support hh:mm:ss format for --start and --stop
    User may enter --start and --stop option values in hh:mm:ss format, with

    seconds optional. Values are converted to integral number of seconds as expected by rtmpdump

    source:
    http://git.infradead.org/get_iplayer.git/log

    ReplyDelete
  2. Have the below when I am trying to install the webgui

    Can't open perl script "/installed/path/get_iplayer.cgi": No such file or directory

    ReplyDelete
    Replies
    1. worked it out now hadn't installed lighttpd
      how do you get it to start on reboot automatically?
      Thanks

      Delete
    2. Thats good, although you shouldn't need lighhtpd to run it. To confirm I dont mean /installed/path literally, I mean the path when you have installed get_iplayer. If you used my instructions probably ~/get_iplayer-2.82/get_iplayer.cgi .....

      If you want this to run at startup, have a look at this post, www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html

      Delete
  3. I seem to have set everything up great... until I try and run the web gui... I don't get any errors but I don't get any web browsers popping up!
    I've just put the command into a terminal on the LDXE, was this right?

    ReplyDelete
    Replies
    1. Yes, you put the command into the Terminal window, this starts up the WebUI server, you then need to open a browser window and goto:
      http://:1935

      Delete

Note: only a member of this blog may post a comment.