()
| 113 | |
| 114 | |
| 115 | def cmd_validate() -> int: |
| 116 | pairs = scan_urls() |
| 117 | bad: list[Path] = [] |
| 118 | missing: list[Path] = [] |
| 119 | for local, url in pairs: |
| 120 | if not local.exists(): |
| 121 | missing.append(local) |
| 122 | continue |
| 123 | if detect_image_kind(local) is None: |
| 124 | bad.append(local) |
| 125 | print(f"扫描到 {len(pairs)} 个 URL,缺失 {len(missing)},损坏 {len(bad)}") |
| 126 | for p in bad: |
| 127 | print(f" BAD {p}") |
| 128 | for p in missing[:20]: |
| 129 | print(f" MISSING {p}") |
| 130 | if len(missing) > 20: |
| 131 | print(f" ... 共 {len(missing)} 个缺失") |
| 132 | return 1 if bad or missing else 0 |
| 133 | |
| 134 | |
| 135 | def main() -> int: |
no test coverage detected