mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Now allows a variation of timecodes in Spruce Subtitle format
git-svn-id: https://subtitleedit.googlecode.com/svn/trunk@511 99eadd0c-20b8-1223-b5c4-2a2b2df33de2
This commit is contained in:
parent
66ba64a24d
commit
05ffdc7725
@ -107,6 +107,7 @@ $ColorIndex4 = 3
|
||||
//00:01:54:19,00:01:56:17,We should be thankful|they accepted our offer.
|
||||
subtitle.Paragraphs.Clear();
|
||||
var regexTimeCodes = new Regex(@"^\d\d:\d\d:\d\d:\d\d,\d\d:\d\d:\d\d:\d\d,.+", RegexOptions.Compiled);
|
||||
var regexTimeCodes2 = new Regex(@"^\d\d:\d\d:\d\d:\d\d, \d\d:\d\d:\d\d:\d\d,.+", RegexOptions.Compiled);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (regexTimeCodes.IsMatch(line))
|
||||
@ -124,6 +125,21 @@ $ColorIndex4 = 3
|
||||
_errorCount++;
|
||||
}
|
||||
}
|
||||
else if (regexTimeCodes2.IsMatch(line))
|
||||
{
|
||||
string start = line.Substring(0, 11);
|
||||
string end = line.Substring(13, 11);
|
||||
|
||||
try
|
||||
{
|
||||
Paragraph p = new Paragraph(DecodeTimeCode(start), DecodeTimeCode(end), DecodeText(line.Substring(25).Trim()));
|
||||
subtitle.Paragraphs.Add(p);
|
||||
}
|
||||
catch
|
||||
{
|
||||
_errorCount++;
|
||||
}
|
||||
}
|
||||
else if (line.Trim().Length > 0 && !line.StartsWith("//") && !line.StartsWith("$"))
|
||||
{
|
||||
_errorCount++;
|
||||
|
Loading…
Reference in New Issue
Block a user