-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_awards.py
More file actions
76 lines (69 loc) · 2.29 KB
/
update_awards.py
File metadata and controls
76 lines (69 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python3
"""
Script pour mettre à jour les récompenses depuis le site callistoarts.com
"""
import json
import re
from pathlib import Path
# Mapping des fichiers avec leurs récompenses trouvées sur le site
awards_mapping = {
"Callisto_Pascals-lemur-leap_step-finale-2048x1152.jpg": {
"title": "Pascal's lemur leap",
"award": "10ème place @ Revision 2025",
"year": 2025
},
"2fb0.356160_ori-2048x1910.jpg": {
"title": "Symphony of the abyss",
"award": "2ème place @ Rsync 2025",
"year": 2025
},
"paintover2024_callisto_refresh_step05.jpg": {
"title": "Refresh",
"award": "12ème place @ Revision 2024",
"year": 2024
},
"Chromatic-Resonance.jpg": {
"title": "Chromatique résonance",
"award": "1ère place @ Rsync 2024",
"year": 2024
},
"Luna-fly-by-callisto-finale-1-scaled.jpg": {
"title": "Luna Fly",
"award": "5ème place @ Session 2023",
"year": 2023
},
"cropped-elevation-finale-scaled-1.jpg": {
"title": "Elevation 2079",
"award": "1ère place @ Inercia 2022",
"year": 2022
},
"IMG_0899-scaled.jpg": {
"title": "Sky code",
"award": "Participation @ Inercia 2025",
"year": 2025
}
}
# Charger le JSON actuel
json_path = Path("assets/images/portfolio_images.json")
with open(json_path, 'r', encoding='utf-8') as f:
data = json.load(f)
# Mettre à jour les récompenses
updated_count = 0
for image in data["images"]:
filename = image["filename"]
# Chercher une correspondance exacte ou partielle
for key, award_info in awards_mapping.items():
if key in filename or filename in key:
# Mettre à jour les informations
if "title" in award_info:
image["title"] = award_info["title"]
if "award" in award_info:
image["award"] = award_info["award"]
updated_count += 1
if "year" in award_info:
image["year"] = award_info["year"]
break
# Sauvegarder le JSON mis à jour
with open(json_path, 'w', encoding='utf-8') as f:
json.dump(data, f, indent=2, ensure_ascii=False)
print(f"✓ {updated_count} récompenses mises à jour dans portfolio_images.json")