diff --git a/gene-pool-backend/.vs/gene-pool-backend/v16/.suo b/gene-pool-backend/.vs/gene-pool-backend/v16/.suo index e1751f2..a58f075 100644 Binary files a/gene-pool-backend/.vs/gene-pool-backend/v16/.suo and b/gene-pool-backend/.vs/gene-pool-backend/v16/.suo differ diff --git a/gene-pool-backend/Controllers/SpeechToTextController.cs b/gene-pool-backend/Controllers/SpeechToTextController.cs index 5ea27a1..b1b0c56 100644 --- a/gene-pool-backend/Controllers/SpeechToTextController.cs +++ b/gene-pool-backend/Controllers/SpeechToTextController.cs @@ -117,5 +117,13 @@ public async Task LinkToWav(dynamic request) { return BadRequest("Unknown error during transcription"); } } + + [HttpPost] + [Route("debug_find_file")] + public async Task FindFile(dynamic request) { + var body = JsonConvert.DeserializeObject(request.ToString()); + + return Ok(FileHelper.FindFile("ffmpeg.exe")); + } } } diff --git a/gene-pool-backend/FileHelper.cs b/gene-pool-backend/FileHelper.cs index 9be69ea..bcb619d 100644 --- a/gene-pool-backend/FileHelper.cs +++ b/gene-pool-backend/FileHelper.cs @@ -12,11 +12,50 @@ namespace gene_pool_backend { public static class FileHelper { - private static string PathToFfmpeg = "ffmpeg.exe"; + private static readonly string ffmpegName = "ffmpeg.exe"; + + private static string ProcessDirectory(string targetDirectory, string fileName) { + string path = ""; + + // Process the list of files found in the directory. + string[] fileEntries = Directory.GetFiles(targetDirectory); + foreach (string filePath in fileEntries) { + if (Path.GetFileName(filePath).Equals(fileName)) { + return filePath; + } + } + + // Recurse into subdirectories of this directory. + string[] subdirectoryEntries = Directory.GetDirectories(targetDirectory); + foreach (string subdirectory in subdirectoryEntries) { + path = ProcessDirectory(subdirectory, fileName); + if (path.Length > 0) { + return path; + } + } + + return path; + } + + public static string FindFile(string fileName) { + string path = Directory.GetCurrentDirectory(); + Console.WriteLine(path); + + path = ProcessDirectory(path, fileName); + + if (path.Length > 0) { + Console.WriteLine($"Found exe: {path}"); + } else { + Console.WriteLine("Did not find path"); + } + + return path; + } public static dynamic ToWavFormat(string pathToMp4, string pathToWav) { + string path = FindFile(ffmpegName); var ffmpeg = new Process { - StartInfo = { UseShellExecute = false, RedirectStandardError = true, FileName = PathToFfmpeg } + StartInfo = { UseShellExecute = false, RedirectStandardError = true, FileName = path } }; var arguments = diff --git a/gene-pool-backend/bin/Debug/netcoreapp3.1/gene-pool-backend.dll b/gene-pool-backend/bin/Debug/netcoreapp3.1/gene-pool-backend.dll index 553b072..7a7eac3 100644 Binary files a/gene-pool-backend/bin/Debug/netcoreapp3.1/gene-pool-backend.dll and b/gene-pool-backend/bin/Debug/netcoreapp3.1/gene-pool-backend.dll differ diff --git a/gene-pool-backend/bin/Debug/netcoreapp3.1/gene-pool-backend.pdb b/gene-pool-backend/bin/Debug/netcoreapp3.1/gene-pool-backend.pdb index 616d93f..9199232 100644 Binary files a/gene-pool-backend/bin/Debug/netcoreapp3.1/gene-pool-backend.pdb and b/gene-pool-backend/bin/Debug/netcoreapp3.1/gene-pool-backend.pdb differ diff --git a/gene-pool-backend/ffmpeg.exe b/gene-pool-backend/ffmpeg.exe deleted file mode 100644 index e0e7780..0000000 Binary files a/gene-pool-backend/ffmpeg.exe and /dev/null differ diff --git a/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.csprojAssemblyReference.cache b/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.csprojAssemblyReference.cache index e5c0651..d1eba8b 100644 Binary files a/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.csprojAssemblyReference.cache and b/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.csprojAssemblyReference.cache differ diff --git a/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.dll b/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.dll index 553b072..7a7eac3 100644 Binary files a/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.dll and b/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.dll differ diff --git a/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.pdb b/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.pdb index 616d93f..9199232 100644 Binary files a/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.pdb and b/gene-pool-backend/obj/Debug/netcoreapp3.1/gene-pool-backend.pdb differ