feat: Reprocess image user script (#6704)

This commit is contained in:
Michael Genson
2025-12-12 18:30:49 -06:00
committed by GitHub
parent 80dc2ecfb7
commit 326bb1eb8e
4 changed files with 220 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
import asyncio
import shutil
from logging import Logger
from pathlib import Path
from httpx import AsyncClient, Response
@@ -60,7 +61,7 @@ class InvalidDomainError(Exception):
class RecipeDataService(BaseService):
minifier: img.ABCMinifier
def __init__(self, recipe_id: UUID4) -> None:
def __init__(self, recipe_id: UUID4, logger: Logger | None = None) -> None:
"""
RecipeDataService is a service that consolidates the reading/writing actions related
to assets, and images for a recipe.
@@ -68,6 +69,7 @@ class RecipeDataService(BaseService):
super().__init__()
self.recipe_id = recipe_id
self.logger = logger or self.logger
self.minifier = img.PillowMinifier(purge=True, logger=self.logger)
self.dir_data = Recipe.directory_from_id(self.recipe_id)