mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 06:52:35 +01:00
Can read yet another variant of FCP
This commit is contained in:
parent
0d6afcaab7
commit
2d8bc9f945
@ -136,7 +136,7 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
var sb = new StringBuilder();
|
||||
lines.ForEach(line => sb.AppendLine(line));
|
||||
string x = sb.ToString();
|
||||
if (!x.Contains("<fcpxml version=\"1.3\">"))
|
||||
if (!x.Contains("<fcpxml version=\"1.3\">") && !x.Contains("<fcpxml version=\"1.2\">"))
|
||||
return;
|
||||
|
||||
var xml = new XmlDocument();
|
||||
@ -160,6 +160,33 @@ namespace Nikse.SubtitleEdit.Logic.SubtitleFormats
|
||||
_errorCount++;
|
||||
}
|
||||
}
|
||||
if (subtitle.Paragraphs.Count == 0)
|
||||
{
|
||||
foreach (XmlNode node in xml.SelectNodes("fcpxml/project/sequence/spine/clip/title/text"))
|
||||
{
|
||||
try
|
||||
{
|
||||
string text = node.ParentNode.InnerText;
|
||||
Paragraph p = new Paragraph();
|
||||
p.Text = text.Trim();
|
||||
p.StartTime = DecodeTime(node.ParentNode.Attributes["offset"]);
|
||||
p.EndTime.TotalMilliseconds = p.StartTime.TotalMilliseconds + DecodeTime(node.ParentNode.Attributes["duration"]).TotalMilliseconds;
|
||||
bool add = true;
|
||||
if (subtitle.Paragraphs.Count > 0)
|
||||
{
|
||||
var prev = subtitle.Paragraphs[subtitle.Paragraphs.Count - 1];
|
||||
if (prev.Text == p.Text && prev.StartTime.TotalMilliseconds == p.StartTime.TotalMilliseconds)
|
||||
add = false;
|
||||
}
|
||||
if (add)
|
||||
subtitle.Paragraphs.Add(p);
|
||||
}
|
||||
catch
|
||||
{
|
||||
_errorCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
subtitle.Renumber(1);
|
||||
}
|
||||
catch
|
||||
|
Loading…
Reference in New Issue
Block a user