I should convert a file with some text to a new text file (extension .srt) with a specific format, so that I can import it as subtitles into video production software.
This is an example of the source text file:
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Cras libero urna, consectetur ac libero sed, feugiat commodo
Praesent eget venenatis tellus, vel pellentesque.
Mauris ligula orci, ornare ut pharetra a, mattis quis
purus. Vestibulum ante ipsum primis in faucibus orci luctus
et ultrices posuere cubilia curae; Sed placerat scelerisque
ante ut volutpat. Curabitur placerat efficitur libero ut
Each line is separated by a line break, each subtitle is separated by a blank line.
The result, from the text above, should be this:
1
00:00:00,000 --> 00:00:03,000
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Cras libero urna, consectetur ac libero sed, feugiat commodo
2
00:00:03,000 --> 00:00:06,000
Praesent eget venenatis tellus, vel pellentesque.
3
00:00:06,000 --> 00:00:09,000
Mauris ligula orci, ornare ut pharetra a, mattis quis
purus. Vestibulum ante ipsum primis in faucibus orci luctus
4
00:00:09,000 --> 00:00:12,000
et ultrices posuere cubilia curae; Sed placerat scelerisque
ante ut volutpat. Curabitur placerat efficitur libero ut
Each subtitle starts with the subtitle number (starts from 1 and increment by 1)
the second line must contain the start time code (hh:mm:ss,mms), the string " --> " and the end time code.
Each timecode must be greater than three seconds than the previous one.
On the next line(s) the subtitle text.
I use KM for various things, but this is a little more complex than usual, I guess it will also need a dedicated script in AppleScript (?) ...
Thanks for the help!