|
|
@ -1,8 +1,16 @@
|
|
|
|
from parse import *
|
|
|
|
from parse import *
|
|
|
|
from calc import calc
|
|
|
|
from calc import *
|
|
|
|
from db import *
|
|
|
|
from db import *
|
|
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
print('''1. Обновить всё.
|
|
|
|
|
|
|
|
2. Пересчитать рецепты.
|
|
|
|
|
|
|
|
''')
|
|
|
|
|
|
|
|
inp = input(">> ")
|
|
|
|
|
|
|
|
print('\n')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vols = [30, 50, 100]
|
|
|
|
|
|
|
|
if inp == '1':
|
|
|
|
|
|
|
|
print('Парсим и обрабатываем данные...')
|
|
|
|
# Загружаем локализацию
|
|
|
|
# Загружаем локализацию
|
|
|
|
locales_url = ['medicine', 'chemicals']
|
|
|
|
locales_url = ['medicine', 'chemicals']
|
|
|
|
locales = load_locales(locales_url)
|
|
|
|
locales = load_locales(locales_url)
|
|
|
@ -13,11 +21,23 @@ raw_recipes = load_recipes(recipes_url)
|
|
|
|
|
|
|
|
|
|
|
|
# Локализируем
|
|
|
|
# Локализируем
|
|
|
|
recipes = localize(raw_recipes, locales)
|
|
|
|
recipes = localize(raw_recipes, locales)
|
|
|
|
# Сохранаяем данные
|
|
|
|
|
|
|
|
save(recipes, 'raw_db.json')
|
|
|
|
save(recipes, 'raw_db.json')
|
|
|
|
'''
|
|
|
|
print('Сохранены минимальные рецепты в raw_db.json')
|
|
|
|
|
|
|
|
print('Выполняем предрасчёты...')
|
|
|
|
|
|
|
|
|
|
|
|
rec = load('raw_db.json')
|
|
|
|
for i in vols:
|
|
|
|
|
|
|
|
precalc = calc_all(recipes, i)
|
|
|
|
|
|
|
|
save(precalc, f'{i}_calc.json')
|
|
|
|
|
|
|
|
print(f'Данные сохранены в {i}_calc.json')
|
|
|
|
|
|
|
|
elif inp == '2':
|
|
|
|
|
|
|
|
print('Выполняем расчёты...')
|
|
|
|
|
|
|
|
recipes = load('raw_db.json')
|
|
|
|
|
|
|
|
for i in vols:
|
|
|
|
|
|
|
|
precalc = calc_all(recipes, i)
|
|
|
|
|
|
|
|
save(precalc, f'{i}_calc.json')
|
|
|
|
|
|
|
|
print(f'Данные сохранены в {i}_calc.json')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
exit()
|
|
|
|
|
|
|
|
|
|
|
|
# Делаем предрасчёты
|
|
|
|
print("ГОТОВО.")
|
|
|
|
#calculated =
|
|
|
|
|
|
|
|