aussieaddons / plugin.video.sbs

SBS On Demand add-on for Kodi
http://aussieaddons.com/addons/sbs/
GNU General Public License v3.0
10 stars 8 forks source link

Bandwidth settings occasionally broken by unexpected stream URLs #1282

Open natumbri opened 5 years ago

natumbri commented 5 years ago

Occasionally, SBS on Demand returns a stream URL that is not in the standard format. For example, Das Boot S1, E7.

The URL for Das Boot S1, E6 is, as expected, http://sbsvodns-vh.akamaihd.net/i/vod/SBS_Production/managed/2018/12/10/630546_,1500,1000,512,128,K.mp4.csmil/master.m3u8?__b__=500&b=0-2000&__a__=off&set-akamai-hls-revision=5

However, the URL for Das Boot S1, E7 is http://videocdn.sbs.com.au/u/video/SBS_Production/managed/2018/12/10/630547_1500K.mp4

The URL for E7 does not include a &b=n-nnnn field, and so breaks bandwidth selection.

A way around this is to replace the 1500 at the end of the URL with the size of the stream you want. So, if you want Das Boot S1 E7 in 512Kb/s, the revised URL would be http://videocdn.sbs.com.au/u/video/SBS_Production/managed/2018/12/10/630547_512K.mp4

Including something like the following in play.py would probably fix it:

    if ('videocdn' in stream_url):    #and/or '&b=' not in stream_url?
        if bandwidth == '0':                                                                                         
            stream_url = re.sub(r'_\d{3,4}K\.mp4', '_512K.mp4', stream_url)                                            
        elif bandwidth == '1':                                                                                         
            stream_url = re.sub(r'_\d{3,4}K\.mp4', '_1000K.mp4', stream_url)

I have no idea how often this happens, or whether - when it does - it is consistent.

Cheers, Nik