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

Recursively split subtitles where spaces occur #5

Open
tympanix opened this issue Jul 16, 2018 · 1 comment
Open

Recursively split subtitles where spaces occur #5

tympanix opened this issue Jul 16, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@tympanix
Copy link
Owner

No description provided.

@tympanix tympanix added the enhancement New feature or request label Jul 16, 2018
@switchupcb
Copy link

With srt3, you can use the following code to split subtitles and remove the space between them (once the timestamps of the space are found):

# Finds all subtitles up to :05, and after :08 using srt3 (version 1.0.0)
import srt

# Parse the srt file at some point.
subs = srt.parse("subtitle content")

# Use the find method to filter out space.
space_start = srt.timestamp_to_timedelta("00:00:05,00")
space_end = srt.timestamp_to_timedelta("00:00:08,00")
new_subs = srt.tools.find.find_by_timestamp(subs, space_end, space_start) # returns a generator of subtitles

srt3 also performs 30% faster than pysrt on typical workloads.

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

No branches or pull requests

2 participants