Merge pull request #167 from 13xforever/vnext

Small enhancements
This commit is contained in:
Ilya 2019-01-13 23:33:51 +05:00 committed by GitHub
commit 9923e4ad65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 8 deletions

View File

@ -182,7 +182,7 @@ namespace AppveyorClient
{ {
ResponseCache.Set(j.JobId, b, JobToBuildCacheTime); ResponseCache.Set(j.JobId, b, JobToBuildCacheTime);
#if DEBUG #if DEBUG
ApiConfig.Log.Debug($"Cached {b.GetType().Name} for {j.JobId}"); //ApiConfig.Log.Debug($"Cached {b.GetType().Name} for {j.JobId}");
#endif #endif
} }
return buildInfo?.Build?.Jobs?.Any(j => j.JobId == jobId) ?? false; return buildInfo?.Build?.Jobs?.Any(j => j.JobId == jobId) ?? false;

View File

@ -22,7 +22,7 @@ namespace CompatBot.Commands
private static readonly GithubClient.Client githubClient = new GithubClient.Client(); private static readonly GithubClient.Client githubClient = new GithubClient.Client();
private static readonly AppveyorClient.Client appveyorClient = new AppveyorClient.Client(); private static readonly AppveyorClient.Client appveyorClient = new AppveyorClient.Client();
private static readonly CompatApiClient.Client compatApiClient = new CompatApiClient.Client(); private static readonly CompatApiClient.Client compatApiClient = new CompatApiClient.Client();
private static readonly TimeSpan AvgBuildTime = TimeSpan.FromMinutes(40); // it's 20, but on merge we have pr + master builds private static readonly TimeSpan AvgBuildTime = TimeSpan.FromMinutes(30); // it's 20, but on merge we have pr + master builds
private const string appveyorContext = "continuous-integration/appveyor/pr"; private const string appveyorContext = "continuous-integration/appveyor/pr";
[GroupCommand] [GroupCommand]

View File

@ -23,7 +23,7 @@ namespace CompatBot.EventHandlers
new[] new[]
{ {
"good bot", "gud bot", "good boy", "goodboy", "gud boy", "gud boi", "good bot", "gud bot", "good boy", "goodboy", "gud boy", "gud boi",
"thank you", "thankyou", "thnk", "thnx", "thnku", "thank u", "tnx", "thank you", "thankyou", "thanks", "thnk", "thnks", "thnx", "thnku", "thank u", "tnx",
"arigato", "aregato", "arigatou", "aregatou", "oregato", "origato", "arigato", "aregato", "arigatou", "aregatou", "oregato", "origato",
"poor bot", "good job", "well done", "good work", "excellent work", "poor bot", "good job", "well done", "good work", "excellent work",
}.ToDictionary(s => s, _ => false) }.ToDictionary(s => s, _ => false)

View File

@ -138,6 +138,7 @@ namespace CompatBot.EventHandlers.LogParsing
["Loaded SPU image:"] = new Regex(@"Loaded SPU image: SPU-(?<spu_hash>\w+) \(<-\s*(?<spu_hash_patch>(?!0)\d+)\).*?\r?$", DefaultOptions), ["Loaded SPU image:"] = new Regex(@"Loaded SPU image: SPU-(?<spu_hash>\w+) \(<-\s*(?<spu_hash_patch>(?!0)\d+)\).*?\r?$", DefaultOptions),
["'sys_fs_open' failed"] = new Regex(@"'sys_fs_open' failed .+\xE2\x80\x9C/dev_bdvd/(?<broken_filename>.+)\xE2\x80\x9D.*?\r?$", DefaultOptions), ["'sys_fs_open' failed"] = new Regex(@"'sys_fs_open' failed .+\xE2\x80\x9C/dev_bdvd/(?<broken_filename>.+)\xE2\x80\x9D.*?\r?$", DefaultOptions),
["'sys_fs_opendir' failed"] = new Regex(@"'sys_fs_opendir' failed .+\xE2\x80\x9C/dev_bdvd/(?<broken_directory>.+)\xE2\x80\x9D.*?\r?$", DefaultOptions), ["'sys_fs_opendir' failed"] = new Regex(@"'sys_fs_opendir' failed .+\xE2\x80\x9C/dev_bdvd/(?<broken_directory>.+)\xE2\x80\x9D.*?\r?$", DefaultOptions),
["EDAT: "] = new Regex(@"EDAT: Block at offset (?<edat_block_offset>0x[0-9a-f]+) has invalid hash!.*?\r?$", DefaultOptions),
}, },
OnSectionEnd = MarkAsCompleteAndReset, OnSectionEnd = MarkAsCompleteAndReset,
EndTrigger = "All threads stopped...", EndTrigger = "All threads stopped...",
@ -154,6 +155,7 @@ namespace CompatBot.EventHandlers.LogParsing
"spu_hash_patch", "spu_hash_patch",
"broken_filename", "broken_filename",
"broken_directory", "broken_directory",
"edat_block_offset",
}; };
private static async Task PiracyCheckAsync(string line, LogParseState state) private static async Task PiracyCheckAsync(string line, LogParseState state)

