lib: read_recipes()

This commit is contained in:
neingeist 2026-04-12 23:51:21 +02:00
parent d54fd73e53
commit 6c7ad52c72
4 changed files with 7 additions and 30 deletions

View file

@ -3,6 +3,7 @@ import re
import os
from config import *
from lib import *
def clean_recipe(recipe):
@ -85,12 +86,7 @@ def main():
# Read all and check
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 = read_recipes()
for recipe in recipes:
md = check_recipe(recipe)
if not md:

View file

@ -8,6 +8,7 @@ import os
from tqdm import tqdm
from config import *
from lib import *
include_title = False
@ -107,11 +108,7 @@ def format_recipe_to_markdown(recipe):
def main():
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 = read_recipes()
for recipe in tqdm(recipes):
markdown_fn = f"{recipe.get('name', 'Untitled Recipe')}.md"

View file

@ -77,19 +77,7 @@ def main():
Path("fruehstueck.csv").unlink(missing_ok=True)
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"])
# filter "Frühstück"
recipes = [
r
for r in recipes
if any(k["name"] == "Fr\u00fchst\u00fcck" for k in r["keywords"])
]
recipes = read_recipes(keyword="Frühstück")
with open("fruehstueck.csv", "w", newline="") as f:
fwriter = csv.writer(

View file

@ -7,6 +7,7 @@ import os
from tqdm import tqdm
from config import *
from lib import *
def allergens_for_step_ingredients(step):
@ -59,12 +60,7 @@ def main():
Path("report_allergene_korrektur.csv").unlink(missing_ok=True)
Path("report_allergene.md").unlink(missing_ok=True)
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"])
recipes = read_recipes()
for recipe in recipes:
with open("report_allergene_korrektur.csv", "a") as f: