Try to fix issue with running Whisper cpp/const-me after setting location for Whisper OpenAI Python - thx rsmith02ct :)

This commit is contained in:
niksedk 2023-03-27 18:59:11 +02:00
parent e947a5ebf2
commit 966276a75f

View File

@ -73,17 +73,20 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
try
{
var location = Configuration.Settings.Tools.WhisperLocation;
if (!string.IsNullOrEmpty(location))
if (Configuration.Settings.Tools.WhisperChoice == WhisperChoice.OpenAI)
{
if (location.EndsWith("whisper.exe", StringComparison.InvariantCultureIgnoreCase) && File.Exists(location))
var location = Configuration.Settings.Tools.WhisperLocation;
if (!string.IsNullOrEmpty(location))
{
return Path.GetDirectoryName(location);
}
if (location.EndsWith("whisper.exe", StringComparison.InvariantCultureIgnoreCase) && File.Exists(location))
{
return Path.GetDirectoryName(location);
}
if (Directory.Exists(location) && File.Exists(Path.Combine(location, "whisper.exe")))
{
return location;
if (Directory.Exists(location) && File.Exists(Path.Combine(location, "whisper.exe")))
{
return location;
}
}
}
@ -95,7 +98,7 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
if (Configuration.Settings.Tools.WhisperChoice == WhisperChoice.WhisperX && !string.IsNullOrEmpty(Configuration.Settings.Tools.WhisperXLocation))
{
if (Configuration.Settings.Tools.WhisperXLocation.EndsWith("whisperx.exe", StringComparison.InvariantCultureIgnoreCase) && File.Exists(location))
if (Configuration.Settings.Tools.WhisperXLocation.EndsWith("whisperx.exe", StringComparison.InvariantCultureIgnoreCase) && File.Exists(Configuration.Settings.Tools.WhisperXLocation))
{
return Path.GetDirectoryName(Configuration.Settings.Tools.WhisperXLocation);
}