1
0
Fork 0

feat(api): ignore comments and empty lines in wildcard files

This commit is contained in:
Sean Sube 2023-07-05 23:04:11 -05:00
parent 15c26cd74b
commit 17a710197c
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 2 additions and 0 deletions

View File

@ -462,6 +462,8 @@ def load_wildcards(server: ServerContext) -> None:
for file in wildcard_files:
with open(path.join(server.model_path, "wildcard", f"{file}.txt"), "r") as f:
lines = f.read().splitlines()
lines = [l.strip() for l in lines if not l.startswith("#")]
lines = [l for l in lines if len(l) > 0]
logger.debug("loading wildcards from %s: %s", file, lines)
wildcard_data[file] = lines