From 6a9c8465bc792745791d9893fc645d24f283ff55 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Thu, 4 Apr 2024 14:58:22 +0200 Subject: [PATCH] Show warning for running non-English with English-only models - thx Purfview :) Related to https://github.com/SubtitleEdit/subtitleedit/commit/ae5c93d6349a309ad40def952325dcee6840fb4e#commitcomment-140600266 --- src/ui/Forms/AudioToText/WhisperAudioToText.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.cs index 5a40d0db4..ce1cab557 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.cs @@ -384,6 +384,19 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText return; } + _languageCode = GetLanguage(comboBoxLanguages.Text); + + if (comboBoxModels.Items[comboBoxModels.SelectedIndex] is WhisperModel model && + _languageCode != "en" && model.Name.EndsWith(".en", StringComparison.InvariantCulture)) + { + var result = MessageBox.Show("English model should only be used with English language." + Environment.NewLine + + "Continue anyway?", Text, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); + if (result != DialogResult.Yes) + { + return; + } + } + try { var f = SeLogger.GetWhisperLogFilePath(); @@ -400,7 +413,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText _useCenterChannelOnly = Configuration.Settings.General.FFmpegUseCenterChannelOnly && FfmpegMediaInfo.Parse(_videoFileName).HasFrontCenterAudio(_audioTrackNumber); - _languageCode = GetLanguage(comboBoxLanguages.Text); IncompleteModel = false; ShowProgressBar();