From c2dcd52c828a0d6477d8c87e0abff867ee309e64 Mon Sep 17 00:00:00 2001 From: SemvdH Date: Sun, 16 Nov 2025 16:06:47 +0100 Subject: [PATCH] Try harder when searching for track image or outline --- change_track.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/change_track.py b/change_track.py index 1b8e8b9..3a12dc9 100644 --- a/change_track.py +++ b/change_track.py @@ -12,18 +12,25 @@ def get_all_tracks(): return sorted([x.name for x in os.scandir(TRACKS_FOLDER) if x.is_dir()]) def get_preview_image(track: str, config: str = ""): - img_path = os.path.join(TRACKS_FOLDER, track, "ui", config, "preview.png") - if os.path.exists(img_path): - return img_path - return "" + return get_path_image("preview.png", track, config) def get_outline_image(track: str, config: str = ""): - img_path = os.path.join(TRACKS_FOLDER, track, "ui", config, "outline.png") + return get_path_image("outline.png", track, config) + +def get_path_image(image_name, track: str, config: str = ""): + img_path = os.path.join(TRACKS_FOLDER, track, "ui", config, image_name) if os.path.exists(img_path): return img_path + + img_path = os.path.join(TRACKS_FOLDER, track, image_name) + if os.path.exists(img_path): + return img_path + + img_path = os.path.join(TRACKS_FOLDER, track, image_name.replace(".png",".PNG")) + if os.path.exists(img_path): + return img_path + return "" - - def get_configs(track) -> list[str]: track_path = os.path.join(TRACKS_FOLDER, track);