Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream_info.closed_captions returns "cc" instead of cc #122

Closed
mbakholdina opened this issue Jul 10, 2018 · 1 comment
Closed

stream_info.closed_captions returns "cc" instead of cc #122

mbakholdina opened this issue Jul 10, 2018 · 1 comment

Comments

@mbakholdina
Copy link

stream_info.closed_captions returns "cc" instead of cc without quotation marks

#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=768647,CODECS="avc1.4d001f,mp4a.40.2",RESOLUTION=480x270,CLOSED-CAPTIONS="cc",SUBTITLES="sub",AUDIO="aud"
http://10.129.6.151:8080/dump/video_4/video_4.m3u8
@cdunklau
Copy link
Contributor

Here's a reproduction for this. I suspect the ultimate culprit is that the parser appears to only deal with strings, so it has no real notion of types (e.g. quoted-string, enumerated-string).

import pytest

import m3u8

SIMPLE_STREAM_INF = """#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=768647,CODECS="avc1.4d001f,mp4a.40.2",RESOLUTION=480x270,CLOSED-CAPTIONS="cc",SUBTITLES="sub",AUDIO="aud"
http://10.129.6.151:8080/dump/video_4/video_4.m3u8
"""

@pytest.fixture
def stream_inf():
    stream_inf_tags = m3u8.loads(SIMPLE_STREAM_INF).playlists
    assert len(stream_inf_tags) == 1
    return stream_inf_tags[0]


def test_codecs_not_quoted(stream_inf):
    assert stream_inf.stream_info.codecs == 'avc1.4d001f,mp4a.40.2'

def test_closed_captions_not_quoted(stream_inf):
    assert stream_inf.stream_info.closed_captions == 'cc'

The codecs aren't quoted, but the closed captions id is:

repro_cc_not_quoted.py .Fxx                                                  [100%]

===================================== FAILURES =====================================
_________________________ test_closed_captions_not_quoted __________________________

stream_inf = <m3u8.model.Playlist object at 0x10ab00240>

    def test_closed_captions_not_quoted(stream_inf):
>       assert stream_inf.stream_info.closed_captions == 'cc'
E       assert '"cc"' == 'cc'
E         - "cc"
E         + cc

repro_cc_not_quoted.py:22: AssertionError
================== 1 failed, 1 passed, 2 xfailed in 0.13 seconds ===================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants