Why is '-- type radio' needed?

Vangelis forthnet northmedia1 at the.forthnet.gr
Thu Oct 15 17:52:29 PDT 2015


On Mon Oct 12 14:11:52 BST 2015, David Cantrell wrote:

> $ get_iplayer --pid b069b676 --type radio
>
> PIDs are unique, so there can not be, under any circumstances, both
> radio and TV programmes with the same PID, so there is no possible
> ambiguity if I leave out the '--type radio'.

Hello David, hope all's well with you...

Yes, the undisputed fact is that the PID string is (forever) uniquely tied
to a BBC programme, be it TV, Radio or (more recently) podcast.

 If you deem specifying the programme type (via --type=) when
downloading by PID is redundant (TBH, it's a legitimate expectation),
then you should register with SP's support forum at:

https://squarepenguin.co.uk/forums/

and then post a related request at the "Feature Requests" subforum:

https://squarepenguin.co.uk/forums/forum-7.html

Hopefully, dinkypumpkin will inform you about the
feasibility of such a feature...

As to the current behaviour in GiP 2.94:

If you leave the "--type" switch out of the "equation",
then GiP assumes it's "tv" (i.e. video-on-demand, VOD)
AND DOES NOT TRY/SEARCH OTHER PROGRAMME
TYPES (perhaps this behaviour could be changed
in a future release...).

Obviously, if you download via a search string,
--type is needed to instruct GiP to search against
the proper cache; but even when --pid is used
(no matter if it's in the corresponding cache or not),
--type is needed because for a given PID value,
different parts of the code are used depending on
the specified programme type; it appears GiP
can't figure out on its own that the given PID
is for a radio (audio) programme, the default
behaviour is to assume it's for VOD if --type is empty.

-----------------------------------------------
GiP already parses
http://www.bbc.co.uk/programmes/[PID].rdf
and possibly
http://www.bbc.co.uk/programmes/[PID].xml
to retrieve metadata for a given PID
(namely the version PID - vpid, which is used to
gain access to stream data - and various other
tag related info...).
While the RDF URL does not contain an
obvious programme type identifier, the XML one
does contain the <media_type> tag:

<media_type>audio_video</media_type> => --type=tv
<media_type>audio</media_type> => --type=radio

This logic could be used in a patch so that
GiP could correctly identify a --pid value
belongs to AOD.

 One issue that does arise from this logic is
that with the recent Audio Factory changes,
podcast PIDs (e.g.  p03462bt) also carry the
<media_type>audio</media_type> tag...
In that case, GiP would treat it as radio and
fetch an M4A file, instead of an MP3 -
or GIP could be patched further to also look for the
<type>Podcast version</type> tag inside the
.XML file and then use a different "mediaselector/5" URL

http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/audio-nondrm-download/vpid/

to fetch the MP3 podcast file via --pid.
Of course, all this is "paper drawings" from a
non-coder, in practice it could be difficult to implement...
-----------------------------------------------

Two examples with GiP 2.94:

1. pid=b06gqf64 (radio, within radio.cache)

C:\Program Files\get_iplayer>get_iplayer --pid=b06gqf64
get_iplayer v2.94, Copyright (C) 2008-2010 Phil Lewis
  This program comes with ABSOLUTELY NO WARRANTY; for details 
use --warranty.
  This is free software, and you are welcome to redistribute it under 
certain
  conditions; use --conditions for details.

INFO: Episode-only pid detected
INFO: Trying pid: b06gqf64 using type: tv
INFO: Trying to stream pid using type tv
INFO: pid not found in tv cache
Matches:

INFO: 1 Matching Programmes
INFO: Checking existence of default version
INFO: No specified modes 
(flashvhigh,flashhigh,flashstd,flashnormal,flashlow) av
ailable for this programme with version 'default'
INFO: Try using --modes=flashaaclow,hlsaaclow
INFO: Checking existence of original version
INFO: No specified modes 
(flashvhigh,flashhigh,flashstd,flashnormal,flashlow) av
ailable for this programme with version 'original'
INFO: Try using --modes=flashaaclow,hlsaaclow
ERROR: Failed to record 'Annie Nightingale - J Sparrow and Zomboy 
(b06gqf64)'

So, without inputting --type=radio, no download is performed;
as per the instructions, I have to input --modes=flashaaclow
(or --modes=hlsaaclow) to get it; and mode shortcuts don't work either
(flash, flashaac, hls, hlsaac, best etc.).

2. pid=b06cw6r7 (radio, > 7d old, ergo not in the radio.cache)

You can test for yourself that simply issuing:

get_iplayer --pid=b06cw6r7

has the same effect as with previous radio pid;
it doesn't matter really, because GiP does not
touch the radio cache for either...

I honestly hope I've shed some more light
into "why is '--type=radio' needed" with the
current iteration of GiP...
If you feel this "need" should be done away with,
then please do as advised in the begining of this post...

Most kind regards,
Vangelis. 




More information about the get_iplayer mailing list