-
Notifications
You must be signed in to change notification settings - Fork 1
/
configloader.py
37 lines (27 loc) · 952 Bytes
/
configloader.py
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
36
37
import json
import variables
from developer_func import log
from variables import config
def save_config():
try:
with open('config.json', "w") as f:
tempconfig = config.copy()
tempconfig['setup_trackdown'] = False
tempconfig['setup_trackup'] = False
tempconfig['set_exclude'] = False
tempconfig['excluded'] = config['excluded']
tempconfig['current_warning'] = ""
tempconfig['current_channel'] = config['current_channel']
f.write(json.dumps(tempconfig))
except Exception:
log("Error loading the File")
def load_config():
try:
with open('config.json', "r") as f:
config = json.load(f)
return config
except FileNotFoundError as e:
with open('config.json', "w") as f:
log("Config error")
f.write(json.dumps(variables.config))
return variables.config