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 support for WebVTT #223

Merged
merged 6 commits into from
Jan 20, 2022
Merged

Add support for WebVTT #223

merged 6 commits into from
Jan 20, 2022

Conversation

joksas
Copy link

@joksas joksas commented Dec 20, 2021

I use https://www.iana.org/assignments/media-types/text/vtt for magic numbers, as suggested here.

I have very little experience with file signatures, so maybe that's stupid but I've excluded the fifth and last byte sequences in the link because they end with EOF; or is there a way to represent this using the existing functions?

Copy link
Owner

@gabriel-vasile gabriel-vasile left a comment

Choose a reason for hiding this comment

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

I think you should add the checks for EOF too because IANA recommends so.
Unfortunately prefix cannot handle EOF so you'll have to write Vtt function yourself, similar to zstd for example. You can use bytes.HasPrefix for non-EOF cases and bytes.Equal for EOF cases.

When it comes to MIME types and magic numbers IANA is THE authority, so I try to follow them as much as possible.

internal/magic/text.go Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jan 6, 2022

Coverage Status

Coverage remained the same at 96.407% when pulling ce457ac on joksas:vtt into e7d7726 on gabriel-vasile:master.

Copy link
Owner

@gabriel-vasile gabriel-vasile left a comment

Choose a reason for hiding this comment

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

Hi, sorry for the late reply. I left two suggestions.

internal/magic/text.go Outdated Show resolved Hide resolved
internal/magic/text.go Outdated Show resolved Hide resolved
@joksas
Copy link
Author

joksas commented Jan 19, 2022

Hi,

Thank you for the comments. Should be fine now, but please let me know if I need to change anything else.

@gabriel-vasile gabriel-vasile merged commit 568fc39 into gabriel-vasile:master Jan 20, 2022
@joksas joksas deleted the vtt branch January 20, 2022 17:24
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.

3 participants