import json
import os


if __name__ == "__main__":
    all_files = os.sys.argv[1:]
    print(all_files)
    keys = {}
    for file in all_files:
        js = json.load(open(file))
        for k, v in js.items():
            if k in ['filament_id','setting_id',"type","name","from","instantiation","inherits","compatible_printers","filename_format"]:
                continue
            if type(v) == list:
                v = v[0]
            keys[k] = v
    print(json.dumps(keys))
    with open("0.08mm_Extra_Fine.ini", "w") as f:
        for k, v in keys.items():
            v_str = v.replace('\n', '\\n')
            f.write(f"{k} = {v_str}\n")