-
Notifications
You must be signed in to change notification settings - Fork 28
/
config.py
30 lines (23 loc) · 1015 Bytes
/
config.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
import yaml
def load_config():
print("Loading config file...")
with open('settings/config.yaml', 'r') as f:
config = yaml.safe_load(f)
url_info = [[None]*6 for _ in range(len(config['skins']))]
# Access the products list and loop over each product
for idx, skin in enumerate(config['skins']):
# Access the URL and its parameters for each product
url_info[idx][0] = skin['float']
url_info[idx][1] = skin['pattern']
url_info[idx][2] = skin['number_of_stickers']
url_info[idx][3] = skin['price']
url_info[idx][4] = skin['pages']
url_info[idx][5] = skin['url']
if url_info[idx][5] == None:
print("There is skin that have URL empty in config.yaml.\nExiting...")
return None
if url_info[idx][1] is not None:
if type(url_info[idx][1]) == str:
url_info[idx][1] = url_info[idx][1].split(', ')
print(f"Loaded {len(url_info)} skins!")
return url_info