mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Improve "AllowLineContentMove" check - thx Purfview :)
Related to 2b33476a1d (commitcomment-140673191)
This commit is contained in:
parent
580075b6fd
commit
c39e736aed
@ -121,9 +121,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
|
|||||||
subtitle = FixShortDuration(subtitle);
|
subtitle = FixShortDuration(subtitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (splitLines && !IsNonStandardLineTerminationLanguage(TwoLetterLanguageCode) &&
|
if (splitLines && !IsNonStandardLineTerminationLanguage(TwoLetterLanguageCode) && AllowLineContentMove(engine))
|
||||||
!Configuration.Settings.Tools.WhisperExtraSettings.Contains("--highlight_words true", StringComparison.OrdinalIgnoreCase) &&
|
|
||||||
!Configuration.Settings.Tools.WhisperExtraSettings.Contains("--one_word", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
{
|
||||||
var totalMaxChars = Configuration.Settings.General.SubtitleLineMaximumLength * Configuration.Settings.General.MaxNumberOfLines;
|
var totalMaxChars = Configuration.Settings.General.SubtitleLineMaximumLength * Configuration.Settings.General.MaxNumberOfLines;
|
||||||
subtitle = SplitLongLinesHelper.SplitLongLinesInSubtitle(subtitle, totalMaxChars, Configuration.Settings.General.SubtitleLineMaximumLength);
|
subtitle = SplitLongLinesHelper.SplitLongLinesInSubtitle(subtitle, totalMaxChars, Configuration.Settings.General.SubtitleLineMaximumLength);
|
||||||
@ -131,9 +129,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
|
|||||||
subtitle = TryForWholeSentences(subtitle, TwoLetterLanguageCode, Configuration.Settings.General.SubtitleLineMaximumLength);
|
subtitle = TryForWholeSentences(subtitle, TwoLetterLanguageCode, Configuration.Settings.General.SubtitleLineMaximumLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mergeLines &&
|
if (mergeLines && AllowLineContentMove(engine))
|
||||||
!Configuration.Settings.Tools.WhisperExtraSettings.Contains("--highlight_words true", StringComparison.OrdinalIgnoreCase) &&
|
|
||||||
!Configuration.Settings.Tools.WhisperExtraSettings.Contains("--one_word", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
{
|
||||||
subtitle = MergeShortLines(subtitle, TwoLetterLanguageCode);
|
subtitle = MergeShortLines(subtitle, TwoLetterLanguageCode);
|
||||||
subtitle = AutoBalanceLines(subtitle, TwoLetterLanguageCode);
|
subtitle = AutoBalanceLines(subtitle, TwoLetterLanguageCode);
|
||||||
@ -144,6 +140,25 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
|
|||||||
return subtitle;
|
return subtitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool AllowLineContentMove(Engine engine)
|
||||||
|
{
|
||||||
|
if (engine != Engine.Whisper)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(Configuration.Settings.Tools.WhisperExtraSettings))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var es = Configuration.Settings.Tools.WhisperExtraSettings.ToLowerInvariant();
|
||||||
|
return !es.Contains("--highlight_words", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!es.Contains("-hw ", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!es.Contains("-hw=true", StringComparison.OrdinalIgnoreCase) &&
|
||||||
|
!es.Contains("--one_word", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
public static Subtitle TryForWholeSentences(Subtitle inputSubtitle, string language, int lineMaxLength)
|
public static Subtitle TryForWholeSentences(Subtitle inputSubtitle, string language, int lineMaxLength)
|
||||||
{
|
{
|
||||||
var s = new Subtitle(inputSubtitle);
|
var s = new Subtitle(inputSubtitle);
|
||||||
|
Loading…
Reference in New Issue
Block a user