add getting image
This commit is contained in:
@@ -37,4 +37,12 @@ def get_car_skins(car: str) -> list[str]:
|
||||
|
||||
skindirs = [x.path.replace(skin_path + "/","") for x in os.scandir(skin_path) if x.is_dir()]
|
||||
return skindirs
|
||||
|
||||
def get_car_image(car: str, skin: str) -> str:
|
||||
img_path = os.path.join(CARS_FOLDER, car,"skins", skin)
|
||||
for name in os.listdir(img_path):
|
||||
lower = name.lower()
|
||||
if "preview" in lower and lower.endswith(".png") or lower.endswith(".jpg"):
|
||||
return os.path.join(img_path, name)
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user