Skip to content

Commit

Permalink
Continue
Browse files Browse the repository at this point in the history
  • Loading branch information
GewoonJaap committed Mar 5, 2023
1 parent 752c6ed commit 1490f9e
Showing 1 changed file with 29 additions and 18 deletions.
47 changes: 29 additions & 18 deletions ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,35 @@
FolderManager.CreateFolder(FolderManager.WavFolder);
FolderManager.CreateFolder(FolderManager.Models);

Console.Clear();
Console.WriteLine("Enter the video path...");
var videoPath = Console.ReadLine() ?? string.Empty;
//if path starts and ends with ", remove
videoPath = VideoPathFormatter.formatVideoPath(videoPath);

Console.WriteLine("In which language code (en,nl etc) is the audio? Leave empty to auto detect");
var languageCode = Console.ReadLine() ?? string.Empty;
if (languageCode.Length > 2)
while (true)
{
languageCode = string.Empty;
Console.Clear();
Console.WriteLine("Welcome to WinWhisper. Generate subtitles with ease using WhisperAI.");
Console.WriteLine("Enter the video path...");
var videoPath = Console.ReadLine() ?? string.Empty;
//if path starts and ends with ", remove
videoPath = VideoPathFormatter.formatVideoPath(videoPath);

Console.WriteLine("In which language code (en,nl etc) is the audio? Leave empty to auto detect");
var languageCode = Console.ReadLine() ?? string.Empty;
if (languageCode.Length > 2)
{
languageCode = string.Empty;
}

var audioPath = Extractor.ExtractAudioFromVideoFile(videoPath);

var audioProcessor = new AudioProcessor();
await audioProcessor.ProcessAudio(audioPath, languageCode);
//remove audioPath file
File.Delete(audioPath);
Console.WriteLine("Finished audio processing");

Console.WriteLine("Do you want to process another video? (yes/no)");
var processAnotherVideo = Console.ReadLine() ?? string.Empty;
if (processAnotherVideo.ToLower() == "no" || processAnotherVideo.ToLower() == "n")
{
break;
}
}

var audioPath = Extractor.ExtractAudioFromVideoFile(videoPath);

var audioProcessor = new AudioProcessor();
await audioProcessor.ProcessAudio(audioPath, languageCode);
//remove audioPath file
File.Delete(audioPath);
Console.WriteLine("Finished audio processing");
}

0 comments on commit 1490f9e

Please sign in to comment.