How to use the m3u8.model.SessionData function in m3u8

To help you get started, we’ve selected a few m3u8 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github globocom / m3u8 / tests / test_model.py View on Github external
def test_session_data_with_uri():
    obj = SessionData(
        'com.example.value',
        uri='example.json',
        language='en'
    )

    result = obj.dumps()
    expected = '#EXT-X-SESSION-DATA:DATA-ID="com.example.value",URI="example.json",LANGUAGE="en"'

    assert result == expected
github globocom / m3u8 / tests / test_model.py View on Github external
def test_session_data_cannot_be_created_with_value_and_uri_at_the_same_time():
    obj = SessionData(
        'com.example.value',
        value='example',
        uri='example.json',
        language='en'
    )

    result = obj.dumps()
    expected = '#EXT-X-SESSION-DATA:DATA-ID="com.example.value",VALUE="example",LANGUAGE="en"'

    assert result == expected
github globocom / m3u8 / tests / test_model.py View on Github external
def test_session_data_with_value():
    obj = SessionData(
        'com.example.value',
        'example',
        language='en'
    )

    result = obj.dumps()
    expected = '#EXT-X-SESSION-DATA:DATA-ID="com.example.value",VALUE="example",LANGUAGE="en"'

    assert result == expected
github globocom / m3u8 / m3u8 / model.py View on Github external
start = self.data.get('start', None)
        self.start = start and Start(**start)

        server_control = self.data.get('server_control', None)
        self.server_control = server_control and ServerControl(**server_control)

        part_inf = self.data.get('part_inf', None)
        self.part_inf = part_inf and PartInformation(**part_inf)

        skip = self.data.get('skip', None)
        self.skip = skip and Skip(**skip)

        self.rendition_reports = RenditionReportList([ RenditionReport(base_uri=self.base_uri, **rendition_report)
                                                  for rendition_report in self.data.get('rendition_reports', []) ])

        self.session_data = SessionDataList([ SessionData(**session_data)
                             for session_data in self.data.get('session_data', [])
                             if 'data_id' in session_data ])

        self.session_keys = [ SessionKey(base_uri=self.base_uri, **params) if params else None
                      for params in self.data.get('session_keys', []) ]

        preload_hint = self.data.get('preload_hint', None)
        self.preload_hint = preload_hint and PreloadHint(base_uri=self.base_uri, **preload_hint)