Compare commits

..

No commits in common. "a0ff199506921b8b4053f71606f5356bcfa93070" and "f103ce86495a522a8f7deec3891dd1bd97ede7e4" have entirely different histories.

2 changed files with 530 additions and 1316 deletions

File diff suppressed because it is too large Load Diff

30
script.py Executable file → Normal file
View File

@ -1,28 +1,10 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: CC0-1.0
from mako.template import Template
import json
import itertools
import argparse
def render(spaces, template):
appTemplate = Template(filename=template)
print(appTemplate.render(s=spaces))
appTemplate = Template(filename='./spaces.html')
f = open('libregamingspaces.json')
spaces=json.load(f)
def make_hierarchy(room, loops, depth=0):
try:
print(' ' * depth + '- ' + room['name'])
if room['children_state'] and room['room_id'] not in loops:
for child in room['children_state']:
make_hierarchy(ROOMS[child['state_key']], loops, depth+1)
except:
# missing or no name
print(' ' * depth + ' Skip ' + room['room_id'])
if __name__ == '__main__':
with open('libregamingspaces.json') as f:
data = json.load(f)
# render(data, './spaces.html')
ROOMS = {room['room_id'] : room for room in data}
make_hierarchy(ROOMS['!IdUUdKALNzBLKEjvbP:matrix.org'], ['!JTpfWshTKZpZiUASvP:hacklab.fi'])
print(appTemplate.render(s=spaces))