]> OzVa Git service - bread/commitdiff
Added tqdm bars and some messages to track compile
authorMax Value <greenwoodw50@gmail.com>
Tue, 13 May 2025 00:27:01 +0000 (01:27 +0100)
committerMax Value <greenwoodw50@gmail.com>
Tue, 13 May 2025 00:27:01 +0000 (01:27 +0100)
+ tqdm dependancy

sous.py

diff --git a/sous.py b/sous.py
index 9b91fe32ffb154640de449e917fb9c6d484976d5..0770aeefbc45917b8ed73ebc8cdc6a1d59f4baf6 100755 (executable)
--- 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!")