Fix duplicate icon assignment

This commit is contained in:
Jordan Wages 2025-07-19 03:58:41 -05:00
commit 4017b4ab72
211 changed files with 782 additions and 6 deletions

28
scripts/download_icons.py Normal file
View file

@ -0,0 +1,28 @@
import json
from urllib.request import urlopen, Request
from pathlib import Path
ICON_LIST_URL = "https://cc0-icons.jonh.eu/icons.json"
BASE_URL = "https://cc0-icons.jonh.eu/"
OUTPUT_DIR = Path(__file__).resolve().parent.parent / "static" / "icons"
def main() -> None:
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
req = Request(ICON_LIST_URL, headers={"User-Agent": "Mozilla/5.0"})
with urlopen(req) as resp:
data = json.load(resp)
icons = data.get("icons", [])
for icon in icons:
slug = icon.get("slug")
url = BASE_URL + icon.get("url")
path = OUTPUT_DIR / f"{slug}.svg"
req = Request(url, headers={"User-Agent": "Mozilla/5.0"})
with urlopen(req) as resp:
path.write_bytes(resp.read())
print(f"Downloaded {len(icons)} icons to {OUTPUT_DIR}")
if __name__ == "__main__":
main()