afegits fixes especifics amb confirmació

This commit is contained in:
2026-02-19 09:46:32 +01:00
parent 56954717e3
commit 0f8f904b97
4 changed files with 188 additions and 28 deletions
+21
View File
@@ -6,6 +6,27 @@ from core.constants import IMAGE_EXTENSIONS
from core.result import StepResult
def preview_normalize_images(work_dir: str, target_ext: str) -> list[tuple[str, str]]:
"""Devuelve lista de (nombre_actual, nombre_final) sin convertir nada."""
target_ext = target_ext.lower()
if not target_ext.startswith("."):
target_ext = "." + target_ext
result = []
for root, _, files in os.walk(work_dir):
for f in files:
ext = os.path.splitext(f)[1].lower()
normalized_ext = ".jpg" if ext == ".jpeg" else ext
if ext not in IMAGE_EXTENSIONS:
continue
if normalized_ext == target_ext:
continue
stem = os.path.splitext(f)[0]
result.append((f, stem + target_ext))
return result
def normalize_images(work_dir: str, target_ext: str = ".jpg") -> StepResult:
"""
Convierte todas las imágenes al formato indicado por target_ext.