Pipeline: parse HTML presets, compare modlists, download from Caddy file server, create junctions/symlinks to Arma 3 Server directory. Includes update/sync flows, missing-mod reporting, OS compat layer, shared config, dep checker, comprehensive test suite (71 tests). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
CLI entry point: cross-reference comparison.json against the file server and
|
|
report which required mods are missing.
|
|
|
|
Usage:
|
|
python report_missing.py
|
|
"""
|
|
|
|
import json
|
|
import sys
|
|
|
|
from arma_modlist_tools.compat import fix_console_encoding
|
|
from arma_modlist_tools.config import load_config
|
|
from arma_modlist_tools.fetcher import build_server_index
|
|
from arma_modlist_tools.reporter import build_missing_report, save_missing_report
|
|
|
|
fix_console_encoding()
|
|
|
|
|
|
def main() -> None:
|
|
cfg = load_config()
|
|
|
|
if not cfg.comparison.exists():
|
|
print(f"ERROR: {cfg.comparison} not found. Run compare_modlists.py first.")
|
|
sys.exit(1)
|
|
|
|
comparison = json.loads(cfg.comparison.read_text(encoding="utf-8"))
|
|
total_mods = (
|
|
comparison["shared"]["mod_count"]
|
|
+ sum(d["mod_count"] for d in comparison["unique"].values())
|
|
)
|
|
|
|
# ---- Build server index ----
|
|
print(f"\nChecking server index...")
|
|
index = build_server_index(cfg.server_url, cfg.server_auth)
|
|
print(f" {len(index['by_steam_id'])} mods indexed\n")
|
|
|
|
# ---- Build report ----
|
|
print(f"Cross-referencing {total_mods} required mods...")
|
|
report = build_missing_report(comparison, index)
|
|
save_missing_report(report, cfg.missing_report)
|
|
|
|
# ---- Print table ----
|
|
missing = report["missing_mods"]
|
|
if missing:
|
|
print(f"\n Missing from server ({len(missing)}):\n")
|
|
print(f" {'steam_id':<14} {'Group':<28} Name")
|
|
print(f" {'-'*14} {'-'*28} {'-'*40}")
|
|
for m in missing:
|
|
sid = m["steam_id"] or "---"
|
|
group = m["group"]
|
|
print(f" {sid:<14} {group:<28} {m['name']}")
|
|
else:
|
|
print("\n All required mods are on the server.")
|
|
|
|
print()
|
|
print(f" {report['on_server']} / {report['total_mods']} found on server")
|
|
print(f" Report saved: {cfg.missing_report}")
|
|
print()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|