mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-24 04:02:36 +01:00
29 lines
1.0 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|