1
0
mirror of synced 2024-11-27 22:40:49 +01:00

__init__.py: Don't throw error if extension not .tja

This commit is contained in:
Viv 2024-02-11 03:46:58 -05:00
parent 012648d4fc
commit ade4f66679

View File

@ -42,7 +42,9 @@ def main(argv: Sequence[str] = ()) -> None:
fname = getattr(args, "file") fname = getattr(args, "file")
base_name = os.path.splitext(fname)[0] base_name = os.path.splitext(fname)[0]
if fname.endswith(".tja"): if fname.endswith(".bin"):
repair_bin(fname)
else:
# Parse lines in TJA file # Parse lines in TJA file
parsed_tja = parse_tja(fname) parsed_tja = parse_tja(fname)
@ -50,10 +52,6 @@ def main(argv: Sequence[str] = ()) -> None:
for course_name, course in parsed_tja.courses.items(): for course_name, course in parsed_tja.courses.items():
convert_and_write(course, course_name, base_name, convert_and_write(course, course_name, base_name,
single_course=len(parsed_tja.courses) == 1) single_course=len(parsed_tja.courses) == 1)
elif fname.endswith(".bin"):
repair_bin(fname)
else:
raise ValueError(f"Unexpected file extension: {fname}")
def convert_and_write(tja_data: TJACourse, def convert_and_write(tja_data: TJACourse,