View File

@ -325,7 +325,7 @@ namespace CompatBot.Utils.ResultFormatters
} }
} }
private static async Task<bool> BuildMissingFilesSection(DiscordEmbedBuilder builder, NameValueCollection items) private static async Task<bool> HasBrokenFilesAsync(NameValueCollection items)
{ {
if (!(items["serial"] is string productCode)) if (!(items["serial"] is string productCode))
return false; return false;
@ -333,7 +333,8 @@ namespace CompatBot.Utils.ResultFormatters
if (!productCode.StartsWith("B") && !productCode.StartsWith("M")) if (!productCode.StartsWith("B") && !productCode.StartsWith("M"))
return false; return false;
if (string.IsNullOrEmpty(items["broken_directory"]) && string.IsNullOrEmpty(items["broken_filename"])) if (string.IsNullOrEmpty(items["broken_directory"])
&& string.IsNullOrEmpty(items["broken_filename"]))
return false; return false;
var getIrdTask = irdClient.DownloadAsync(productCode, Config.IrdCachePath, Config.Cts.Token); var getIrdTask = irdClient.DownloadAsync(productCode, Config.IrdCachePath, Config.Cts.Token);
@ -370,7 +371,7 @@ namespace CompatBot.Utils.ResultFormatters
{ {
BuildWeirdSettingsSection(builder, items); BuildWeirdSettingsSection(builder, items);
BuildMissingLicensesSection(builder, items); BuildMissingLicensesSection(builder, items);
var brokenDump = await BuildMissingFilesSection(builder, items).ConfigureAwait(false); var brokenDump = !string.IsNullOrEmpty("edat_block_offset") || await HasBrokenFilesAsync(items).ConfigureAwait(false);
var elfBootPath = items["elf_boot_path"] ?? ""; var elfBootPath = items["elf_boot_path"] ?? "";
var isEboot = !string.IsNullOrEmpty(elfBootPath) && elfBootPath.EndsWith("EBOOT.BIN", StringComparison.InvariantCultureIgnoreCase); var isEboot = !string.IsNullOrEmpty(elfBootPath) && elfBootPath.EndsWith("EBOOT.BIN", StringComparison.InvariantCultureIgnoreCase);
var isElf = !string.IsNullOrEmpty(elfBootPath) && !elfBootPath.EndsWith("EBOOT.BIN", StringComparison.InvariantCultureIgnoreCase); var isElf = !string.IsNullOrEmpty(elfBootPath) && !elfBootPath.EndsWith("EBOOT.BIN", StringComparison.InvariantCultureIgnoreCase);
@ -386,7 +387,7 @@ namespace CompatBot.Utils.ResultFormatters
if (items["failed_to_boot"] is string _) if (items["failed_to_boot"] is string _)
notes.AppendLine("Failed to boot the game, the dump might be encrypted or corrupted"); notes.AppendLine("Failed to boot the game, the dump might be encrypted or corrupted");
if (brokenDump) if (brokenDump)
notes.AppendLine("Some game files are missing or corrupted, please check and redump if needed."); notes.AppendLine("Some game files are missing or corrupted, please re-dump and validate.");
if (!string.IsNullOrEmpty(items["host_root_in_boot"]) && isEboot) if (!string.IsNullOrEmpty(items["host_root_in_boot"]) && isEboot)
notes.AppendLine("Retail game booted as an ELF through the `/root_host/`, probably due to passing path as an argument; please boot through the game library list for now"); notes.AppendLine("Retail game booted as an ELF through the `/root_host/`, probably due to passing path as an argument; please boot through the game library list for now");
if (!string.IsNullOrEmpty(items["serial"]) && isElf) if (!string.IsNullOrEmpty(items["serial"]) && isElf)

View File

@ -42,7 +42,7 @@ namespace CompatBot.Utils.ResultFormatters
&& buildPr != info.LatestBuild?.Pr && buildPr != info.LatestBuild?.Pr
&& GetUpdateDelta(info) is TimeSpan timeDelta) && GetUpdateDelta(info) is TimeSpan timeDelta)
timestampInfo += $" ({timeDelta.AsTimeDeltaDescription()} newer)"; timestampInfo += $" ({timeDelta.AsTimeDeltaDescription()} newer)";
else if (DateTime.TryParse(build.Datetime, out var buildDateTime) && DateTime.UtcNow.Ticks > buildDateTime.Ticks) else if (!justAppend && DateTime.TryParse(build.Datetime, out var buildDateTime) && DateTime.UtcNow.Ticks > buildDateTime.Ticks)
timestampInfo += $" ({(DateTime.UtcNow - buildDateTime.AsUtc()).AsTimeDeltaDescription()} ago)"; timestampInfo += $" ({(DateTime.UtcNow - buildDateTime.AsUtc()).AsTimeDeltaDescription()} ago)";
if (justAppend) if (justAppend)