1
0

rename substitute_value to substitute_var

This commit is contained in:
Intel A80486DX2-66 2023-11-18 15:19:07 +03:00
parent aa25d770bc
commit 3e564d79ee
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -46,7 +46,7 @@ def read_from_file_or_stdin(path: str) -> str:
print("The specified file doesn't exist")
raise SystemExit
def substitute_value(placeholder: str, replacement, text: str) -> str:
def substitute_var(placeholder: str, replacement, text: str) -> str:
return text.replace(f"`{placeholder}`", str(replacement))
CC = fetch("CC")
@ -99,19 +99,19 @@ if __name__ == "__main__":
args.sample_rate = args.final_sample_rate
substitute = read_file(PATHS["template"])
substitute = substitute_value("bytebeat_contents",
substitute = substitute_var("bytebeat_contents",
bytebeat_contents, substitute)
substitute = substitute_value("sample_rate",
substitute = substitute_var("sample_rate",
args.sample_rate, substitute)
substitute = substitute_value("final_sample_rate_code",
substitute = substitute_var("final_sample_rate_code",
final_sample_rate_code, substitute)
substitute = substitute_value("bit_depth",
substitute = substitute_var("bit_depth",
args.bit_depth, substitute)
substitute = substitute_value("is_signed",
substitute = substitute_var("is_signed",
"1" if args.signed else "0", substitute)
substitute = substitute_value("channels",
substitute = substitute_var("channels",
args.channels, substitute)
substitute = substitute_value("seconds",
substitute = substitute_var("seconds",
args.seconds, substitute)
rewrite_file(PATHS["substitute"], substitute)