✨ lib: read_recipes()
This commit is contained in:
parent
d54fd73e53
commit
6c7ad52c72
4 changed files with 7 additions and 30 deletions
|
|
@ -3,6 +3,7 @@ import re
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from config import *
|
from config import *
|
||||||
|
from lib import *
|
||||||
|
|
||||||
|
|
||||||
def clean_recipe(recipe):
|
def clean_recipe(recipe):
|
||||||
|
|
@ -85,12 +86,7 @@ def main():
|
||||||
|
|
||||||
# Read all and check
|
# Read all and check
|
||||||
|
|
||||||
recipes = []
|
recipes = read_recipes()
|
||||||
for json_file in os.listdir(OUTDIR_JSON):
|
|
||||||
with open(os.path.join(OUTDIR_JSON, json_file), "r", encoding="utf-8") as f:
|
|
||||||
data = json.load(f)
|
|
||||||
recipes.append(data)
|
|
||||||
|
|
||||||
for recipe in recipes:
|
for recipe in recipes:
|
||||||
md = check_recipe(recipe)
|
md = check_recipe(recipe)
|
||||||
if not md:
|
if not md:
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import os
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from config import *
|
from config import *
|
||||||
|
from lib import *
|
||||||
|
|
||||||
include_title = False
|
include_title = False
|
||||||
|
|
||||||
|
|
@ -107,11 +108,7 @@ def format_recipe_to_markdown(recipe):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
recipes = []
|
recipes = read_recipes()
|
||||||
for json_file in os.listdir(OUTDIR_JSON):
|
|
||||||
with open(os.path.join(OUTDIR_JSON, json_file), "r", encoding="utf-8") as f:
|
|
||||||
data = json.load(f)
|
|
||||||
recipes.append(data)
|
|
||||||
|
|
||||||
for recipe in tqdm(recipes):
|
for recipe in tqdm(recipes):
|
||||||
markdown_fn = f"{recipe.get('name', 'Untitled Recipe')}.md"
|
markdown_fn = f"{recipe.get('name', 'Untitled Recipe')}.md"
|
||||||
|
|
|
||||||
|
|
@ -77,19 +77,7 @@ def main():
|
||||||
|
|
||||||
Path("fruehstueck.csv").unlink(missing_ok=True)
|
Path("fruehstueck.csv").unlink(missing_ok=True)
|
||||||
|
|
||||||
recipes = []
|
recipes = read_recipes(keyword="Frühstück")
|
||||||
for json_file in os.listdir(OUTDIR_JSON):
|
|
||||||
with open(os.path.join(OUTDIR_JSON, json_file), "r", encoding="utf-8") as f:
|
|
||||||
data = json.load(f)
|
|
||||||
recipes.append(data)
|
|
||||||
recipes.sort(key=lambda r: r["name"])
|
|
||||||
|
|
||||||
# filter "Frühstück"
|
|
||||||
recipes = [
|
|
||||||
r
|
|
||||||
for r in recipes
|
|
||||||
if any(k["name"] == "Fr\u00fchst\u00fcck" for k in r["keywords"])
|
|
||||||
]
|
|
||||||
|
|
||||||
with open("fruehstueck.csv", "w", newline="") as f:
|
with open("fruehstueck.csv", "w", newline="") as f:
|
||||||
fwriter = csv.writer(
|
fwriter = csv.writer(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import os
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from config import *
|
from config import *
|
||||||
|
from lib import *
|
||||||
|
|
||||||
|
|
||||||
def allergens_for_step_ingredients(step):
|
def allergens_for_step_ingredients(step):
|
||||||
|
|
@ -59,12 +60,7 @@ def main():
|
||||||
Path("report_allergene_korrektur.csv").unlink(missing_ok=True)
|
Path("report_allergene_korrektur.csv").unlink(missing_ok=True)
|
||||||
Path("report_allergene.md").unlink(missing_ok=True)
|
Path("report_allergene.md").unlink(missing_ok=True)
|
||||||
|
|
||||||
recipes = []
|
recipes = read_recipes()
|
||||||
for json_file in os.listdir(OUTDIR_JSON):
|
|
||||||
with open(os.path.join(OUTDIR_JSON, json_file), "r", encoding="utf-8") as f:
|
|
||||||
data = json.load(f)
|
|
||||||
recipes.append(data)
|
|
||||||
recipes.sort(key=lambda r: r["name"])
|
|
||||||
|
|
||||||
for recipe in recipes:
|
for recipe in recipes:
|
||||||
with open("report_allergene_korrektur.csv", "a") as f:
|
with open("report_allergene_korrektur.csv", "a") as f:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue