2017-03-24 21:47:13 +01:00
|
|
|
|
namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck
|
|
|
|
|
{
|
|
|
|
|
public class NetflixCheckNumberOfLines : INetflixQualityChecker
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Two lines maximum
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Check(Subtitle subtitle, NetflixQualityController controller)
|
|
|
|
|
{
|
|
|
|
|
foreach (Paragraph p in subtitle.Paragraphs)
|
|
|
|
|
{
|
2017-11-26 17:35:00 +01:00
|
|
|
|
if (p.Text.SplitToLines().Count > 2)
|
2017-03-24 21:47:13 +01:00
|
|
|
|
{
|
|
|
|
|
var fixedParagraph = new Paragraph(p, false);
|
2017-03-24 22:41:17 +01:00
|
|
|
|
fixedParagraph.Text = Utilities.AutoBreakLine(fixedParagraph.Text, controller.SingleLineMaxLength, controller.SingleLineMaxLength - 3, controller.Language);
|
2017-11-26 17:35:00 +01:00
|
|
|
|
if (fixedParagraph.Text.SplitToLines().Count > 2)
|
2017-03-24 21:47:13 +01:00
|
|
|
|
{
|
|
|
|
|
fixedParagraph = null; // cannot fix text
|
|
|
|
|
}
|
|
|
|
|
string comment = "Two lines maximum";
|
|
|
|
|
controller.AddRecord(p, fixedParagraph, comment);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|