Added label to json

This commit is contained in:
Niklas Friesen
2026-04-15 21:25:34 +02:00
parent 2ff9f57567
commit 69a538573c
2 changed files with 26 additions and 4 deletions

View File

@@ -2,11 +2,11 @@
# -*- coding: utf-8 -*-
"""
Fetch Nintendo Switch firmware release metadata from THZoria/NX_Firmware via the GitHub API
and write a JSON list of {tag, download} for each release that has a .zip asset.
and write a JSON list of {tag, label, download} for each release that has a .zip asset.
Example:
python3 generate_nx_firmware_json.py
python3 generate_nx_firmware_json.py -o archive.json --min 18.0.0
python3 generate_fw_archive.py
python3 generate_fw_archive.py -o archive.json --min 18.0.0
"""
from __future__ import annotations
@@ -93,7 +93,9 @@ def build_entries(
url = pick_zip_url(rel.get("assets") or [])
if not url:
continue
out.append({"tag": tag, "download": url})
name = str(rel.get("name") or "").strip()
label = name if name else f"Firmware {tag}"
out.append({"tag": tag, "label": label, "download": url})
out.sort(key=lambda e: parse_fw_tag(e["tag"]) or (0, 0, 0), reverse=True)
return out