diff --git a/bytebeat_compiler.py b/bytebeat_compiler.py index dcfb106..e433e85 100644 --- a/bytebeat_compiler.py +++ b/bytebeat_compiler.py @@ -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)