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 a debug option to astisub to output informations on a subtitle #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dlecorfec
Copy link
Contributor

Hello!

This PR adds a "-d" option to the astisub command, which sets a bool in the option struct passed to Open().
On reading a STL file, outputs to stdout:

  • some values of the GSI block
  • subtitle lines with their number, start time, end time, vertical position and number of line (and exclamation marks if something odd in timestamps)
  • the total number of errors encountered

It is designed for the interactive human user, no concern has been given to automatic parsing of this output.

STL:GSIBlock
STL:  DisplayStandardCode:0x31
STL:  TotalNumberOfTTIBlocks:959
STL:  TotalNumberOfSubtitleGroups:1
STL:  TotalNumberOfSubtitles:959
STL:
STL: #0000   00000.080 - 00002.000   vp=22	lines=1 [*Thème musical de l'émission]
STL: #0001   00002.200 - 00004.800   vp=22	lines=1 [...]
STL: #0002   00005.000 - 00008.760   vp=20	lines=2 [-Mais oui ! Mais oui, les petits potes sont là,]
[...]
STL: #0378 ! 00990.560 - 00988.640 ! vp=16	lines=1 [avant celui pour le public belge.]
[...]
STL: #0958   02614.560 - 02618.400   vp=20	lines=2 [Sous-titrage ST' 501]
STL: 1 error(s)

Maybe it would be a better idea to do the lines output at the end of subtitles.go:Open, so it would be common to all kinds of subtitles and not clutter stl.go.

An unoprotected global struct keeps the debug state: debug is not really meant to be enabled when using astisub as a lib.

Not sure if it's worth being incorporated in astisub, but I keep going back to that debug output when problems are signaled in our subs ;)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 76.083% when pulling 9875f49 on dlecorfec:add-debug-mode into aa9412f on asticode:master.

@asticode
Copy link
Owner

To be honest, I don't feel comfortable enough to incorporate that logic in the lib right now. I'll keep the idea in mind and see if I come up with a way that could fit the lib's purpose better

@dlecorfec
Copy link
Contributor Author

No worry ;) Thanks.

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.

None yet

3 participants