first commit
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import base64
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
raw_json = os.environ.get("OPTIONS_B64_JSON", "[]").strip()
|
||||||
|
|
||||||
|
try:
|
||||||
|
options_b64 = json.loads(raw_json)
|
||||||
|
except json.JSONDecodeError as exc:
|
||||||
|
print(f"FEHLER: OPTIONS_B64_JSON ist kein gültiges JSON: {exc}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
options = []
|
||||||
|
|
||||||
|
for raw in options_b64:
|
||||||
|
if not raw:
|
||||||
|
continue
|
||||||
|
|
||||||
|
raw = str(raw).strip()
|
||||||
|
if not raw:
|
||||||
|
continue
|
||||||
|
|
||||||
|
try:
|
||||||
|
decoded = base64.b64decode(raw).decode("utf-8")
|
||||||
|
options.extend(json.loads(decoded))
|
||||||
|
except Exception as exc:
|
||||||
|
print(f"WARNUNG: Ein Host-Ergebnis konnte nicht gelesen werden: {exc}", file=sys.stderr)
|
||||||
|
|
||||||
|
options = sorted(set(options))
|
||||||
|
|
||||||
|
with open("select_options.json", "w", encoding="utf-8") as f:
|
||||||
|
json.dump(options, f, indent=2, ensure_ascii=False)
|
||||||
|
|
||||||
|
print("==========================================")
|
||||||
|
print("Dropdown-Liste gebaut")
|
||||||
|
print(f"Dropdown-Optionen: {len(options)}")
|
||||||
|
print("==========================================")
|
||||||
|
|
||||||
|
print("")
|
||||||
|
print("Dropdown-Liste:")
|
||||||
|
print(json.dumps(options, indent=2, ensure_ascii=False))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user