Skip to content

Commit

Permalink
Update MkvReadCrawler to also do a dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMoolenaar committed Mar 5, 2024
1 parent 0a34f4f commit 7f5d8f8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions MkvReadCrawler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ static void Main(string[] args)
var mainStringBuilder = new StringBuilder();

int x = 0;
Parallel.For(0, mkvFiles.Length, new ParallelOptions() { MaxDegreeOfParallelism = 4 }, i =>
Parallel.For(0, mkvFiles.Length, new ParallelOptions { MaxDegreeOfParallelism = 4 }, i =>
{
var mkvFile = mkvFiles[i];
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine(Path.GetFileName(mkvFile));

try
{
var lsFiles = MatroskaReader.ReadMkvFiles(new[] { mkvFile });
stringBuilder.AppendLine("b" + lsFiles[0].tracks.Count);
var lsFiles = MatroskaReader.ReadMkvFiles([mkvFile]);
MatroskaWriter.WriteMkvFile(lsFiles[0], dryRun:true);
stringBuilder.AppendLine("Track count:" + lsFiles[0].tracks.Count);
}
catch (Exception e)
{
stringBuilder.AppendLine(e.GetType().ToString());
stringBuilder.AppendLine(e.ToString());
}
stringBuilder.AppendLine();

Expand All @@ -41,6 +42,6 @@ static void Main(string[] args)
});

File.WriteAllText("OutputkvDefault.txt", mainStringBuilder.ToString());
Console.WriteLine("Done!");
Console.WriteLine("Done! Output written to OutputkvDefault.txt.");
}
}

0 comments on commit 7f5d8f8

Please sign in to comment.