SubtitleEdit/libse/NetflixQualityCheck/NetflixCheckNumberOfLines.cs
2017-11-26 17:35:00 +01:00

29 lines
1.0 KiB
C#

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)
{
if (p.Text.SplitToLines().Count > 2)
{
var fixedParagraph = new Paragraph(p, false);
fixedParagraph.Text = Utilities.AutoBreakLine(fixedParagraph.Text, controller.SingleLineMaxLength, controller.SingleLineMaxLength - 3, controller.Language);
if (fixedParagraph.Text.SplitToLines().Count > 2)
{
fixedParagraph = null; // cannot fix text
}
string comment = "Two lines maximum";
controller.AddRecord(p, fixedParagraph, comment);
}
}
}
}
}