From e303e2a04b2f5ef1dfe62dedc6db6a0ea6407bc9 Mon Sep 17 00:00:00 2001 From: Rainchus Date: Tue, 5 Mar 2024 01:01:17 -0600 Subject: [PATCH] Suggest possible bgm name if it is not found (#1178) * suggest possible bgm name if it is not found * remove pointless () * run black * ...run updated black --- tools/splat_ext/pm_sbn.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/splat_ext/pm_sbn.py b/tools/splat_ext/pm_sbn.py index 5c20c091e8..9cd7a8f600 100644 --- a/tools/splat_ext/pm_sbn.py +++ b/tools/splat_ext/pm_sbn.py @@ -275,10 +275,18 @@ class SBN: f.write("\n") def lookup_file_id(self, filename: str) -> int: + suggestion = "" for id, sbn_file in enumerate(self.files): if sbn_file.file_name() == filename: return id - raise Exception(f"File not found: {filename} - is it in the file_id_map?") + elif sbn_file.file_name().split("_")[0] == filename.split("_")[0]: + suggestion = sbn_file.file_name() + if suggestion == "": + raise Exception(f"File not found: {filename} - is it in the file_id_map?") + else: + raise Exception( + f"File not found: {filename} - is it in the file_id_map? (Did you mean to name the file: {suggestion}?)" + ) def __str__(self) -> str: s = "SBN(\n"