From 1616e791578f57ef053d5558b4b0ffb2d394ee64 Mon Sep 17 00:00:00 2001 From: Leandro Moreira Date: Sun, 25 Sep 2022 11:56:52 -0300 Subject: [PATCH 1/7] Bump setup.py Fixes https://github.com/globocom/m3u8/issues/295 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 9469829e..d8345992 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name="m3u8", author='Globo.com', - version="3.2.0", + version="3.3.0", license='MIT', zip_safe=False, include_package_data=True, From ce911a122bc5b686101ac4c1af01d2ccbe727a40 Mon Sep 17 00:00:00 2001 From: Aditya Kapadiya <69302498+Aditya-Kapadiya@users.noreply.github.com> Date: Tue, 11 Oct 2022 22:55:42 +0530 Subject: [PATCH 2/7] Update .editorconfig Hello, Changed link having HTTP to HTTPS Thank You --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index dcff3510..c93dc363 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,4 @@ -# http://editorconfig.org +# https://editorconfig.org root = true [*.py] From fa8edb48e9cb11e44053bba986511d2f84389a46 Mon Sep 17 00:00:00 2001 From: Kuldeep Borkar Jr Date: Wed, 26 Oct 2022 12:18:16 +0530 Subject: [PATCH 3/7] Updated ReadMe file and added links to Supported tags --- README.rst | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index e5e9185f..f80803a4 100644 --- a/README.rst +++ b/README.rst @@ -57,7 +57,7 @@ Supported tags * `#EXT-X-KEY`_ * `#EXT-X-STREAM-INF`_ * `#EXT-X-VERSION`_ -* #EXT-X-ALLOW-CACHE +* `#EXT-X-ALLOW-CACHE`_ * `#EXT-X-ENDLIST`_ * `#EXTINF`_ * `#EXT-X-I-FRAMES-ONLY`_ @@ -73,11 +73,11 @@ Supported tags * `#EXT-X-INDEPENDENT-SEGMENTS`_ * `#EXT-X-MAP`_ * `#EXT-X-START`_ -* #EXT-X-SERVER-CONTROL -* #EXT-X-PART-INF -* #EXT-X-PART -* #EXT-X-RENDITION-REPORT -* #EXT-X-SKIP +* `#EXT-X-SERVER-CONTROL`_ +* `#EXT-X-PART-INF`_ +* `#EXT-X-PART`_ +* `#EXT-X-RENDITION-REPORT`_ +* `#EXT-X-SKIP`_ * `#EXT-X-SESSION-DATA`_ * `#EXT-X-PRELOAD-HINT`_ * `#EXT-X-SESSION-KEY`_ @@ -359,6 +359,7 @@ the same thing. .. _m3u8: https://tools.ietf.org/html/rfc8216 .. _#EXT-X-VERSION: https://tools.ietf.org/html/rfc8216#section-4.3.1.2 .. _#EXTINF: https://tools.ietf.org/html/rfc8216#section-4.3.2.1 +.. _#EXT-X-ALLOW-CACHE: https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-07#section-3.3.6 .. _#EXT-X-BITRATE: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.4.8 .. _#EXT-X-BYTERANGE: https://tools.ietf.org/html/rfc8216#section-4.3.2.2 .. _#EXT-X-DISCONTINUITY: https://tools.ietf.org/html/rfc8216#section-4.3.2.3 @@ -382,7 +383,12 @@ the same thing. .. _#EXT-X-PRELOAD-HINT: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.5.3 .. _#EXT-X-DATERANGE: https://tools.ietf.org/html/rfc8216#section-4.3.2.7 .. _#EXT-X-GAP: https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-05#section-4.4.2.7 -.. _#EXT-X-CONTENT-STEERING: https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-10#section-4.4.6.6 +.. _#EXT-X-CONTENT-STEERING: https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-10#section-4.4.6.64 +.. _#EXT-X-SKIP: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.5.2 +.. _#EXT-X-RENDITION-REPORT: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.5.4 +.. _#EXT-X-PART: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.4.9 +.. _#EXT-X-PART-INF: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.3.7 +.. _#EXT-X-SERVER-CONTROL: https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis#section-4.4.3.8 .. _issue 1: https://github.com/globocom/m3u8/issues/1 .. _variant streams: https://tools.ietf.org/html/rfc8216#section-6.2.4 .. _example here: http://tools.ietf.org/html/draft-pantos-http-live-streaming-08#section-8.5 From f6a6acb795d509d67e51e596316483ca4f5ddbaf Mon Sep 17 00:00:00 2001 From: Bo Bayles Date: Fri, 16 Dec 2022 08:43:41 -0600 Subject: [PATCH 4/7] Add Segment.media_Sequence --- m3u8/model.py | 7 ++++++- tests/test_model.py | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/m3u8/model.py b/m3u8/model.py index 050fcaa2..0b68be1e 100644 --- a/m3u8/model.py +++ b/m3u8/model.py @@ -174,6 +174,10 @@ def _initialize_attributes(self): for attr, param in self.simple_attributes: setattr(self, attr, self.data.get(param)) + if self.media_sequence is not None: + for i, segment in enumerate(self.segments, self.media_sequence): + segment.media_sequence = i + self.files = [] for key in self.keys: # Avoid None key, it could be the first one, don't repeat them @@ -448,7 +452,8 @@ def __init__(self, uri=None, base_uri=None, program_date_time=None, current_prog cue_out_start=False, cue_in=False, discontinuity=False, key=None, scte35=None, oatcls_scte35=None, scte35_duration=None, scte35_elapsedtime=None, asset_metadata=None, keyobject=None, parts=None, init_section=None, dateranges=None, gap_tag=None, - custom_parser_values=None): + media_sequence=None, custom_parser_values=None): + self.media_sequence = media_sequence self.uri = uri self.duration = duration self.title = title diff --git a/tests/test_model.py b/tests/test_model.py index 2b27b658..614b9912 100755 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -51,9 +51,9 @@ def test_target_duration_attribute(): def test_media_sequence_attribute(): obj = m3u8.M3U8(playlists.SIMPLE_PLAYLIST) - mock_parser_data(obj, {'media_sequence': '1234567'}) + mock_parser_data(obj, {'media_sequence': 1234567}) - assert '1234567' == obj.media_sequence + assert 1234567 == obj.media_sequence def test_program_date_time_attribute(): @@ -1430,6 +1430,11 @@ def test_add_content_steering_base_uri_update(): obj.base_uri = "https://yet-another.example.com/" assert obj.content_steering.absolute_uri == "https://yet-another.example.com/steering?video=00012" + +def test_segment_media_sequence(): + obj = m3u8.M3U8(playlists.SLIDING_WINDOW_PLAYLIST) + assert [s.media_sequence for s in obj.segments] == [2680, 2681, 2682] + # custom asserts From 71c45af488f8d65e73c7c29e1fc4c0baaeb9bfe4 Mon Sep 17 00:00:00 2001 From: Bo Bayles Date: Fri, 16 Dec 2022 08:45:36 -0600 Subject: [PATCH 5/7] Support default media sequence --- m3u8/model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/m3u8/model.py b/m3u8/model.py index 0b68be1e..223a6ce0 100644 --- a/m3u8/model.py +++ b/m3u8/model.py @@ -174,9 +174,8 @@ def _initialize_attributes(self): for attr, param in self.simple_attributes: setattr(self, attr, self.data.get(param)) - if self.media_sequence is not None: - for i, segment in enumerate(self.segments, self.media_sequence): - segment.media_sequence = i + for i, segment in enumerate(self.segments, self.media_sequence or 0): + segment.media_sequence = i self.files = [] for key in self.keys: From 39443ca294cb2b1f738a5bd5512283eb95bb9acb Mon Sep 17 00:00:00 2001 From: Bo Bayles Date: Fri, 16 Dec 2022 08:59:59 -0600 Subject: [PATCH 6/7] Update Python versions for GHA testing --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 08e0a750..e0e7708e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: # You can use PyPy versions in python-version. # For example, pypy2 and pypy3 matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] # Steps represent a sequence of tasks that will be executed as part of the job steps: From b2a1342c6cc42e41cde25ecf291dcef9b815f3e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Antunes?= Date: Wed, 28 Dec 2022 22:50:57 -0300 Subject: [PATCH 7/7] Release new version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d8345992..306294cb 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( name="m3u8", author='Globo.com', - version="3.3.0", + version="3.4.0", license='MIT', zip_safe=False, include_package_data=True,