Skip to content

Commit

Permalink
Parse Bitrate value as integer not string
Browse files Browse the repository at this point in the history
  • Loading branch information
davemevans committed Aug 7, 2024
1 parent f9360bd commit 2ea7a34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion m3u8/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def _parse_variant_playlist(line, data, state, **kwargs):
def _parse_bitrate(line, state, **kwargs):
if "segment" not in state:
state["segment"] = {}
state["segment"]["bitrate"] = line.replace(protocol.ext_x_bitrate + ":", "")
state["segment"]["bitrate"] = _parse_simple_parameter(line, cast_to=int, **kwargs)


def _parse_byterange(line, state, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,8 @@ def test_delta_playlist_daterange_skipping():

def test_bitrate():
data = m3u8.parse(playlists.BITRATE_PLAYLIST)
assert data["segments"][0]["bitrate"] == "1674"
assert data["segments"][1]["bitrate"] == "1625"
assert data["segments"][0]["bitrate"] == 1674
assert data["segments"][1]["bitrate"] == 1625


def test_content_steering():
Expand Down

0 comments on commit 2ea7a34

Please sign in to comment.