Bug with "hlsaacmed" radiomode

Vangelis forthnet northmedia1 at the.forthnet.gr
Sun Jul 9 19:14:28 PDT 2017


 Hello one and all :-)

 As you might already know, The BBC World Service Radio
does not impose geo-filtering in its radiomodes, in fact the very
same audio streams are used for both UK and overseas consumption...

 Hence, no matter where in the globe you are,
using GiP 3.01 and issuing:

get_iplayer --type=radio --pid=p057fw7p -i | FindStr modes

(on Windows) will get you:
---------------------------------------------
modes:          original: 
dafmed1,dafmed2,dafmed3,dafmed4,daflow1,daflow2,daflow
3,daflow4,hafmed1,hafmed2,haflow1,haflow2,hlsaacmed1,hlsaaclow1
modesizes:      original: 
dafmed1=36MiB,dafmed2=36MiB,dafmed3=36MiB,dafmed4=36Mi
B,daflow1=18MiB,daflow2=18MiB,daflow3=18MiB,daflow4=18MiB,hafmed1=36MiB,hafmed2=
36MiB,haflow1=18MiB,haflow2=18MiB,hlsaacmed1=34MiB,hlsaaclow1=17MiB
---------------------------------------------

The *med* radiomodes (ca 36 MiB) are HE-AACv1 at 96kbps encodes,
while the *low* ones (half that size) are HE-AACv1 at 48kbps encodes.

Now, running

get_iplayer --type=radio --pid=p057fw7p

you'll get:
---------------------------------------------
INFO: 
dafmed1,dafmed2,dafmed3,dafmed4,hafmed1,hafmed2,daflow1,daflow2,daflow3,da
flow4,haflow1,haflow2,hlsaaclow1 modes will be tried for version original
INFO: Trying dafmed1 mode to record radio: Top of the Pops - 07/07/2017 GMT
(large snip)
INFO: Recorded: 36.73 MiB (00:53:00) [497] in 00:04:36 at 1.06 Mibit/s
---------------------------------------------

(the more observant among you
may have already spotted the bug...)

dafmed1 is fine, however a bit slow with
regards to my location; hafmed is equivalent
(or even slower) to dafmed, but the really
quick mode for me is hlsaac*.

HOWEVER, when I issued

get_iplayer --type=radio --pid=p057fw7p --modes=hlsaac

I got:
---------------------------------------------
INFO: hlsaaclow1 modes will be tried for version original
INFO: Trying hlsaaclow1 mode to record radio: Top of the Pops - 07/07/2017 
GMT
---------------------------------------------

i.e. the lower quality (48kbps) started fetching,
not the medium (in this case highest) at 96kbps :-(
The same thing happens when I set "hlsaacbest"
(instead of simply "hls" or "hlsaac").
OF COURSE, explicitly asking for
--radiomode=hlsaacmed works, but this is
just a workaround for existing bug...

 I had a quick browse of the code, first I added
"hlsaacmed" to the quality shortcuts by modifying lines

 $mlist = main::expand_list($mlist, 'hlsaacvgood', 'hlsaacstd,hlsaacgood');
-$mlist = main::expand_list($mlist, 'hlsaacgood', 'hlsaacworse');
+$mlist = main::expand_list($mlist, 'hlsaacgood', 'hlsaacmed,hlsaacworse');

and

 $mlist = main::expand_list($mlist, 'radiovgood', 
'dafstd,hafstd,hlsaacstd,radiogood');
-$mlist = main::expand_list($mlist, 'radiogood', 
'dafmed,hafmed,radioworse');
+$mlist = main::expand_list($mlist, 'radiogood', 
'dafmed,hafmed,hlsaacmed,radioworse');

and then added "hlsaacmed" to the default
radiomodes by changing:

-radiomode => [ 1, "radiomode|amode=s", 'Recording', '--radiomode 
<mode>,<mode>,...', "Radio recording modes (overrides --modes): 
dafhigh,dafstd,dafmed,daflow,hafhigh,hafstd,hafmed,haflow,hlsaacstd,hlsaaclow. 
Shortcuts: worst,worse,good,vgood,better,best,daf,haf,hlsaac 
(default=dafhigh,hafhigh,dafstd,hafstd,hlsaacstd,dafmed,hafmed,daflow,haflow,hlsaaclow)."],
+radiomode => [ 1, "radiomode|amode=s", 'Recording', '--radiomode 
<mode>,<mode>,...', "Radio recording modes (overrides --modes): 
dafhigh,dafstd,dafmed,daflow,hafhigh,hafstd,hafmed,haflow,hlsaacstd,hlsaacmed,hlsaaclow. 
Shortcuts: worst,worse,good,vgood,better,best,daf,haf,hlsaac 
(default=dafhigh,hafhigh,dafstd,hafstd,hlsaacstd,dafmed,hafmed,hlsaacmed,daflow,haflow,hlsaaclow)."],

Other parts of the code may need patching, too,
but now my local copy of 3.01 behaves as expected:

get_iplayer --type=radio --pid=p057fw7p --modes=hlsaacbest
---------------------------------------------
Matches:
24945:  Top of the Pops - 07/07/2017 GMT, BBC World Service, p057fw7p

INFO: 1 Matching Programmes
INFO: Checking existence of original version
INFO: hlsaacmed1,hlsaaclow1 modes will be tried for version original
INFO: Trying hlsaacmed1 mode to record radio: Top of the Pops - 07/07/2017 
GMT
INFO: File name prefix = Top_of_the_Pops_-_2017-07-07_GMT_p057fw7p_original
(large snip)
INFO: Recorded: 39.22 MiB (00:52:59) [318] in 00:00:41 at 7.65 Mibit/s
---------------------------------------------

(NB that hlsaacmed1 downloads 7x faster than dafmed1)

Regards,
Vangelis. 




More information about the get_iplayer mailing list