Fix minor whisper cmd setting UI issue

This commit is contained in:
Nikolaj Olsson 2024-03-15 21:06:41 +01:00
parent d1e66d2b53
commit 22173fb253
2 changed files with 21 additions and 12 deletions

View File

@ -137,6 +137,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
Init();
InitializeWhisperEngines(comboBoxWhisperEngine);
FixPurfviewWhisperStandardArgument(labelAdvanced, comboBoxWhisperEngine.Text);
}
public static void InitializeWhisperEngines(NikseComboBox cb)
@ -1993,18 +1994,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
private void comboBoxWhisperEngine_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBoxWhisperEngine.Text != WhisperChoice.PurfviewFasterWhisper && Configuration.Settings.Tools.WhisperExtraSettings.Contains("--standard", StringComparison.Ordinal))
{
Configuration.Settings.Tools.WhisperExtraSettings = Configuration.Settings.Tools.WhisperExtraSettings.Replace("--standard", string.Empty).Trim();
labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings;
}
else if (comboBoxWhisperEngine.Text == WhisperChoice.PurfviewFasterWhisper &&
!Configuration.Settings.Tools.WhisperExtraSettings.Contains("--standard", StringComparison.Ordinal) &&
Configuration.Settings.Tools.WhisperPurfviewFasterWhisperDefaultCmd == "--standard")
{
Configuration.Settings.Tools.WhisperExtraSettings = Configuration.Settings.Tools.WhisperPurfviewFasterWhisperDefaultCmd;
labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings;
}
FixPurfviewWhisperStandardArgument(labelAdvanced, comboBoxWhisperEngine.Text);
if (comboBoxWhisperEngine.Text == Configuration.Settings.Tools.WhisperChoice)
{
@ -2077,6 +2067,22 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
}
}
internal static void FixPurfviewWhisperStandardArgument(Label label, string engine)
{
if (engine != WhisperChoice.PurfviewFasterWhisper && Configuration.Settings.Tools.WhisperExtraSettings.Contains("--standard", StringComparison.Ordinal))
{
Configuration.Settings.Tools.WhisperExtraSettings = Configuration.Settings.Tools.WhisperExtraSettings.Replace("--standard", string.Empty).Trim();
}
else if (engine == WhisperChoice.PurfviewFasterWhisper &&
!Configuration.Settings.Tools.WhisperExtraSettings.Contains("--standard", StringComparison.Ordinal) &&
Configuration.Settings.Tools.WhisperPurfviewFasterWhisperDefaultCmd == "--standard")
{
Configuration.Settings.Tools.WhisperExtraSettings = Configuration.Settings.Tools.WhisperPurfviewFasterWhisperDefaultCmd;
}
label.Text = Configuration.Settings.Tools.WhisperExtraSettings;
}
private void setCPPConstMeModelsFolderToolStripMenuItem_Click(object sender, EventArgs e)
{
using (var folderBrowserDialog1 = new FolderBrowserDialog())

View File

@ -77,6 +77,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
}
WhisperAudioToText.InitializeWhisperEngines(comboBoxWhisperEngine);
WhisperAudioToText.FixPurfviewWhisperStandardArgument(labelAdvanced, comboBoxWhisperEngine.Text);
}
private void Init()
@ -667,6 +668,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
private void comboBoxWhisperEngine_SelectedIndexChanged(object sender, EventArgs e)
{
WhisperAudioToText.FixPurfviewWhisperStandardArgument(labelAdvanced, comboBoxWhisperEngine.Text);
if (comboBoxWhisperEngine.Text == Configuration.Settings.Tools.WhisperChoice)
{
return;