diff --git a/LanguageMaster.xml b/LanguageMaster.xml index b00ac3d0c..3c8e1f039 100644 --- a/LanguageMaster.xml +++ b/LanguageMaster.xml @@ -2278,7 +2278,7 @@ Continue? Open report in folder Netflix quality check found {0:#,###} issues. Netflix quality check OK :) - Maximum {0} characters per second (excl. white spaces) + Maximum {0} characters per second (incl. white spaces) Maximum line length ({0}) Minimum duration: 5/6 second (833 ms) diff --git a/libse/Language.cs b/libse/Language.cs index b76e0c63e..887310bba 100644 --- a/libse/Language.cs +++ b/libse/Language.cs @@ -2586,7 +2586,7 @@ can edit in same subtitle file (collaboration)", ReportPrompt = "Please see full report here: {0}.", OpenReportInFolder = "Open report in folder", FoundXIssues = "Netflix quality check found {0:#,###} issues.", - MaximumXCharsPerSecond = "Maximum {0} characters per second (excl. white spaces)", + MaximumXCharsPerSecond = "Maximum {0} characters per second (incl. white spaces)", MaximumLineLength = "Maximum line length ({0})", MinimumDuration = "Minimum duration: 5/6 second (833 ms)", CheckOk = "Netflix quality check OK :)", diff --git a/libse/NetflixQualityCheck/NetflixCheckSceneChange.cs b/libse/NetflixQualityCheck/NetflixCheckSceneChange.cs new file mode 100644 index 000000000..3ce70d6d6 --- /dev/null +++ b/libse/NetflixQualityCheck/NetflixCheckSceneChange.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Nikse.SubtitleEdit.Core.SubtitleFormats; + +namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck +{ + public class NetflixCheckSceneChange : INetflixQualityChecker + { + /// + /// Check the newly-updated timing to Shot Changes rules. + /// https://partnerhelp.netflixstudios.com/hc/en-us/articles/360051554394-Timed-Text-Style-Guide-Subtitle-Timing-Guidelines + /// + public void Check(Subtitle subtitle, NetflixQualityController controller) + { + if (string.IsNullOrEmpty(controller.VideoFileName)) + { + return; + } + + var SceneChanges = SceneChangeHelper.FromDisk(controller.VideoFileName); + if (SceneChanges == null || SceneChanges.Count == 0) + { + controller.SceneChangesExist = false; + return; + } + + double twoFramesGap = 1000.0 / controller.FrameRate * 2.0; + var twelveFrames = SubtitleFormat.MillisecondsToFrames(1000.0 / controller.FrameRate * 12.0); + + foreach (Paragraph p in subtitle.Paragraphs) + { + var fixedParagraph = new Paragraph(p, false); + string comment = string.Empty; + + List previousStartSceneChanges = SceneChanges.Where(x => SubtitleFormat.MillisecondsToFrames(x * 1000) < SubtitleFormat.MillisecondsToFrames(p.StartTime.TotalMilliseconds)).ToList(); + List nextStartSceneChanges = SceneChanges.Where(x => SubtitleFormat.MillisecondsToFrames(x * 1000) > SubtitleFormat.MillisecondsToFrames(p.StartTime.TotalMilliseconds)).ToList(); + List previousEndSceneChanges = SceneChanges.Where(x => SubtitleFormat.MillisecondsToFrames(x * 1000) < SubtitleFormat.MillisecondsToFrames(p.EndTime.TotalMilliseconds)).ToList(); + List nextEndSceneChanges = SceneChanges.Where(x => SubtitleFormat.MillisecondsToFrames(x * 1000) > SubtitleFormat.MillisecondsToFrames(p.EndTime.TotalMilliseconds)).ToList(); + List onSceneChange = SceneChanges.Where(x => SubtitleFormat.MillisecondsToFrames(x * 1000) == SubtitleFormat.MillisecondsToFrames(p.EndTime.TotalMilliseconds)).ToList(); ; + + if (previousStartSceneChanges.Count > 0) + { + double nearestStartPrevSceneChange = previousStartSceneChanges.Aggregate((x, y) => Math.Abs(x - p.StartTime.TotalSeconds) < Math.Abs(y - p.StartTime.TotalSeconds) ? x : y); + if (SubtitleFormat.MillisecondsToFrames(p.StartTime.TotalMilliseconds - nearestStartPrevSceneChange * 1000) < twelveFrames) + { + fixedParagraph.StartTime.TotalMilliseconds = nearestStartPrevSceneChange * 1000; + comment = "The in-cue is 1-11 frames after the Shot Change"; + controller.AddRecord(p, fixedParagraph, comment); + } + } + + if (nextStartSceneChanges.Count > 0) + { + double nearestStartNextSceneChange = nextStartSceneChanges.Aggregate((x, y) => Math.Abs(x - p.StartTime.TotalSeconds) < Math.Abs(y - p.StartTime.TotalSeconds) ? x : y); + if (SubtitleFormat.MillisecondsToFrames(nearestStartNextSceneChange * 1000 - p.StartTime.TotalMilliseconds) < twelveFrames) + { + fixedParagraph.StartTime.TotalMilliseconds = nearestStartNextSceneChange * 1000; + comment = "The in-cue is 1-11 frames before the Shot Change"; + controller.AddRecord(p, fixedParagraph, comment); + } + } + + if (previousEndSceneChanges.Count > 0) + { + double nearestEndPrevSceneChange = previousEndSceneChanges.Aggregate((x, y) => Math.Abs(x - p.EndTime.TotalSeconds) < Math.Abs(y - p.EndTime.TotalSeconds) ? x : y); + if (SubtitleFormat.MillisecondsToFrames(p.EndTime.TotalMilliseconds - nearestEndPrevSceneChange * 1000) < twelveFrames) + { + fixedParagraph.EndTime.TotalMilliseconds = nearestEndPrevSceneChange * 1000 - twoFramesGap; + comment = "The out-cue is 1-11 frames after the Shot Change"; + controller.AddRecord(p, fixedParagraph, comment); + } + } + + if (onSceneChange.Count > 0) + { + fixedParagraph.EndTime.TotalMilliseconds = onSceneChange[0] * 1000 - twoFramesGap; + comment = "The out-cue is on the Shot Change"; + controller.AddRecord(p, fixedParagraph, comment); + } + } + } + } +} diff --git a/libse/NetflixQualityCheck/NetflixCheckTwoFramesGap.cs b/libse/NetflixQualityCheck/NetflixCheckTwoFramesGap.cs index 29f4f5a16..6b337790c 100644 --- a/libse/NetflixQualityCheck/NetflixCheckTwoFramesGap.cs +++ b/libse/NetflixQualityCheck/NetflixCheckTwoFramesGap.cs @@ -1,4 +1,6 @@ -namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck +using Nikse.SubtitleEdit.Core.SubtitleFormats; + +namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck { public class NetflixCheckTwoFramesGap : INetflixQualityChecker { @@ -18,7 +20,7 @@ Paragraph p = subtitle.Paragraphs[index]; var next = subtitle.GetParagraphOrDefault(index + 1); double twoFramesGap = 1000.0 / controller.FrameRate * 2.0; - if (next != null && p.EndTime.TotalMilliseconds + twoFramesGap > next.StartTime.TotalMilliseconds) + if (next != null && SubtitleFormat.MillisecondsToFrames(p.EndTime.TotalMilliseconds + twoFramesGap) > SubtitleFormat.MillisecondsToFrames(next.StartTime.TotalMilliseconds)) { var fixedParagraph = new Paragraph(p, false) { EndTime = { TotalMilliseconds = next.StartTime.TotalMilliseconds - twoFramesGap } }; string comment = "Minimum two frames gap"; diff --git a/libse/NetflixQualityCheck/NetflixCheckWhiteSpace.cs b/libse/NetflixQualityCheck/NetflixCheckWhiteSpace.cs index c6ee6ee3a..e0c14c3b5 100644 --- a/libse/NetflixQualityCheck/NetflixCheckWhiteSpace.cs +++ b/libse/NetflixQualityCheck/NetflixCheckWhiteSpace.cs @@ -6,7 +6,7 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck { private static readonly Regex LineEndingSpaceBefore = new Regex(@"^( |\n|\r\n)[^\s]", RegexOptions.Compiled); private static readonly Regex LineEndingSpaceAfter = new Regex(@"[^\s]( |\n|\r\n)$", RegexOptions.Compiled); - private static readonly Regex SpacesBeforePunctuation = new Regex(@"[^\s]( |\n|\r\n)[!?).,]", RegexOptions.Compiled); + private static readonly Regex SpacesBeforePunctuation = new Regex(@"[^\s]( |\n|\r\n)[!?).,؟،]", RegexOptions.Compiled); private static readonly Regex TwoPlusConsequentSpaces = new Regex(@"( |\n|\r\n){2,}", RegexOptions.Compiled); private static void AddWhiteSpaceWarning(Paragraph p, NetflixQualityController report, int pos) diff --git a/libse/NetflixQualityCheck/NetflixQualityController.cs b/libse/NetflixQualityCheck/NetflixQualityController.cs index cbd96f29f..aef236ac9 100644 --- a/libse/NetflixQualityCheck/NetflixQualityController.cs +++ b/libse/NetflixQualityCheck/NetflixQualityController.cs @@ -12,6 +12,9 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck /// /// Two letter language code (e.g. "en" is English) /// + + public string VideoFileName { get; set; } = string.Empty; + public string Language { get; set; } = "en"; public double FrameRate { get; set; } = 24; @@ -99,11 +102,22 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck { return false; } + if (Language == "ar") // Arabic + { + return false; + } } return true; } } + public bool SceneChangesExist = true; + + public bool CheckShotChange + { + get => string.IsNullOrEmpty(VideoFileName) ? false : true; + } + public class Record { public string TimeCode { get; set; } @@ -219,7 +233,8 @@ namespace Nikse.SubtitleEdit.Core.NetflixQualityCheck new NetflixCheckTwoFramesGap(), new NetflixCheckBridgeGaps(), new NetflixCheckWhiteSpace(), - new NetflixCheckItalics() + new NetflixCheckItalics(), + new NetflixCheckSceneChange() }; } diff --git a/src/Forms/Main.cs b/src/Forms/Main.cs index 55f2763d5..3300f14e5 100644 --- a/src/Forms/Main.cs +++ b/src/Forms/Main.cs @@ -27037,7 +27037,7 @@ namespace Nikse.SubtitleEdit.Forms var messages = new List(); var reportFiles = new List(); - var netflixController = new NetflixQualityController { Language = language }; + var netflixController = new NetflixQualityController { Language = language, VideoFileName = _videoFileName }; if (!string.IsNullOrEmpty(_videoFileName) && _videoInfo != null && _videoInfo.FramesPerSecond > 20) { netflixController.FrameRate = _videoInfo.FramesPerSecond; @@ -27057,20 +27057,13 @@ namespace Nikse.SubtitleEdit.Forms { if (!isSaving) { - if (Configuration.Settings.General.ShowBetaStuff) + using (var form = new NetflixFixErrors(_subtitle, GetCurrentSubtitleFormat(), _fileName, _videoFileName)) { - using (var form = new NetflixFixErrors(_subtitle, GetCurrentSubtitleFormat(), _fileName)) + if (form.ShowDialog(this) == DialogResult.OK) { - if (form.ShowDialog(this) == DialogResult.OK) - { - } } } - else - { - dialog.ShowDialog(this); - } } else { diff --git a/src/Forms/NetflixFixErrors.Designer.cs b/src/Forms/NetflixFixErrors.Designer.cs index 424e45704..17164d573 100644 --- a/src/Forms/NetflixFixErrors.Designer.cs +++ b/src/Forms/NetflixFixErrors.Designer.cs @@ -31,6 +31,7 @@ this.groupBoxRules = new System.Windows.Forms.GroupBox(); this.checkBoxWhiteSpace = new System.Windows.Forms.CheckBox(); this.checkBoxMaxLineLength = new System.Windows.Forms.CheckBox(); + this.checkBoxSceneChange = new System.Windows.Forms.CheckBox(); this.checkBoxTtmlFrameRate = new System.Windows.Forms.CheckBox(); this.checkBoxNoItalics = new System.Windows.Forms.CheckBox(); this.checkBoxGapMin = new System.Windows.Forms.CheckBox(); @@ -66,6 +67,7 @@ this.groupBoxRules.Controls.Add(this.checkBoxGapBridge); this.groupBoxRules.Controls.Add(this.checkBoxWhiteSpace); this.groupBoxRules.Controls.Add(this.checkBoxMaxLineLength); + this.groupBoxRules.Controls.Add(this.checkBoxSceneChange); this.groupBoxRules.Controls.Add(this.checkBoxTtmlFrameRate); this.groupBoxRules.Controls.Add(this.checkBoxNoItalics); this.groupBoxRules.Controls.Add(this.checkBoxGapMin); @@ -83,7 +85,7 @@ this.groupBoxRules.Location = new System.Drawing.Point(12, 12); this.groupBoxRules.Name = "groupBoxRules"; this.groupBoxRules.Size = new System.Drawing.Size(1016, 248); - this.groupBoxRules.TabIndex = 106; + this.groupBoxRules.TabIndex = 0; this.groupBoxRules.TabStop = false; this.groupBoxRules.Text = "Rules"; // @@ -95,7 +97,7 @@ this.checkBoxWhiteSpace.Location = new System.Drawing.Point(409, 216); this.checkBoxWhiteSpace.Name = "checkBoxWhiteSpace"; this.checkBoxWhiteSpace.Size = new System.Drawing.Size(86, 17); - this.checkBoxWhiteSpace.TabIndex = 85; + this.checkBoxWhiteSpace.TabIndex = 17; this.checkBoxWhiteSpace.Text = "White space"; this.checkBoxWhiteSpace.UseVisualStyleBackColor = true; this.checkBoxWhiteSpace.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -108,11 +110,24 @@ this.checkBoxMaxLineLength.Location = new System.Drawing.Point(19, 193); this.checkBoxMaxLineLength.Name = "checkBoxMaxLineLength"; this.checkBoxMaxLineLength.Size = new System.Drawing.Size(130, 17); - this.checkBoxMaxLineLength.TabIndex = 40; + this.checkBoxMaxLineLength.TabIndex = 8; this.checkBoxMaxLineLength.Text = "Check max line length"; this.checkBoxMaxLineLength.UseVisualStyleBackColor = true; this.checkBoxMaxLineLength.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); // + // checkBoxSceneChange + // + this.checkBoxSceneChange.AutoSize = true; + this.checkBoxSceneChange.Checked = true; + this.checkBoxSceneChange.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxSceneChange.Location = new System.Drawing.Point(19, 216); + this.checkBoxSceneChange.Name = "checkBoxSceneChange"; + this.checkBoxSceneChange.Size = new System.Drawing.Size(130, 17); + this.checkBoxSceneChange.TabIndex = 9; + this.checkBoxSceneChange.Text = "Check timing to Shot Changes rules"; + this.checkBoxSceneChange.UseVisualStyleBackColor = true; + this.checkBoxSceneChange.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); + // // checkBoxTtmlFrameRate // this.checkBoxTtmlFrameRate.AutoSize = true; @@ -121,7 +136,7 @@ this.checkBoxTtmlFrameRate.Location = new System.Drawing.Point(409, 193); this.checkBoxTtmlFrameRate.Name = "checkBoxTtmlFrameRate"; this.checkBoxTtmlFrameRate.Size = new System.Drawing.Size(154, 17); - this.checkBoxTtmlFrameRate.TabIndex = 80; + this.checkBoxTtmlFrameRate.TabIndex = 16; this.checkBoxTtmlFrameRate.Text = "Check frame rate for TTML"; this.checkBoxTtmlFrameRate.UseVisualStyleBackColor = true; this.checkBoxTtmlFrameRate.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -134,7 +149,7 @@ this.checkBoxNoItalics.Location = new System.Drawing.Point(409, 170); this.checkBoxNoItalics.Name = "checkBoxNoItalics"; this.checkBoxNoItalics.Size = new System.Drawing.Size(109, 17); - this.checkBoxNoItalics.TabIndex = 75; + this.checkBoxNoItalics.TabIndex = 15; this.checkBoxNoItalics.Text = "Do not allow italic"; this.checkBoxNoItalics.UseVisualStyleBackColor = true; this.checkBoxNoItalics.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -147,7 +162,7 @@ this.checkBoxGapMin.Location = new System.Drawing.Point(19, 124); this.checkBoxGapMin.Name = "checkBoxGapMin"; this.checkBoxGapMin.Size = new System.Drawing.Size(168, 17); - this.checkBoxGapMin.TabIndex = 20; + this.checkBoxGapMin.TabIndex = 5; this.checkBoxGapMin.Text = "Frame gap: minimum 2 frames"; this.checkBoxGapMin.UseVisualStyleBackColor = true; this.checkBoxGapMin.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -160,7 +175,7 @@ this.checkBoxCheckValidGlyphs.Location = new System.Drawing.Point(409, 147); this.checkBoxCheckValidGlyphs.Name = "checkBoxCheckValidGlyphs"; this.checkBoxCheckValidGlyphs.Size = new System.Drawing.Size(330, 17); - this.checkBoxCheckValidGlyphs.TabIndex = 70; + this.checkBoxCheckValidGlyphs.TabIndex = 14; this.checkBoxCheckValidGlyphs.Text = "Only text/characters included in the Netflix Glyph List (version 2) "; this.checkBoxCheckValidGlyphs.UseVisualStyleBackColor = true; this.checkBoxCheckValidGlyphs.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -173,8 +188,8 @@ this.checkBox17CharsPerSecond.Location = new System.Drawing.Point(19, 101); this.checkBox17CharsPerSecond.Name = "checkBox17CharsPerSecond"; this.checkBox17CharsPerSecond.Size = new System.Drawing.Size(290, 17); - this.checkBox17CharsPerSecond.TabIndex = 15; - this.checkBox17CharsPerSecond.Text = "Maximum 17 characters per second (excl. white spaces)"; + this.checkBox17CharsPerSecond.TabIndex = 4; + this.checkBox17CharsPerSecond.Text = "Maximum 17 characters per second (incl. white spaces)"; this.checkBox17CharsPerSecond.UseVisualStyleBackColor = true; this.checkBox17CharsPerSecond.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); // @@ -185,7 +200,7 @@ this.comboBoxLanguage.Location = new System.Drawing.Point(77, 14); this.comboBoxLanguage.Name = "comboBoxLanguage"; this.comboBoxLanguage.Size = new System.Drawing.Size(196, 21); - this.comboBoxLanguage.TabIndex = 30; + this.comboBoxLanguage.TabIndex = 1; this.comboBoxLanguage.SelectedIndexChanged += new System.EventHandler(this.comboBoxLanguage_SelectedIndexChanged); // // labelLanguage @@ -194,7 +209,7 @@ this.labelLanguage.Location = new System.Drawing.Point(16, 17); this.labelLanguage.Name = "labelLanguage"; this.labelLanguage.Size = new System.Drawing.Size(55, 13); - this.labelLanguage.TabIndex = 8; + this.labelLanguage.TabIndex = 0; this.labelLanguage.Text = "Language"; // // checkBoxWriteOutOneToTen @@ -205,7 +220,7 @@ this.checkBoxWriteOutOneToTen.Location = new System.Drawing.Point(409, 124); this.checkBoxWriteOutOneToTen.Name = "checkBoxWriteOutOneToTen"; this.checkBoxWriteOutOneToTen.Size = new System.Drawing.Size(335, 17); - this.checkBoxWriteOutOneToTen.TabIndex = 60; + this.checkBoxWriteOutOneToTen.TabIndex = 13; this.checkBoxWriteOutOneToTen.Text = "From 1 to 10, numbers should be written out: One, two, three, etc."; this.checkBoxWriteOutOneToTen.UseVisualStyleBackColor = true; this.checkBoxWriteOutOneToTen.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -218,7 +233,7 @@ this.checkBoxSpellOutStartNumbers.Location = new System.Drawing.Point(409, 101); this.checkBoxSpellOutStartNumbers.Name = "checkBoxSpellOutStartNumbers"; this.checkBoxSpellOutStartNumbers.Size = new System.Drawing.Size(341, 17); - this.checkBoxSpellOutStartNumbers.TabIndex = 55; + this.checkBoxSpellOutStartNumbers.TabIndex = 12; this.checkBoxSpellOutStartNumbers.Text = "When a number begins a sentence, it should always be spelled out"; this.checkBoxSpellOutStartNumbers.UseVisualStyleBackColor = true; this.checkBoxSpellOutStartNumbers.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -231,7 +246,7 @@ this.checkBoxSquareBracketForHi.Location = new System.Drawing.Point(409, 78); this.checkBoxSquareBracketForHi.Name = "checkBoxSquareBracketForHi"; this.checkBoxSquareBracketForHi.Size = new System.Drawing.Size(286, 17); - this.checkBoxSquareBracketForHi.TabIndex = 60; + this.checkBoxSquareBracketForHi.TabIndex = 11; this.checkBoxSquareBracketForHi.Text = "Use brackets[] to enclose speaker IDs or sound effects"; this.checkBoxSquareBracketForHi.UseVisualStyleBackColor = true; this.checkBoxSquareBracketForHi.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -244,8 +259,8 @@ this.checkBoxDialogHypenNoSpace.Location = new System.Drawing.Point(409, 54); this.checkBoxDialogHypenNoSpace.Name = "checkBoxDialogHypenNoSpace"; this.checkBoxDialogHypenNoSpace.Size = new System.Drawing.Size(249, 17); - this.checkBoxDialogHypenNoSpace.TabIndex = 50; - this.checkBoxDialogHypenNoSpace.Text = " Dual Speakers: Use a hyphen without a space"; + this.checkBoxDialogHypenNoSpace.TabIndex = 10; + this.checkBoxDialogHypenNoSpace.Text = "Dual Speakers: Use a hyphen without a space"; this.checkBoxDialogHypenNoSpace.UseVisualStyleBackColor = true; this.checkBoxDialogHypenNoSpace.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); // @@ -257,7 +272,7 @@ this.checkBoxTwoLinesMax.Location = new System.Drawing.Point(19, 170); this.checkBoxTwoLinesMax.Name = "checkBoxTwoLinesMax"; this.checkBoxTwoLinesMax.Size = new System.Drawing.Size(117, 17); - this.checkBoxTwoLinesMax.TabIndex = 35; + this.checkBoxTwoLinesMax.TabIndex = 7; this.checkBoxTwoLinesMax.Text = "Two lines maximum"; this.checkBoxTwoLinesMax.UseVisualStyleBackColor = true; this.checkBoxTwoLinesMax.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -270,7 +285,7 @@ this.checkBoxMinDuration.Location = new System.Drawing.Point(19, 54); this.checkBoxMinDuration.Name = "checkBoxMinDuration"; this.checkBoxMinDuration.Size = new System.Drawing.Size(212, 17); - this.checkBoxMinDuration.TabIndex = 5; + this.checkBoxMinDuration.TabIndex = 2; this.checkBoxMinDuration.Text = "Minimum duration: 5/6 second (833 ms)"; this.checkBoxMinDuration.UseVisualStyleBackColor = true; this.checkBoxMinDuration.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -283,7 +298,7 @@ this.checkBoxMaxDuration.Location = new System.Drawing.Point(19, 78); this.checkBoxMaxDuration.Name = "checkBoxMaxDuration"; this.checkBoxMaxDuration.Size = new System.Drawing.Size(250, 17); - this.checkBoxMaxDuration.TabIndex = 10; + this.checkBoxMaxDuration.TabIndex = 3; this.checkBoxMaxDuration.Text = "Maximum duration: 7 seconds per subtitle event"; this.checkBoxMaxDuration.UseVisualStyleBackColor = true; this.checkBoxMaxDuration.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -295,7 +310,7 @@ this.buttonCancel.Location = new System.Drawing.Point(953, 582); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); - this.buttonCancel.TabIndex = 113; + this.buttonCancel.TabIndex = 5; this.buttonCancel.Text = "C&ancel"; this.buttonCancel.UseVisualStyleBackColor = true; this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); @@ -307,7 +322,7 @@ this.buttonOK.Location = new System.Drawing.Point(872, 582); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); - this.buttonOK.TabIndex = 112; + this.buttonOK.TabIndex = 4; this.buttonOK.Text = "&OK"; this.buttonOK.UseVisualStyleBackColor = true; this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); @@ -319,7 +334,7 @@ this.labelTotal.Location = new System.Drawing.Point(12, 587); this.labelTotal.Name = "labelTotal"; this.labelTotal.Size = new System.Drawing.Size(34, 13); - this.labelTotal.TabIndex = 115; + this.labelTotal.TabIndex = 2; this.labelTotal.Text = "Total:"; // // listViewFixes @@ -340,7 +355,7 @@ this.listViewFixes.Location = new System.Drawing.Point(12, 277); this.listViewFixes.Name = "listViewFixes"; this.listViewFixes.Size = new System.Drawing.Size(1016, 291); - this.listViewFixes.TabIndex = 114; + this.listViewFixes.TabIndex = 1; this.listViewFixes.UseCompatibleStateImageBehavior = false; this.listViewFixes.View = System.Windows.Forms.View.Details; // @@ -376,7 +391,7 @@ this.linkLabelOpenReportFolder.Location = new System.Drawing.Point(106, 587); this.linkLabelOpenReportFolder.Name = "linkLabelOpenReportFolder"; this.linkLabelOpenReportFolder.Size = new System.Drawing.Size(92, 13); - this.linkLabelOpenReportFolder.TabIndex = 116; + this.linkLabelOpenReportFolder.TabIndex = 3; this.linkLabelOpenReportFolder.TabStop = true; this.linkLabelOpenReportFolder.Text = "Open report folder"; this.linkLabelOpenReportFolder.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelOpenReportFolder_LinkClicked); @@ -389,7 +404,7 @@ this.checkBoxGapBridge.Location = new System.Drawing.Point(19, 147); this.checkBoxGapBridge.Name = "checkBoxGapBridge"; this.checkBoxGapBridge.Size = new System.Drawing.Size(210, 17); - this.checkBoxGapBridge.TabIndex = 30; + this.checkBoxGapBridge.TabIndex = 6; this.checkBoxGapBridge.Text = "Frame gap: 3 to 11 frames => 2 frames"; this.checkBoxGapBridge.UseVisualStyleBackColor = true; this.checkBoxGapBridge.CheckedChanged += new System.EventHandler(this.RuleCheckedChanged); @@ -445,6 +460,7 @@ private System.Windows.Forms.CheckBox checkBoxNoItalics; private System.Windows.Forms.CheckBox checkBoxTtmlFrameRate; private System.Windows.Forms.CheckBox checkBoxMaxLineLength; + private System.Windows.Forms.CheckBox checkBoxSceneChange; private System.Windows.Forms.CheckBox checkBoxWhiteSpace; private System.Windows.Forms.LinkLabel linkLabelOpenReportFolder; private System.Windows.Forms.CheckBox checkBoxGapBridge; diff --git a/src/Forms/NetflixFixErrors.cs b/src/Forms/NetflixFixErrors.cs index 9df57c435..c3044569d 100644 --- a/src/Forms/NetflixFixErrors.cs +++ b/src/Forms/NetflixFixErrors.cs @@ -16,16 +16,18 @@ namespace Nikse.SubtitleEdit.Forms private readonly Subtitle _subtitle; private readonly SubtitleFormat _subtitleFormat; private readonly string _subtitleFileName; + private readonly string _videoFileName; private bool _loading; private NetflixQualityController _netflixQualityController; - public NetflixFixErrors(Subtitle subtitle, SubtitleFormat subtitleFormat, string subtitleFileName) + public NetflixFixErrors(Subtitle subtitle, SubtitleFormat subtitleFormat, string subtitleFileName, string videoFileName) { InitializeComponent(); _subtitle = subtitle; _subtitleFormat = subtitleFormat; _subtitleFileName = subtitleFileName; + _videoFileName = videoFileName; labelTotal.Text = string.Empty; linkLabelOpenReportFolder.Text = string.Empty; @@ -45,17 +47,19 @@ namespace Nikse.SubtitleEdit.Forms private void RefreshCheckBoxes(string language) { - _netflixQualityController = new NetflixQualityController { Language = language }; + _netflixQualityController = new NetflixQualityController { Language = language, VideoFileName = _videoFileName }; checkBoxNoItalics.Checked = !_netflixQualityController.AllowItalics; checkBoxNoItalics.Enabled = !_netflixQualityController.AllowItalics; + checkBoxSceneChange.Checked = _netflixQualityController.CheckShotChange && _netflixQualityController.SceneChangesExist; + checkBoxSceneChange.Enabled = _netflixQualityController.CheckShotChange && _netflixQualityController.SceneChangesExist; + var checkFrameRate = _subtitleFormat.GetType() == new NetflixTimedText().GetType(); checkBoxTtmlFrameRate.Checked = checkFrameRate; checkBoxTtmlFrameRate.Enabled = checkFrameRate; - checkBoxDialogHypenNoSpace.Checked = _netflixQualityController.DualSpeakersHasHyphenAndNoSpace; - checkBoxDialogHypenNoSpace.Enabled = _netflixQualityController.DualSpeakersHasHyphenAndNoSpace; + checkBoxDialogHypenNoSpace.Text = !_netflixQualityController.DualSpeakersHasHyphenAndNoSpace ? "Dual Speakers: Use a hyphen with a space" : "Dual Speakers: Use a hyphen without a space"; checkBox17CharsPerSecond.Text = string.Format(Configuration.Settings.Language.NetflixQualityCheck.MaximumXCharsPerSecond, _netflixQualityController.CharactersPerSecond); checkBoxMaxLineLength.Text = string.Format(Configuration.Settings.Language.NetflixQualityCheck.MaximumLineLength, _netflixQualityController.SingleLineMaxLength); @@ -212,6 +216,11 @@ namespace Nikse.SubtitleEdit.Forms list.Add(new NetflixCheckWhiteSpace()); } + if (checkBoxSceneChange.Checked) + { + list.Add(new NetflixCheckSceneChange()); + } + return list; }