From 32b76d007d797eb5cb1d043fdeaf3066ce2431e2 Mon Sep 17 00:00:00 2001 From: Dave Johansen Date: Tue, 6 Feb 2024 15:04:26 -0700 Subject: [PATCH 1/2] Parse as float and then round to int (fixes #355) --- m3u8/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m3u8/model.py b/m3u8/model.py index c855469f..c22b7fd1 100644 --- a/m3u8/model.py +++ b/m3u8/model.py @@ -959,7 +959,7 @@ def __init__(self, uri, stream_info, media, base_uri): if resolution is not None: resolution = resolution.strip('"') values = resolution.split("x") - resolution_pair = (int(values[0]), int(values[1])) + resolution_pair = (int(round(float(values[0]))), int(round(float(values[1])))) else: resolution_pair = None From 3cf8253c11bdc3e4a4d9407f2cc04afbf78e54f7 Mon Sep 17 00:00:00 2001 From: Dave Johansen Date: Tue, 6 Feb 2024 15:06:04 -0700 Subject: [PATCH 2/2] Make ruff happy --- m3u8/model.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/m3u8/model.py b/m3u8/model.py index c22b7fd1..bb339989 100644 --- a/m3u8/model.py +++ b/m3u8/model.py @@ -959,7 +959,10 @@ def __init__(self, uri, stream_info, media, base_uri): if resolution is not None: resolution = resolution.strip('"') values = resolution.split("x") - resolution_pair = (int(round(float(values[0]))), int(round(float(values[1])))) + resolution_pair = ( + int(round(float(values[0]))), + int(round(float(values[1]))), + ) else: resolution_pair = None