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

Add timestamps class #65

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Add timestamps class #65

wants to merge 12 commits into from

Conversation

tkarabela
Copy link
Owner

@tkarabela tkarabela commented Jan 29, 2023

This pull request will implement #57.

@tkarabela tkarabela self-assigned this Jan 29, 2023
pysubs2/time.py Outdated
ValueError: fps was negative or zero.

"""
return Timestamps.from_fps(fps).frames_to_ms(frames)
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add the parameter to precise the TimeType

pysubs2/time.py Outdated
ValueError: fps was negative or zero.

"""
return Timestamps.from_fps(fps).ms_to_frames(ms)
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add the parameter to precise the TimeType

@@ -122,7 +122,7 @@ def ms_to_frames(ms: IntOrFloat, fps: float) -> int:
ValueError: fps was negative or zero.

"""
return Timestamps.from_fps(fps).ms_to_frames(ms)
return Timestamps.from_fps(cast(Real, fps)).ms_to_frames(int(ms))
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add the parameter to precise the TimeType

@@ -104,7 +104,7 @@ def frames_to_ms(frames: int, fps: float) -> int:
ValueError: fps was negative or zero.

"""
return Timestamps.from_fps(fps).frames_to_ms(frames)
return Timestamps.from_fps(cast(Real, fps)).frames_to_ms(frames)
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to add the parameter to precise the TimeType

continue
except ValueError:
raise UnknownFPSError("Framerate was not specified and "
"cannot be read from "
"the MicroDVD file.")

start, end = map(partial(frames_to_ms, fps=fps), (fstart, fend))
# I chose the format SRT, but it could be anyone.
# SRT simply has a precision in milliseconds which can be better.
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment need to be remove

@moi15moi
Copy link
Contributor

moi15moi commented Mar 5, 2023

@tkarabela You may wanna see what I added in my branch Add-timestamps-class-v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants