satisfactory/required.py

32 lines
716 B
Python
Raw Normal View History

#!/usr/bin/env python3
import json
import typing
import os
if __name__ == '__main__':
root = os.path.dirname(__file__)
recipe_root = os.path.join(root, 'data', 'recipes')
recipes = dict()
for dirname, dirs, files in os.walk(recipe_root):
for f in files:
path = os.path.join(dirname, f)
name, _ = os.path.splitext(f)
with open(path, 'r') as src:
variations = json.load(src)
recipes[name] = variations
2019-04-27 18:50:20 +10:00
resources = set()
for output, variations in recipes.items():
for option in variations:
if len(option['input']) == 0:
resources.add(output)
print("Resources:", resources)