From 0801d27fa22733d7923b1bccb605fccdff5ca599 Mon Sep 17 00:00:00 2001 From: David Huss <dh@atoav.com> Date: Thu, 28 May 2020 14:10:14 +0200 Subject: [PATCH] Fix json output (add endpoints) --- bbbmon/meetings.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bbbmon/meetings.py b/bbbmon/meetings.py index e5f759d..ec47176 100644 --- a/bbbmon/meetings.py +++ b/bbbmon/meetings.py @@ -358,7 +358,22 @@ def meetings_twolines(config: Config, watch: int, fancy: bool, sum_:bool): def format_json(config: Config, watch: bool, compact: bool) -> str: - meetings = [get_meetings(e.secret, e.url, config.path, sum_=False) for e in config.endpoints] + meetings = [] + + for e, meeting in [(e, get_meetings(e.secret, e.url, config.path, sum_=False)) for e in config.endpoints]: + # metting = [m for m in ] + + if meeting == ["unreachable"]: + meeting = [{"unreachable" : "true"}] + else: + meeting[0]["unreachable"] = "false" + + for m in meeting: + m["endpoint"] = e.name + + meetings.append(meeting) + + # Clear screen after request is done, and before printing new data to keep # blinking to a minimum -- GitLab