-
Notifications
You must be signed in to change notification settings - Fork 40
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
base: master
Are you sure you want to change the base?
Conversation
pysubs2/time.py
Outdated
ValueError: fps was negative or zero. | ||
|
||
""" | ||
return Timestamps.from_fps(fps).frames_to_ms(frames) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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
@tkarabela You may wanna see what I added in my branch Add-timestamps-class-v2 |
This pull request will implement #57.