Skip to content

Commit

Permalink
Convert --verbose-ffmpeg to log levels with warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrubN committed Apr 6, 2024
1 parent 34275d4 commit 0314f61
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions TwitchDownloaderCLI/Tools/PreParseArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ private static string[] ConvertFromOldSyntax(string[] args, string processFileNa
processedArgs = ConvertSilentSyntax(processedArgs);
}

if (args.Any(x => x is "--verbose-ffmpeg"))
{
Console.WriteLine("[INFO] The program has switched from --verbose-ffmpeg to log levels, consider using log levels instead. '--log-level Status,Info,Warning,Error,Ffmpeg' will be applied to the current session. Run \'{0} help\' for more information.", processFileName);
processedArgs = ConvertVerboseFfmpegSyntax(processedArgs);
}

return processedArgs.ToArray();
}

Expand Down Expand Up @@ -107,5 +113,22 @@ private static List<string> ConvertSilentSyntax(List<string> args)

return args;
}

private static List<string> ConvertVerboseFfmpegSyntax(List<string> args)
{
for (var i = 0; i < args.Count; i++)
{
if (args[i].Equals("--verbose-ffmpeg"))
{
// If the user is still using --verbose-ffmpeg they probably aren't using log levels yet, so its safe to assume that there won't be a double-parse error
args[i] = "--log-level";
var logLevels = Enum.GetNames(typeof(LogLevel))
.Where(x => x is not nameof(LogLevel.None) and not nameof(LogLevel.Verbose));
args.Insert(i + 1, string.Join(',', logLevels));
}
}

return args;
}
}
}

0 comments on commit 0314f61

Please sign in to comment.