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

Srt html styling #121

Merged
merged 3 commits into from
Nov 20, 2024
Merged

Srt html styling #121

merged 3 commits into from
Nov 20, 2024

Conversation

justin-taylor
Copy link
Contributor

@justin-taylor justin-taylor commented Nov 15, 2024

This PR resurrects #96 The changes from the PR have been re-applied and made to work with the mast recent changes. For our use-case we often run into an srt file being uploaded with stylings that are then broken when converted to webvtt.

I believe all the comments that were apart of that PR have been addressed, but please let me know if other changes are needed.

Copy link
Owner

@asticode asticode left a comment

Choose a reason for hiding this comment

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

Thanks for picking up this PR ❤️

A few changes are needed for tests 👍

Copy link
Owner

Choose a reason for hiding this comment

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

Can you rename this file to example-in-styled.srt?

Copy link
Owner

Choose a reason for hiding this comment

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

Can you rename this file to example-out-styled.srt?

Copy link
Owner

Choose a reason for hiding this comment

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

Can you rename this file to example-out-styled.vtt?

srt_test.go Outdated
assert.Equal(t, string(c), w.String())
}

func TestReadSRTWriteWebVTTStyled(t *testing.T) {
Copy link
Owner

Choose a reason for hiding this comment

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

Can you not create a separate test for that and instead add writing to vtt at the end of TestSRTStyled?

srt_test.go Outdated
s, err := astisub.OpenFile("./testdata/example-styled-in.srt")
assert.NoError(t, err)
assertStyledSubtitleItems(t, s)
assertSRTSubtitleStyles(t, s)
Copy link
Owner

Choose a reason for hiding this comment

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

Can you not make it a function and instead test the style directly in this function? It shouldn't be used elsewhere

assert.Equal(t, "'The time is 7:35.'", i.Items[5].Lines[1].String())
}

func assertSRTSubtitleStyles(t *testing.T, i *astisub.Subtitles) {
Copy link
Owner

Choose a reason for hiding this comment

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

This function should be removed based on my previous comment

@justin-taylor
Copy link
Contributor Author

Thanks for picking up this PR ❤️

A few changes are needed for tests 👍

All comments have been addressed.

@asticode asticode merged commit cba5e0f into asticode:master Nov 20, 2024
1 check passed
@asticode
Copy link
Owner

Thanks for the PR! ❤️

Let me know whether you need a tag 👍

@justin-taylor justin-taylor deleted the srt-html-styling branch November 20, 2024 17:48
@justin-taylor
Copy link
Contributor Author

Thanks for the PR! ❤️

Let me know whether you need a tag 👍

A tag would be great! Thank you.

@asticode
Copy link
Owner

I've created a v0.30.0 tag 👍

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