Comments (3)
We need to add proper handling of inline timestamp tags indeed and I'd be happy to point you to the proper direction for a PR 👍
Here's what needs to be done:
- add a
StartAt time.Time
attribute to LineItem. Add(), Fragment() and similar methods, as well as their tests, would need to be updated as well to process this new attribute, but that would make this PR way more complicated and I wouldn't mind to do that part after merging your changes. It's up to you whether you want to update those methods as well in this PR. - in parseTextWebVTT, when processing an html tag, start by determining whether its content is a timestamp. If so, store it in a
startAt
variable. Later, when creating the LineItem, provide theStartAt
value as well. - finally, in LineItem.webVTTBytes(), if
!StartAt.IsZero()
append the proper webvtt tag - add a proper test for inline timestamp tags in
webvtt_test.go
Let me know whether you feel like updating Add()
, Fragment()
and similar methods. Again, I don't mind doing it myself after merging your PR, we'll just have to add the proper TODOs in the code if that's the case 👍
from go-astisub.
- in parseTextWebVTT, when processing an html tag, start by determining whether its content is a timestamp. If so, store it in a
startAt
variable. Later, when creating the LineItem, provide theStartAt
value as well.
The html tokenizer doesn't actually recognise the timestamp tag as a start tag token, presumably because the first character after the <
is numeric. I'm guessing we would need to split the resultant text or tokenize it further. I've given it a brief go, but I suspect you might have a better idea.
Let me know whether you feel like updating
Add()
,Fragment()
and similar methods. Again, I don't mind doing it myself after merging your PR, we'll just have to add the proper TODOs in the code if that's the case 👍
Having had a quick look, I think it's probably beyond my current knowledge of the codebase, so I'd prefer to leave that as TODOs.
from go-astisub.
Having had a quick look, I think it's probably beyond my current knowledge of the codebase, so I'd prefer to leave that as TODOs.
👍
The html tokenizer doesn't actually recognise the timestamp tag as a start tag token, presumably because the first character after the < is numeric. I'm guessing we would need to split the resultant text or tokenize it further. I've given it a brief go, but I suspect you might have a better idea.
Splitting the input text at the start of parseTextWebVTT
based on inline timestamp tags seems like a good idea. We would then have to loop through split items to run the existing logic 👍
from go-astisub.
Related Issues (20)
- clean up go.sum
- func formatDuration has a bug will to output wrong result HOT 4
- Add support for linear correction HOT 2
- DVD Studio Pro reader and writer
- iTunes Timed Text reader and writer
- not support .ass file? HOT 4
- Populate originalEpisodeTitle and originalProgramTitle for STL file convertion HOT 4
- Can go-astisub parse HDMV/PGS subtitle? HOT 1
- convert ass subtitle contains more than one language to vtt fail HOT 6
- Can't change fontColor for STL file HOT 2
- TTML text parsing issues with new lines HOT 1
- What to expect to be supported by ttml parser? HOT 5
- Support AddItem(s) and RemoveItem(s) HOT 2
- Handle dot as well for SRT files HOT 1
- Subtitles.go String() - why are subtitle lines joined with a " - ", instead of a new line ("\n")? HOT 3
- Escape problem when convert from other formats to VTT, and from VTT to other formats HOT 11
- Example usage ReadFromSRT in the README is incorrect HOT 4
- Broken VTT styling in output (0.26.0 only) HOT 3
- The indexes always are zero (v0.26.1 only) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-astisub.