Skip to content

Commit

Permalink
Suggest possible bgm name if it is not found (#1178)
Browse files Browse the repository at this point in the history
* suggest possible bgm name if it is not found

* remove pointless ()

* run black

* ...run updated black
  • Loading branch information
Rainchus authored Mar 5, 2024
1 parent e6da185 commit e303e2a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tools/splat_ext/pm_sbn.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,18 @@ def write(self, path: Path):
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"
Expand Down

0 comments on commit e303e2a

Please sign in to comment.