You've already forked etude_lego_jurassic_world
Ajoute les frises de têtes et enrichit les étiquettes
This commit is contained in:
@@ -57,6 +57,7 @@ def build_character_collage(
|
||||
destination_dir: Path,
|
||||
font: ImageFont.ImageFont,
|
||||
missing_paths: Set[str] | None = None,
|
||||
image_filename: str = "minifig.jpg",
|
||||
image_height: int = 260,
|
||||
label_height: int = 44,
|
||||
spacing: int = 28,
|
||||
@@ -66,7 +67,7 @@ def build_character_collage(
|
||||
missing = missing_paths or set()
|
||||
cells: List[Image.Image] = []
|
||||
for row in entries:
|
||||
image_path = resources_dir / row["set_id"] / sanitized / "minifig.jpg"
|
||||
image_path = resources_dir / row["set_id"] / sanitized / image_filename
|
||||
owned = "*" if row.get("in_collection", "").lower() == "true" else ""
|
||||
label = f"{row['year']} - {row['set_num']}{owned} ({row['fig_num']})"
|
||||
if str(image_path) in missing:
|
||||
@@ -92,6 +93,7 @@ def build_character_collages(
|
||||
resources_dir: Path,
|
||||
destination_dir: Path,
|
||||
missing_paths: Set[str] | None = None,
|
||||
image_filename: str = "minifig.jpg",
|
||||
image_height: int = 260,
|
||||
label_height: int = 44,
|
||||
spacing: int = 28,
|
||||
@@ -108,6 +110,7 @@ def build_character_collages(
|
||||
destination_dir,
|
||||
font,
|
||||
missing_paths=missing_paths,
|
||||
image_filename=image_filename,
|
||||
image_height=image_height,
|
||||
label_height=label_height,
|
||||
spacing=spacing,
|
||||
|
||||
@@ -86,13 +86,18 @@ def group_by_character(rows: Iterable[dict]) -> Dict[str, List[dict]]:
|
||||
|
||||
def load_missing_minifigs(path: Path) -> set[str]:
|
||||
"""Charge les ressources minifigs introuvables consignées dans le log de téléchargement."""
|
||||
return load_missing_resources(path, "minifig.jpg")
|
||||
|
||||
|
||||
def load_missing_resources(path: Path, filename: str) -> set[str]:
|
||||
"""Charge les ressources introuvables d'un type donné consignées dans le log de téléchargement."""
|
||||
missing: set[str] = set()
|
||||
with path.open() as csv_file:
|
||||
reader = csv.DictReader(csv_file)
|
||||
for row in reader:
|
||||
if row["status"] != "missing":
|
||||
continue
|
||||
if not row["path"].endswith("minifig.jpg"):
|
||||
if not row["path"].endswith(filename):
|
||||
continue
|
||||
missing.add(row["path"])
|
||||
return missing
|
||||
|
||||
Reference in New Issue
Block a user