Talk:Sync subtitles: Difference between revisions
Content added Content deleted
(Corner cases) |
(Commented) |
||
(One intermediate revision by one other user not shown) | |||
Line 3: | Line 3: | ||
Should we be concerned with subtitle text that contains <code>--></code> or (even less likely) <code><timestamp> --> <timestamp></code>? |
Should we be concerned with subtitle text that contains <code>--></code> or (even less likely) <code><timestamp> --> <timestamp></code>? |
||
Reading the [[wp:SubRip|Wikipedia]] description of the SubRip format |
Reading the [[wp:SubRip|Wikipedia]] description of the SubRip format makes me think that instead of: |
||
<pre> |
<pre> |
||
Line 19: | Line 19: | ||
expect a numeric counter and output the line |
expect a numeric counter and output the line |
||
next line |
next line |
||
expect a line containing start and end times and output adjusted |
expect a line containing start and end times and output adjusted line |
||
until next line is empty |
until next line is empty |
||
output the line |
output the line |
||
Line 25: | Line 25: | ||
Or something along those lines. --[[User:Jgrprior|Jgrprior]] ([[User talk:Jgrprior|talk]]) 14:43, 19 June 2024 (UTC) |
Or something along those lines. --[[User:Jgrprior|Jgrprior]] ([[User talk:Jgrprior|talk]]) 14:43, 19 June 2024 (UTC) |
||
:I was going to do it the way you suggest to start with but then I thought that the chance of <code><timestamp> —-> <timestamp></code> appearing in the subtitle itself was absolutely negligible and even if it did it would emerge as a date parsing error. After all subtitles are intended to be read by a human and —-> isn’t normal punctuation. So I went for the simpler approach as (I think) earlier solutions had done. --[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 07:10, 20 June 2024 (UTC) |
Latest revision as of 07:10, 20 June 2024
Corner cases
Should we be concerned with subtitle text that contains -->
or (even less likely) <timestamp> --> <timestamp>
?
Reading the Wikipedia description of the SubRip format makes me think that instead of:
for line in file if "-->" in line output line with adjusted time else output line
We should do:
while there are more lines expect a numeric counter and output the line next line expect a line containing start and end times and output adjusted line until next line is empty output the line
Or something along those lines. --Jgrprior (talk) 14:43, 19 June 2024 (UTC)
- I was going to do it the way you suggest to start with but then I thought that the chance of
<timestamp> —-> <timestamp>
appearing in the subtitle itself was absolutely negligible and even if it did it would emerge as a date parsing error. After all subtitles are intended to be read by a human and —-> isn’t normal punctuation. So I went for the simpler approach as (I think) earlier solutions had done. --PureFox (talk) 07:10, 20 June 2024 (UTC)