private void EmbedMetadataIfEnabled(string fileName, Context context) { if (MetadataEmbeddingIsDisabled(context.ComicId)) { return; } var metaBuilder = new StringBuilder(); metaBuilder.AddIfPossible("xmp:title", "title", context); metaBuilder.AddIfPossible("xmp:description", "description", context); metaBuilder.AddIfPossible("xmp:source", context.CurrentAddress.AbsoluteUri); metaBuilder.AddIfPossible("comment", "downloaded with Woofy - https://vladiliescu.net/woofy"); var arguments = @"{0} ""{1}""".FormatTo(metaBuilder.ToString(), fileName); Log(context, "running exiftool.exe {0}", arguments); var run = new ProcessStartInfo(appSettings.ExifToolPath, arguments) { CreateNoWindow = true, RedirectStandardError = true, RedirectStandardOutput = true, UseShellExecute = false }; var process = Process.Start(run); process.WaitForExit(); var error = process.StandardError.ReadToEnd().Trim(); var output = process.StandardOutput.ReadToEnd().Trim(); if (error.IsNotNullOrEmpty()) { Log(context, "exiftool: {0}", error); } if (output.IsNotNullOrEmpty()) { Log(context, "exiftool: {0}", output); } }