From 5c9346c32ce2420772f967a5080fda776d5f24d5 Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Mon, 21 Oct 2024 19:33:08 +0100 Subject: [PATCH 1/2] Refactor logging and transcript check in WhisperAudioToText Simplify the logic by reordering logging updates and transcript checks. This removes redundant `UpdateLog` and `SeLogger.WhisperInfo` calls, streamlining the flow and maintaining the existing functionality. Signed-off-by: Ivandro Jao --- src/ui/Forms/AudioToText/WhisperAudioToText.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.cs index 38eea6877..6d91c847b 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.cs @@ -560,17 +560,12 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText Configuration.Settings.Tools.WhisperPostProcessingFixShortDuration, Configuration.Settings.Tools.WhisperPostProcessingSplitLines); + UpdateLog(); + SeLogger.WhisperInfo(textBoxLog.Text); if (transcript == null || transcript.Paragraphs.Count == 0) { - UpdateLog(); - SeLogger.WhisperInfo(textBoxLog.Text); IncompleteModelName = comboBoxModels.Text; } - else - { - UpdateLog(); - SeLogger.WhisperInfo(textBoxLog.Text); - } timer1.Stop(); From 48a5ad91b32d8bc0b9fad92a26d17bd7913286ac Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Mon, 21 Oct 2024 19:36:11 +0100 Subject: [PATCH 2/2] Fix variable name in WhisperAudioToText subtitle loading Corrected the input filename variable from srtFileName to vttFileName to ensure the correct subtitle format is processed. This fixes potential misloading issues when handling WebVTT files. Signed-off-by: Ivandro Jao --- src/ui/Forms/AudioToText/WhisperAudioToText.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.cs index 6d91c847b..b116a5ade 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.cs @@ -1049,8 +1049,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText } else { - var rawText = FileUtil.ReadAllLinesShared(srtFileName, Encoding.UTF8); - new WebVTT().LoadSubtitle(sub, rawText, srtFileName); + var rawText = FileUtil.ReadAllLinesShared(vttFileName, Encoding.UTF8); + new WebVTT().LoadSubtitle(sub, rawText, vttFileName); outputText?.Add($"Loading result from {vttFileName}{Environment.NewLine}"); }