mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Read variant of "Google Play json" - thx Jasmine :)
This commit is contained in:
parent
7ac93a357c
commit
fcbb08b732
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Nikse.SubtitleEdit.Core.Forms.FixCommonErrors;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
@ -71,7 +72,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
continue;
|
||||
}
|
||||
|
||||
var text = string.Empty;
|
||||
var text = new StringBuilder();
|
||||
var start = -1d;
|
||||
var dur = -1d;
|
||||
foreach (var lineKey in line.Keys)
|
||||
@ -88,7 +89,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
{
|
||||
if (tk == "utf8")
|
||||
{
|
||||
text = string.Join(Environment.NewLine, textDic[tk].ToString().SplitToLines());
|
||||
text.Append(" " + string.Join(Environment.NewLine, textDic[tk].ToString().SplitToLines()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,15 +111,19 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(text) && dur > 0)
|
||||
{
|
||||
subtitle.Paragraphs.Add(new Paragraph(text, start, start + dur));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var subText = text.ToString()
|
||||
.Replace(" ", " ")
|
||||
.Replace(Environment.NewLine + " ", Environment.NewLine)
|
||||
.Trim();
|
||||
if (!string.IsNullOrEmpty(subText) && dur > 0)
|
||||
{
|
||||
subtitle.Paragraphs.Add(new Paragraph(subText, start, start + dur));
|
||||
}
|
||||
}
|
||||
}
|
||||
new FixOverlappingDisplayTimes().Fix(subtitle, new EmptyFixCallback());
|
||||
subtitle.Renumber();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user