Add Park Minseo gym date CG progression
This commit is contained in:
@@ -43,6 +43,18 @@ def png_dimensions(path: Path) -> tuple[int, int]:
|
||||
return width, height
|
||||
|
||||
|
||||
def validate_asset_image(path: Path, min_width: int, min_height: int, label: str) -> None:
|
||||
if not path.exists():
|
||||
fail(f"{label} asset is missing: {path}")
|
||||
|
||||
width, height = png_dimensions(path)
|
||||
if width < min_width or height < min_height:
|
||||
fail(
|
||||
f"{label} asset is too small: "
|
||||
f"{width}x{height}, minimum {min_width}x{min_height}"
|
||||
)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
characters_doc = load_json(DATA / "characters.json")
|
||||
assets_doc = load_json(DATA / "character_assets.json")
|
||||
@@ -90,24 +102,68 @@ def main() -> None:
|
||||
if "path" not in entry:
|
||||
fail(f"{entry['character_id']} has status {status} but no path")
|
||||
|
||||
path = ROOT / entry["path"]
|
||||
if not path.exists():
|
||||
fail(f"{entry['character_id']} asset is missing: {path}")
|
||||
|
||||
width, height = png_dimensions(path)
|
||||
if width < min_width or height < min_height:
|
||||
fail(
|
||||
f"{entry['character_id']} asset is too small: "
|
||||
f"{width}x{height}, minimum {min_width}x{min_height}"
|
||||
)
|
||||
validate_asset_image(
|
||||
ROOT / entry["path"],
|
||||
min_width,
|
||||
min_height,
|
||||
entry["character_id"],
|
||||
)
|
||||
|
||||
revision_count = sum(
|
||||
1 for entry in asset_entries if entry["status"] == "needs_revision"
|
||||
)
|
||||
|
||||
date_cg_accepted = 0
|
||||
date_cg_revision_count = 0
|
||||
for cg_set in assets_doc.get("date_cgs", []):
|
||||
character_id = cg_set["character_id"]
|
||||
if character_id not in character_id_set:
|
||||
fail(f"date CG set references missing character id: {character_id}")
|
||||
|
||||
if cg_set["status"] not in {"accepted", "partial", "needs_revision", "pending", "rejected"}:
|
||||
fail(f"{cg_set['set_id']} has invalid status {cg_set['status']}")
|
||||
|
||||
previous_max = -1
|
||||
for tier in cg_set["tiers"]:
|
||||
status = tier["status"]
|
||||
if status not in {"accepted", "needs_revision", "pending", "rejected"}:
|
||||
fail(f"{cg_set['set_id']} tier has invalid status {status}")
|
||||
|
||||
affection_min = tier["affection_min"]
|
||||
affection_max = tier["affection_max"]
|
||||
if affection_min <= previous_max:
|
||||
fail(f"{cg_set['set_id']} has overlapping affection tiers")
|
||||
if affection_max is not None and affection_max < affection_min:
|
||||
fail(f"{cg_set['set_id']} has an invalid affection tier range")
|
||||
previous_max = affection_max if affection_max is not None else affection_min
|
||||
|
||||
path_value = tier.get("path")
|
||||
if status == "accepted":
|
||||
date_cg_accepted += 1
|
||||
if not path_value:
|
||||
fail(f"{cg_set['set_id']} accepted tier lacks a path")
|
||||
validate_asset_image(
|
||||
ROOT / path_value,
|
||||
min_width,
|
||||
min_height,
|
||||
f"{cg_set['set_id']} affection {affection_min}",
|
||||
)
|
||||
elif status == "needs_revision":
|
||||
date_cg_revision_count += 1
|
||||
if path_value:
|
||||
validate_asset_image(
|
||||
ROOT / path_value,
|
||||
min_width,
|
||||
min_height,
|
||||
f"{cg_set['set_id']} revision candidate {affection_min}",
|
||||
)
|
||||
|
||||
print(
|
||||
"Validated character asset manifest: "
|
||||
f"{accepted}/{len(asset_entries)} accepted, "
|
||||
f"{revision_count} needs revision."
|
||||
f"{revision_count} needs revision, "
|
||||
f"{date_cg_accepted} accepted date CG tiers, "
|
||||
f"{date_cg_revision_count} date CG tiers need revision."
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user