BetterLeaks / scan (push) Successful in 52s
Checks: - No stage letters in finalized stages (Dressed/Teasing/Teasing More) - No mixed bracketed/unnumbered in Topless/Topless Plus/Undressed - ArrivalAll composites exist Usage: python3 scripts/preflight_tier.py --tier Comfortable
130 lines
4.6 KiB
Python
130 lines
4.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Preflight check for a courtesan tier before packaging.
|
|
|
|
Usage:
|
|
python3 preflight_tier.py --tier Comfortable
|
|
"""
|
|
import argparse
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
from collections import defaultdict
|
|
|
|
BASE_DIR = Path("/home/rick/output/to-dnd-session/Grok-NPCs/Courtesans")
|
|
|
|
# Stages that should be finalized (letters stripped, one keeper per scene)
|
|
FINALIZED_STAGES = ["Dressed", "Teasing", "Teasing More", "Arrival"]
|
|
|
|
|
|
def preflight_check(tier_dir: Path):
|
|
"""Run preflight checks on finalized stages only."""
|
|
issues = []
|
|
warnings = []
|
|
|
|
# Check 1: No stage letters remaining in finalized stages
|
|
for stage in FINALIZED_STAGES:
|
|
stage_dir = tier_dir / stage
|
|
if not stage_dir.exists():
|
|
warnings.append(f"WARN: {stage} folder missing")
|
|
continue
|
|
|
|
for f in stage_dir.glob("*__*.jpg"):
|
|
# Check for stage letter patterns (but not Arrival which uses A1-C6 numbering)
|
|
if stage == "Arrival":
|
|
continue # Arrival uses letter+number, not just letter
|
|
|
|
# Pattern: _StageName + single letter + __
|
|
if re.search(r"_(Dressed|Teasing|TeasingMore)[A-Z]__", f.name):
|
|
issues.append(f"FAIL: Stage letter not stripped: {stage}/{f.name}")
|
|
|
|
# Check 2: Topless/Topless Plus/Undressed mixed bracketed/unnumbered
|
|
for stage in ["Topless", "Topless Plus", "Undressed"]:
|
|
stage_dir = tier_dir / stage
|
|
if not stage_dir.exists():
|
|
continue
|
|
|
|
by_base = defaultdict(list)
|
|
for f in stage_dir.glob("*__*.jpg"):
|
|
base = re.sub(r'\[[^\]]+\]__', '__', f.name)
|
|
base = re.sub(r'__.*', '', base)
|
|
has_bracket = bool(re.search(r'\[[^\]]+\]', f.name))
|
|
by_base[base].append((f.name, has_bracket))
|
|
|
|
for base, files in by_base.items():
|
|
has_numbered = any(has_bracket for _, has_bracket in files)
|
|
has_unnumbered = any(not has_bracket for _, has_bracket in files)
|
|
if has_numbered and has_unnumbered:
|
|
issues.append(f"FAIL: Mixed bracketed/unnumbered in {stage}: {base}")
|
|
|
|
# Check 3: Count finalized stage files
|
|
for stage in FINALIZED_STAGES:
|
|
stage_dir = tier_dir / stage
|
|
if stage_dir.exists():
|
|
count = len(list(stage_dir.glob("*__*.jpg")))
|
|
print(f"INFO: {count} {stage} files")
|
|
else:
|
|
warnings.append(f"WARN: {stage} folder missing")
|
|
|
|
# Check 4: ArrivalAll composites
|
|
arrival_dir = tier_dir / "Arrival"
|
|
if arrival_dir.exists():
|
|
arrival_all_singles = list(arrival_dir.glob("ArrivalAllSingles_*.jpg"))
|
|
arrival_all_men = list(arrival_dir.glob("ArrivalAllMen_*.jpg"))
|
|
arrival_all_ladies = list(arrival_dir.glob("ArrivalAllLadies_*.jpg"))
|
|
|
|
if not arrival_all_singles:
|
|
warnings.append("WARN: No ArrivalAllSingles composites found")
|
|
else:
|
|
print(f"INFO: {len(arrival_all_singles)} ArrivalAllSingles composites")
|
|
|
|
if arrival_all_men:
|
|
print(f"INFO: {len(arrival_all_men)} ArrivalAllMen composites")
|
|
if arrival_all_ladies:
|
|
print(f"INFO: {len(arrival_all_ladies)} ArrivalAllLadies composites")
|
|
|
|
return issues, warnings
|
|
|
|
|
|
def main():
|
|
ap = argparse.ArgumentParser(description="Preflight check for courtesan tier")
|
|
ap.add_argument('--tier', required=True, help='Tier name (e.g., Modest, Comfortable)')
|
|
ap.add_argument('--base-dir', default=str(BASE_DIR), help='Base directory for tiers')
|
|
args = ap.parse_args()
|
|
|
|
tier_dir = Path(args.base_dir) / args.tier
|
|
if not tier_dir.exists():
|
|
print(f"ERROR: Tier directory not found: {tier_dir}")
|
|
return 1
|
|
|
|
print("=" * 60)
|
|
print(f"{args.tier.upper()} TIER PREFLIGHT")
|
|
print("=" * 60)
|
|
|
|
print("\nRunning preflight checks (finalized stages only)...")
|
|
issues, warnings = preflight_check(tier_dir)
|
|
|
|
if warnings:
|
|
print("\nWARNINGS:")
|
|
for w in warnings:
|
|
print(f" {w}")
|
|
|
|
if issues:
|
|
print("\n" + "=" * 60)
|
|
print("PREFLIGHT FAILED")
|
|
print("=" * 60)
|
|
for issue in issues:
|
|
print(f" {issue}")
|
|
print("\nFix issues before packaging.")
|
|
return 1
|
|
else:
|
|
print("\n" + "=" * 60)
|
|
print("PREFLIGHT PASSED ✓")
|
|
print("=" * 60)
|
|
print(f"\n{args.tier} tier ready for finalization and packaging.")
|
|
print("\nNote: Topless not checked (human review not yet complete).")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|