metadata for radio clips

Oliver Henshaw oliver.henshaw at gmail.com
Sun Feb 8 16:20:24 PST 2015


Using get_iplayer on a radio clip (an interview or live session from a
show, e.g.http://www.bbc.co.uk/programmes/p02hl10r linked from
http://www.bbc.co.uk/programmes/b04yqn36) I get a message "WARNING:
PID p02hl10r does not refer to an iPlayer programme episode. Download
may fail and metadata may be inaccurate" and I get a file with an
empty title, i.e.:

Radcliffe_and_Maconie_-__p02hl10r_default.m4a

whereas the main program is downloaded with a reasonable title.


I see that the http://www.bbc.co.uk/programmes/PID.xml for the clip
has all the correct information, including the episode title, which I
see is used to construct the filename. But the program type is "clip"
and the parent is the actual "episode".
http://www.bbc.co.uk/programmes/PID.rdf also has the episode title,
but get_iplayer doesn't pick this up (I didn't look too deeply into
why).

I got clip metadata download and so file naming working well enough
with the crude patch:

diff --git a/get_iplayer b/get_iplayer
index 8727579..8e5d242 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -5819,7 +5819,7 @@ sub get_metadata {
                if ( $xml ) {
                        my $doc = eval { XMLin($xml, KeyAttr => [],
ForceArray => 1, SuppressEmpty => 1) };
                        if ( ! $@ ) {
-                               if ( $doc->{type} eq "episode" ) {
+                               if ( $doc->{type} eq "episode" ||
$doc->{type} eq "clip" ) {
                                        my $parent =
$doc->{parent}->[0]->{programme}->[0];
                                        my $grandparent =
$parent->{parent}->[0]->{programme}->[0];
                                        my $greatgrandparent =
$grandparent->{parent}->[0]->{programme}->[0];

I don't know whether this is generally applicable to all types of
clip. Probably I should also check whether the parent mode is of type
"episode"?


The only thing wrong now is the "day" MP4 metadata is wrong. The
"clip" node in the xml doesn't have a first_broadcast_date value but
the parent episode node does (and it's correct). I'm not sure where
get_iplayer is getting the date from - there are some times in the rdf
file but they're from a different day, and the mp4 tag has a very
slightly different time to the rdf file. So I don't understand this.



More information about the get_iplayer mailing list