From 9e395ffa10a130da1a193e95ec23e6b6003ef197 Mon Sep 17 00:00:00 2001 From: WilliamWsyHK Date: Wed, 15 May 2024 22:59:37 +0800 Subject: [PATCH] Add log parsing capability to capture only enabled mods (#93) * Add log parsing capability to capture only enabled mods * Fix Python Black format complain * Add fallback so that old logs without mod status can still be recognized * stop Python Black complain again --- robocop_ng/helpers/ryujinx_log_analyser.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/robocop_ng/helpers/ryujinx_log_analyser.py b/robocop_ng/helpers/ryujinx_log_analyser.py index 6ae1385..e3ad942 100644 --- a/robocop_ng/helpers/ryujinx_log_analyser.py +++ b/robocop_ng/helpers/ryujinx_log_analyser.py @@ -377,13 +377,19 @@ class LogAnalyser: raise NotImplementedError(key) def __get_mods(self): - mods_regex = re.compile(r"Found mod\s\'(.+?)\'\s(\[.+?\])") + mods_regex = re.compile( + r"Found\s(enabled|disabled)?\s?mod\s\'(.+?)\'\s(\[.+?\])" + ) matches = re.findall(mods_regex, self._log_text) if matches: - mods = [{"mod": match[0], "status": match[1]} for match in matches] + mods = [ + {"mod": match[1], "status": match[0], "type": match[2]} + for match in matches + ] mods_status = [ - f"ℹ️ {i['mod']} ({'ExeFS' if i['status'] == '[E]' else 'RomFS'})" + f"ℹ️ {i['mod']} ({'ExeFS' if i['type'] == '[E]' else 'RomFS'})" for i in mods + if i["status"] == "" or i["status"] == "enabled" ] # Remove duplicated mods from output mods_status = list(dict.fromkeys(mods_status))