refactor python to support multiple actions
* executable, license header * prefer `with open` style to auto-close file handles * keep hardcoding within __main__
This commit is contained in:
parent
585fde2898
commit
e451a10bf3
|
@ -1,10 +1,15 @@
|
||||||
|
#!/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
|
|
||||||
|
|
||||||
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))
|
if __name__ == '__main__':
|
||||||
|
with open('libregamingspaces.json') as f:
|
||||||
|
spaces = json.load(f)
|
||||||
|
|
||||||
|
render(spaces, './spaces.html')
|
||||||
|
|
Loading…
Reference in New Issue