Always include FFmpeg version in support bundle
This commit is contained in:
parent
01dff7a8b2
commit
a8b5e2b2c5
@ -457,51 +457,57 @@ public static class FFmpegWrapper
|
|||||||
/// <returns>Markdown formatted logs.</returns>
|
/// <returns>Markdown formatted logs.</returns>
|
||||||
public static string GetChromaprintLogs()
|
public static string GetChromaprintLogs()
|
||||||
{
|
{
|
||||||
var logs = new StringBuilder(1024);
|
|
||||||
|
|
||||||
// Print the FFmpeg detection status at the top.
|
// Print the FFmpeg detection status at the top.
|
||||||
// Format: "* FFmpeg: `error`"
|
// Format: "* FFmpeg: `error`"
|
||||||
logs.Append("* FFmpeg: `");
|
// Append two newlines to separate the bulleted list from the logs
|
||||||
logs.Append(ChromaprintLogs["error"]);
|
var logs = string.Format(
|
||||||
logs.Append("`\n\n"); // Use two newlines to separate the bulleted list from the logs
|
CultureInfo.InvariantCulture,
|
||||||
|
"* FFmpeg: `{0}`\n\n",
|
||||||
|
ChromaprintLogs["error"]);
|
||||||
|
|
||||||
// Don't print FFmpeg's logs if no error was detected during initialization.
|
// Always include ffmpeg version information
|
||||||
|
logs += FormatFFmpegLog("version");
|
||||||
|
|
||||||
|
// Don't print feature detection logs if the plugin started up okay
|
||||||
if (ChromaprintLogs["error"] == "okay")
|
if (ChromaprintLogs["error"] == "okay")
|
||||||
{
|
{
|
||||||
return logs.ToString();
|
return logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print all remaining logs
|
// Print all remaining logs
|
||||||
foreach (var kvp in ChromaprintLogs)
|
foreach (var kvp in ChromaprintLogs)
|
||||||
{
|
{
|
||||||
var name = kvp.Key;
|
if (kvp.Key == "error" || kvp.Key == "version")
|
||||||
var contents = kvp.Value;
|
|
||||||
|
|
||||||
if (string.Equals(name, "error", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Format:
|
logs += FormatFFmpegLog(kvp.Key);
|
||||||
* FFmpeg NAME:
|
|
||||||
* ```
|
|
||||||
* LOGS
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
logs.Append("FFmpeg ");
|
|
||||||
logs.Append(name);
|
|
||||||
logs.Append(":\n```\n");
|
|
||||||
logs.Append(contents);
|
|
||||||
|
|
||||||
// ensure the closing triple backtick is on a separate line
|
|
||||||
if (!contents.EndsWith('\n'))
|
|
||||||
{
|
|
||||||
logs.Append('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
logs.Append("```\n\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return logs.ToString();
|
return logs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string FormatFFmpegLog(string key)
|
||||||
|
{
|
||||||
|
/* Format:
|
||||||
|
* FFmpeg NAME:
|
||||||
|
* ```
|
||||||
|
* LOGS
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
|
||||||
|
var formatted = string.Format(CultureInfo.InvariantCulture, "FFmpeg {0}:\n```\n", key);
|
||||||
|
formatted += ChromaprintLogs[key];
|
||||||
|
|
||||||
|
// Ensure the closing triple backtick is on a separate line
|
||||||
|
if (!formatted.EndsWith('\n'))
|
||||||
|
{
|
||||||
|
formatted += "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
formatted += "```\n\n";
|
||||||
|
|
||||||
|
return formatted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user