From: Max Value Date: Tue, 13 May 2025 00:27:01 +0000 (+0100) Subject: Added tqdm bars and some messages to track compile X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=e366622d86e525afd98a443277ebee9a1636ea5c;p=bread Added tqdm bars and some messages to track compile + tqdm dependancy --- diff --git a/sous.py b/sous.py index 9b91fe3..0770aee 100755 --- a/sous.py +++ b/sous.py @@ -4,6 +4,7 @@ import tomllib from os import path, listdir, system from jinja2 import Environment, FileSystemLoader from datetime import datetime +from tqdm import tqdm class RecipeBook: def __init__(self): @@ -27,7 +28,8 @@ class RecipeBook: def render_html(self): keywords = {} - for recipe in self.recipes: + print("Generating HTML pages...") + for recipe in tqdm(self.recipes): recipe.render_html(self.html_environment) for word in recipe.recipe["information"]["keywords"]: @@ -44,12 +46,14 @@ class RecipeBook: recipe.recipe["information"]["description"] )]} + print("Generating homepage...") template = self.html_environment.get_template("index.html") with open("index.html", "w") as f: f.write(template.render(recipes = self.recipes, keywords = keywords, time = datetime.now())) def render_latex(self): - for recipe in self.recipes: + print("Generating pdf documents...") + for recipe in tqdm(self.recipes): recipe.render_latex(self.latex_environment) class Recipe: @@ -78,7 +82,7 @@ class Recipe: with open(path.join("build", self.recipe["tex"]), "w") as f: f.write(template.render(recipe = self.recipe)) - system(f"pdflatex -interaction='nonstopmode' -output-directory='build' 'build/{self.recipe['tex']}'") + system(f"pdflatex -interaction='nonstopmode' -output-directory='build' 'build/{self.recipe['tex']}' > /dev/zero") system(f"mv build/{self.recipe['pdf']} recipes") # main @@ -86,5 +90,6 @@ class Recipe: recipe_book = RecipeBook() recipe_book.render_html() recipe_book.render_latex() +print("Happy baking!")