Talk:Sync subtitles

From Rosetta Code
Revision as of 06:24, 20 June 2024 by Jgrprior (talk | contribs) (→‎Corner cases: Fix typos)

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)