mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 03:02:35 +01:00
parent
1f8749402a
commit
3fbbc2d99b
@ -23,72 +23,72 @@ namespace Nikse.SubtitleEdit.Core.AudioToText
|
||||
return null;
|
||||
}
|
||||
|
||||
var location = Configuration.Settings.Tools.WhisperLocation;
|
||||
if (!string.IsNullOrEmpty(location))
|
||||
try
|
||||
{
|
||||
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 (Directory.Exists(location) && File.Exists(Path.Combine(location, "whisper.exe")))
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
var pythonFolder = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||
"AppData",
|
||||
"Local",
|
||||
"Programs",
|
||||
"Python");
|
||||
if (Directory.Exists(pythonFolder))
|
||||
{
|
||||
foreach (var dir in Directory.GetDirectories(pythonFolder))
|
||||
{
|
||||
var dirName = Path.GetFileName(dir);
|
||||
if (dirName != null && dirName.StartsWith("Python3"))
|
||||
if (location.EndsWith("whisper.exe", StringComparison.InvariantCultureIgnoreCase) && File.Exists(location))
|
||||
{
|
||||
var whisperFullPath = Path.Combine(dir, "Scripts", "whisper.exe");
|
||||
if (File.Exists(whisperFullPath))
|
||||
return Path.GetDirectoryName(location);
|
||||
}
|
||||
|
||||
if (Directory.Exists(location) && File.Exists(Path.Combine(location, "whisper.exe")))
|
||||
{
|
||||
return location;
|
||||
}
|
||||
}
|
||||
|
||||
var pythonFolder = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||
"AppData",
|
||||
"Local",
|
||||
"Programs",
|
||||
"Python");
|
||||
if (Directory.Exists(pythonFolder))
|
||||
{
|
||||
foreach (var dir in Directory.GetDirectories(pythonFolder))
|
||||
{
|
||||
var dirName = Path.GetFileName(dir);
|
||||
if (dirName != null && dirName.StartsWith("Python3"))
|
||||
{
|
||||
return Path.Combine(dir, "Scripts");
|
||||
var whisperFullPath = Path.Combine(dir, "Scripts", "whisper.exe");
|
||||
if (File.Exists(whisperFullPath))
|
||||
{
|
||||
return Path.Combine(dir, "Scripts");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var programFilesFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
||||
foreach (var dir in Directory.GetDirectories(programFilesFolder))
|
||||
{
|
||||
var dirName = Path.GetFileName(dir);
|
||||
if (dirName != null && dirName.StartsWith("Python"))
|
||||
var programFilesFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
|
||||
foreach (var dir in Directory.GetDirectories(programFilesFolder))
|
||||
{
|
||||
var files = Directory.GetFiles(dir, "whisper.exe", SearchOption.AllDirectories);
|
||||
var dirName = Path.GetFileName(dir);
|
||||
if (dirName != null && dirName.StartsWith("Python"))
|
||||
{
|
||||
var files = Directory.GetFiles(dir, "whisper.exe", SearchOption.AllDirectories);
|
||||
if (files.Length > 0)
|
||||
{
|
||||
return Path.GetDirectoryName(files[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var packagesFolder = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||
"AppData",
|
||||
"Local",
|
||||
"Packages");
|
||||
if (Directory.Exists(packagesFolder))
|
||||
{
|
||||
var files = Directory.GetFiles(packagesFolder, "whisper.exe", SearchOption.AllDirectories);
|
||||
if (files.Length > 0)
|
||||
{
|
||||
return Path.GetDirectoryName(files[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var packagesFolder = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
|
||||
"AppData",
|
||||
"Local",
|
||||
"Packages");
|
||||
if (Directory.Exists(packagesFolder))
|
||||
{
|
||||
var files = Directory.GetFiles(packagesFolder, "whisper.exe", SearchOption.AllDirectories);
|
||||
if (files.Length > 0)
|
||||
{
|
||||
return Path.GetDirectoryName(files[0]);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
pythonFolder = "C:\\";
|
||||
foreach (var dir in Directory.GetDirectories(pythonFolder))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user