Skip to content
Snippets Groups Projects

Metainfos

Merged Adam Fekete requested to merge metainfos into master
2 files
+ 37
0
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 32
0
import json
import sys
from pathlib import Path
cwd = Path(__file__).parent
def iter_folders(path):
for file in path.glob('**/metainfo.json'):
with open(file) as f:
yield json.load(f)
def save_into_file(data: dict):
if len(sys.argv) != 2:
print("Please define an json file as output!")
exit(1)
output = sys.argv[1]
with open(output, 'w') as f:
json.dump(data, f, indent=2)
if __name__ == '__main__':
# Defining the relative path of the tutorials
path = cwd / '../tutorials/'
list_of_tutorials = {'tutorials': list(iter_folders(path))}
print(json.dumps(list_of_tutorials, indent=2))
save_into_file(list_of_tutorials)
Loading