mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
Use variable for audio-to-text max line len - thx coastal45 :)
See #5975
This commit is contained in:
parent
881b125222
commit
b8872ad712
@ -17,7 +17,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
|
||||
public double SetPeriodIfDistanceToNextIsMoreThan { get; set; } = 300;
|
||||
public double SetPeriodIfDistanceToNextIsMoreThanAlways { get; set; } = 500;
|
||||
|
||||
public int ParagraphMaxChars { get; set; } = 86;
|
||||
public int ParagraphMaxChars { get; set; }
|
||||
|
||||
public string TwoLetterLanguageCode { get; }
|
||||
|
||||
@ -25,6 +25,12 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
|
||||
public AudioToTextPostProcessor(string twoLetterLanguageCode)
|
||||
{
|
||||
TwoLetterLanguageCode = twoLetterLanguageCode;
|
||||
|
||||
ParagraphMaxChars = Configuration.Settings.Tools.AudioToTextLineMaxChars;
|
||||
if (ParagraphMaxChars < 10 || ParagraphMaxChars > 1_000_000)
|
||||
{
|
||||
ParagraphMaxChars = 86;
|
||||
}
|
||||
}
|
||||
|
||||
public Subtitle Generate(List<ResultText> resultTexts, bool usePostProcessing, bool addPeriods, bool mergeLines, bool fixCasing, bool fixShortDuration)
|
||||
@ -146,12 +152,12 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
|
||||
|
||||
if (language == "jp")
|
||||
{
|
||||
ParagraphMaxChars = 13;
|
||||
ParagraphMaxChars = Configuration.Settings.Tools.AudioToTextLineMaxCharsJp;
|
||||
}
|
||||
|
||||
if (language == "cn")
|
||||
{
|
||||
ParagraphMaxChars = 16;
|
||||
ParagraphMaxChars = Configuration.Settings.Tools.AudioToTextLineMaxCharsCn;
|
||||
}
|
||||
|
||||
var mergedSubtitle = new Subtitle();
|
||||
|
@ -400,6 +400,9 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
public bool GenVideoNonAssaFixRtlUnicode { get; set; }
|
||||
public bool VoskPostProcessing { get; set; }
|
||||
public string VoskModel { get; set; }
|
||||
public int AudioToTextLineMaxChars { get; set; }
|
||||
public int AudioToTextLineMaxCharsJp { get; set; }
|
||||
public int AudioToTextLineMaxCharsCn { get; set; }
|
||||
|
||||
public ToolsSettings()
|
||||
{
|
||||
@ -589,6 +592,9 @@ namespace Nikse.SubtitleEdit.Core.Common
|
||||
GenVideoFontSizePercentOfHeight = 0.078f;
|
||||
GenVideoNonAssaBox = true;
|
||||
VoskPostProcessing = true;
|
||||
AudioToTextLineMaxChars = 86;
|
||||
AudioToTextLineMaxCharsJp = 32;
|
||||
AudioToTextLineMaxCharsCn = 36;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5981,6 +5987,25 @@ $HorzAlign = Center
|
||||
settings.Tools.VoskModel = subNode.InnerText;
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("AudioToTextLineMaxChars");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Tools.AudioToTextLineMaxChars = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("AudioToTextLineMaxCharsJp");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Tools.AudioToTextLineMaxCharsJp = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
subNode = node.SelectSingleNode("AudioToTextLineMaxCharsCn");
|
||||
if (subNode != null)
|
||||
{
|
||||
settings.Tools.AudioToTextLineMaxCharsCn = Convert.ToInt32(subNode.InnerText, CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
|
||||
subNode = node.SelectSingleNode("FindHistory");
|
||||
if (subNode != null)
|
||||
{
|
||||
@ -10096,6 +10121,9 @@ $HorzAlign = Center
|
||||
textWriter.WriteElementString("GenVideoNonAssaFixRtlUnicode", settings.Tools.GenVideoNonAssaFixRtlUnicode.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("VoskPostProcessing", settings.Tools.VoskPostProcessing.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("VoskModel", settings.Tools.VoskModel);
|
||||
textWriter.WriteElementString("VoskModel", settings.Tools.AudioToTextLineMaxChars.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("AudioToTextLineMaxCharsJp", settings.Tools.AudioToTextLineMaxCharsJp.ToString(CultureInfo.InvariantCulture));
|
||||
textWriter.WriteElementString("AudioToTextLineMaxCharsCn", settings.Tools.AudioToTextLineMaxCharsCn.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
if (settings.Tools.FindHistory != null && settings.Tools.FindHistory.Count > 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user