Shell script to get PIDs from schedules

Charles Johnson cehjohnson at gmail.com
Sun Nov 2 11:27:29 PST 2014


On 02/11/14 18:47, Sharon Kimble wrote:
> --8<---------------cut here---------------start------------->8---
> wget -q -O - http://www.bbc.co.uk/radio4/programmes/schedules/fm/this_week.json | jq '.[] | .[] | .[] | .[] | .programme as $P | $P.display_titles.title,$P.short_synopsis,$P.pid' | tail - 6
>
> --8<---------------cut here---------------end--------------->8---
Sharon - have a look at your tail command - it's missing an 'n'. Should be

wget -q -O - http://www.bbc.co.uk/radio4/programmes/schedules/fm/this_week.json | jq '.[] | .[] | .[] | .[] | .programme as $P | $P.display_titles.title,$P.short_synopsis,$P.pid' | tail -n 6

You might like to try the following, which will produce pipe-delimited
csv, which is like a mini version of the cache index:

 wget -q -O - http://www.bbc.co.uk/radio4/programmes/schedules/fm/this_week.json | jq '.[] | .[]  | .[] | .[] as $B | $B.programme as $P | $P.display_titles.title+"|"+$B.start+"|"+$B.end+"|"+$P.short_synopsis+"|"+$P.pid' | tr -d '"'

Having said all that, it looks like this is redundant really as
http://packages.hedgerows.org.uk/gip/get_iplayer.pl provides a patch
that uses the schedules to build an index. I have symlinked to that pro-tem.

Charles



More information about the get_iplayer mailing list