Merge changes from master
This commit is contained in:
commit
d0bda2688b
File diff suppressed because it is too large
Load Diff
|
@ -1,19 +1,33 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
|
||||||
from mako.template import Template
|
from mako.template import Template
|
||||||
import json
|
import json
|
||||||
import itertools
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
|
|
||||||
def mxc2url(mxc):
|
def mxc2url(mxc):
|
||||||
serverName = mxc.split('/')[2]
|
serverName = mxc.split('/')[2]
|
||||||
mediaId = mxc.split('/')[3]
|
mediaId = mxc.split('/')[3]
|
||||||
return "https://matrix.org/_matrix/media/v3/download/" + serverName + "/" + mediaId
|
return "https://matrix.org/_matrix/media/v3/download/" + serverName + "/" + mediaId
|
||||||
|
|
||||||
appTemplate = Template(filename='./spaces.html')
|
def render(spaces, template):
|
||||||
f = open('libregamingspaces.json')
|
appTemplate = Template(filename=template)
|
||||||
spaces=json.load(f)
|
print(appTemplate.render(s=spaces))
|
||||||
|
|
||||||
print(appTemplate.render(s=spaces))
|
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'])
|
||||||
|
|
Loading…
Reference in New Issue