21 lines
458 B
Python
Executable file
21 lines
458 B
Python
Executable file
#!/usr/bin/env python3
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
import qrcode
|
|
|
|
if len(sys.argv) != 3:
|
|
print("Usage: generer-qr.py <entree.json> <sortie.png>")
|
|
sys.exit(1)
|
|
|
|
src = Path(sys.argv[1])
|
|
dst = Path(sys.argv[2])
|
|
|
|
with open(src, "r", encoding="utf-8") as f:
|
|
data = json.load(f)
|
|
|
|
payload = "NQFS:" + json.dumps(data, ensure_ascii=False, separators=(",", ":"))
|
|
img = qrcode.make(payload)
|
|
img.save(dst)
|
|
|
|
print(f"QR généré : {dst}")
|