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)
Return to "Sync subtitles" page.