Use SubtitleMaximumDisplayMilliseconds for ShortenLongTexts + rename

This commit is contained in:
Nikolaj Olsson 2024-01-31 20:01:52 +01:00
parent ae93b3204f
commit 929f47ccb4
2 changed files with 7 additions and 7 deletions

View File

@ -174,7 +174,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
while (pctHere < percentageMax && startPos < p.EndTime.TotalSeconds - 1)
{
pctHere = FindPercentage(startPosForward - 0.05, startPosForward + 0.05, wavePeaks);
if (Math.Abs(pctHere - (- 1)) < 0.01)
if (Math.Abs(pctHere - (-1)) < 0.01)
{
if (p.DurationTotalMilliseconds < 1000)
{
@ -218,15 +218,15 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
return s;
}
public static Subtitle ShortenLongTexts(Subtitle subtitle)
public static Subtitle ShortenLongDuration(Subtitle subtitle)
{
var s = new Subtitle(subtitle);
foreach (var p in s.Paragraphs)
{
if (p.DurationTotalMilliseconds > 8000)
if (p.DurationTotalMilliseconds > Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds)
{
p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - 5000;
p.StartTime.TotalMilliseconds = p.EndTime.TotalMilliseconds - Configuration.Settings.General.SubtitleMaximumDisplayMilliseconds;
}
}

View File

@ -465,7 +465,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
if (checkBoxAutoAdjustTimings.Checked && wavePeaks != null)
{
transcript = WhisperTimingFixer.ShortenLongTexts(transcript);
transcript = WhisperTimingFixer.ShortenLongDuration(transcript);
transcript = WhisperTimingFixer.ShortenViaWavePeaks(transcript, wavePeaks);
}
@ -560,7 +560,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
if (checkBoxAutoAdjustTimings.Checked && wavePeaks != null)
{
transcript = WhisperTimingFixer.ShortenLongTexts(transcript);
transcript = WhisperTimingFixer.ShortenLongDuration(transcript);
transcript = WhisperTimingFixer.ShortenViaWavePeaks(transcript, wavePeaks);
}
@ -2132,7 +2132,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
if (checkBoxAutoAdjustTimings.Checked && wavePeaks != null)
{
_subtitle = WhisperTimingFixer.ShortenLongTexts(_subtitle);
_subtitle = WhisperTimingFixer.ShortenLongDuration(_subtitle);
_subtitle = WhisperTimingFixer.ShortenViaWavePeaks(_subtitle, wavePeaks);
}
else if (!checkBoxUsePostProcessing.Checked)