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

Parse as float and then round to int #356

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion m3u8/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(values[0]), int(values[1]))
resolution_pair = (
int(round(float(values[0]))),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just out of curiosity: is there any packager outputting manifests with decimal resolution?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some example files I was testing with that had 1280.0x720.0 but I'm not sure where they came from. ffmpeg outputs them as integers and I assume that most do as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no worries, thank you

int(round(float(values[1]))),
)
else:
resolution_pair = None

Expand Down
Loading