Gen blank video - take max time from loaded sub - thx tech :)

Related to https://www.nikse.dk/Home/Details/637722263550000000
This commit is contained in:
niksedk 2021-11-19 11:34:46 +01:00
parent a277deaf13
commit 782089a4e2

View File

@ -5,6 +5,7 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
@ -27,6 +28,16 @@ namespace Nikse.SubtitleEdit.Forms
UiUtil.FixFonts(this); UiUtil.FixFonts(this);
numericUpDownDurationMinutes.Value = Configuration.Settings.Tools.BlankVideoMinutes; numericUpDownDurationMinutes.Value = Configuration.Settings.Tools.BlankVideoMinutes;
var maxTimeP = subtitle?.Paragraphs.Where(p => !p.EndTime.IsMaxTime).Max(p => p.EndTime.TotalMilliseconds);
if (maxTimeP.HasValue && maxTimeP.Value / 1000 > 120)
{
var minutes = (int)maxTimeP.Value / 1000 / 60 + 1;
if (minutes < 300)
{
numericUpDownDurationMinutes.Value = minutes;
}
}
panelColor.BackColor = Configuration.Settings.Tools.BlankVideoColor; panelColor.BackColor = Configuration.Settings.Tools.BlankVideoColor;
if (Configuration.Settings.Tools.BlankVideoUseCheckeredImage) if (Configuration.Settings.Tools.BlankVideoUseCheckeredImage)
{ {