From dc158704fa091bccd691fb3706015a6265efa54d Mon Sep 17 00:00:00 2001 From: Nils Reiter Date: Sun, 22 Sep 2024 12:23:44 +0200 Subject: [PATCH] python script to extract colors from https://gist.githubusercontent.com/Hypfer/a0a8b5b9429831a7306ec4300077eaaa/raw/7e78e6bf58936237f8c0ce7a88a0e916619c3fc8/scenes.json --- convert.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 convert.py diff --git a/convert.py b/convert.py new file mode 100644 index 0000000..783cc66 --- /dev/null +++ b/convert.py @@ -0,0 +1,24 @@ +import json + +f = open("scenes.json") +obj = json.load(f) + +d = {} +l = [] + +for scene_set in obj["sets"]: + set_name = scene_set["name"] + for scene in scene_set["scenes"]: + scene_name = scene["name"] + bri = scene["bri"] + lights = [ [l["x"],l["y"]] for l in scene["lights"]] + s = { "c": lights, "b": round(bri/255, 3), "s": set_name } + d[scene_name] = s + l.append(set_name + ": " + scene_name) + +print(json.dumps(d, separators=(',', ':'))) + +l.sort() + +for s in l: + print(f"- \"{s}\"") \ No newline at end of file