afegits fixes especifics amb confirmació
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user