Skip to content

Commit

Permalink
Improve console output to indicate when the FFmpeg path was auto-dete…
Browse files Browse the repository at this point in the history
…cted
  • Loading branch information
whimsical-c4lic0 committed Feb 18, 2024
1 parent d68f1ee commit c63f119
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions OF DL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public async static Task Main()
}

var ffmpegFound = false;
var pathAutoDetected = false;
if (!string.IsNullOrEmpty(Config!.FFmpegPath) && ValidateFilePath(Config.FFmpegPath))
{
// FFmpeg path is set in config.json and is valid
Expand All @@ -95,6 +96,7 @@ public async static Task Main()
{
// FFmpeg is found in the PATH or current directory
ffmpegFound = true;
pathAutoDetected = true;
Config.FFmpegPath = ffmpegPath;
}
else
Expand All @@ -105,19 +107,27 @@ public async static Task Main()
{
// FFmpeg windows executable is found in the PATH or current directory
ffmpegFound = true;
pathAutoDetected = true;
Config.FFmpegPath = ffmpegPath;
}
}
}

if (ffmpegFound)
{
AnsiConsole.Markup($"[green]FFmpeg located successfully ({Config.FFmpegPath})\n[/]");
if (pathAutoDetected)
{
AnsiConsole.Markup($"[green]FFmpeg located successfully. Path auto-detected: {Config.FFmpegPath}\n[/]");
}
else
{
AnsiConsole.Markup($"[green]FFmpeg located successfully\n[/]");
}
}
else
{
AnsiConsole.Markup("[red]Cannot locate ffmpeg; please modify config.json with the correct path. Press any key to exit.[/]");
Log.Error($"Cannot locate ffmpeg with path: {Config.FFmpegPath}");
AnsiConsole.Markup("[red]Cannot locate FFmpeg; please modify config.json with the correct path. Press any key to exit.[/]");
Log.Error($"Cannot locate FFmpeg with path: {Config.FFmpegPath}");
Console.ReadKey();
Environment.Exit(0);
}
Expand Down

0 comments on commit c63f119

Please sign in to comment.