Talk:Sync subtitles: Difference between revisions

From Rosetta Code
Content added Content deleted
(Corner cases)
 
m (→‎Corner cases: Fix typos)
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 make me think that instead of:
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 lines
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

Revision as of 06:24, 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)