30 players finished
This commit is contained in:
@@ -21,6 +21,7 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
DATA_DIR = os.path.join(BASE_DIR, "data")
|
||||
CSV_PATH = os.path.join(BASE_DIR, "assets", "transfers-list.csv")
|
||||
CLUBS_DIR = os.path.join(BASE_DIR, "clubs-logo")
|
||||
PLAYER_DIR = os.path.join(BASE_DIR, "players")
|
||||
|
||||
os.makedirs(DATA_DIR, exist_ok=True)
|
||||
|
||||
@@ -142,7 +143,7 @@ def main():
|
||||
warnings.append(f"Row {i+1}: unknown club '{club_name}' -> auto colours {color}")
|
||||
|
||||
photo = r["photo"] if r["photo"] else "tmp-player.png"
|
||||
photo_path = os.path.join(BASE_DIR, photo)
|
||||
photo_path = os.path.join(PLAYER_DIR, photo)
|
||||
if not os.path.exists(photo_path):
|
||||
warnings.append(f"Row {i+1}: photo '{photo}' not found at project root")
|
||||
|
||||
@@ -165,7 +166,7 @@ def main():
|
||||
transfers_json.append({
|
||||
"id": i + 1,
|
||||
"playerName": r["player"],
|
||||
"photo": photo,
|
||||
"photo": f"players/{photo}",
|
||||
"team": {
|
||||
"name": club_name,
|
||||
"logo": f"clubs-logo/{logo}" if logo else "",
|
||||
@@ -177,7 +178,7 @@ def main():
|
||||
})
|
||||
|
||||
json_path = os.path.join(DATA_DIR, "transfers.json")
|
||||
with open(json_path, "w") as f:
|
||||
with open(json_path, "w", encoding="utf-8") as f:
|
||||
json.dump({"transfers": transfers_json}, f, indent=2, ensure_ascii=False)
|
||||
f.write("\n")
|
||||
print(f" Data -> {os.path.relpath(json_path, BASE_DIR)}")
|
||||
|
||||
Reference in New Issue
Block a user