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

Applies formatting changes, fixes VTT output #36

Merged
merged 4 commits into from
Sep 9, 2021

Conversation

shasheene
Copy link
Contributor

Now that all existing PR's have been merged, I have applied the codebase formatting changes on top based on the editorconfig stuff, and tidied things up a bit.

Also I noticed the VTT subtitle format has always been broken (see commit message) so I've fixed that up too.

Applies the .editorconfig auto-formatter updates now that all existing Pull
Requests and tasks have been resolved.

This was done done using Pycharm: for each Python file, add character, save
(which applies the .editorconfig automatically), then delete the added
character and save again.

Ref abhirooptalasila#30
Applies the Jetbrain Pycharm feature of autoformatting whitespace now that all
existing PR's have been merged.

Ref abhirooptalasila#30
Uses Pycharm to remove unused imports (and re-order existing ones), which can
be cleanly applied now that all existing PR's have been merged.

Ref abhirooptalasila#30
The VTT file format has being incorrectly generated for at least a few months,
but more likely since the feature was first added.

This commit:

* Removes the duplication (double the subtitles) due to the code first writing
  a line without the cue data, then the line with the cue data. The line
  without the cue data is not required.

* Fixes the number of milliseconds digits to always be 3 instead of the 0 or 5
  digits that the str(timedelta) function otherwise provides.

* Outputs VTT subtitles that are much closer to the YouTube autogenerated
  subtitle cue timings.

Testing the actual cue timings is difficult: very few video players appear to
process the cue timings. VLC does not appear to. On subtitles downloaded from
YouTube sometimes it looks like it does, but it's actually a separate subtitle
being displayed where the content moved from the second line to the first line.

But this commit at least makes the VTT output match subtitles downloaded from
YouTube much more closely.
@abhirooptalasila abhirooptalasila merged commit b053484 into abhirooptalasila:master Sep 9, 2021
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