Spaces:
Sleeping
Sleeping
File size: 824 Bytes
bca5262 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import json
import os
def read_json_file(filename):
with open(filename, 'r') as file:
data = json.load(file)
return data
default_json = read_json_file("presets/default.json")
user_json = read_json_file("presets/user.json")
default_dict = {}
for preset_name, preset_values in default_json.items():
default_dict[preset_name] = preset_values
user_dict = {}
for preset_name, preset_values in user_json.items():
user_dict[preset_name] = preset_values
default_names = []
user_names = []
def load_presets_names():
for _ in default_dict.keys():
default_names.append(_)
for _ in user_dict.keys():
user_names.append(_)
return default_names + user_names
def load_presets_value(name):
try:
return default_dict[name][0]
except:
return user_dict[name][0]
|