eliminades duplicitats en els arguments
This commit is contained in:
@@ -41,12 +41,11 @@ def _print_preview(step: str, preview: dict, formato: str) -> None:
|
||||
print(f" {orig:<{_COL_W}} {final}")
|
||||
print(f"Formato final del archivo: {fmt}")
|
||||
|
||||
elif step == "convert":
|
||||
print(f"Conversión de formato de archivo a {preview['target_format']}.")
|
||||
|
||||
|
||||
def make_confirm_fn(args):
|
||||
def confirm_fn(step: str, preview: dict) -> bool:
|
||||
if step == "convert":
|
||||
return True # No destructivo, no necesita confirmación
|
||||
print()
|
||||
_print_preview(step, preview, args.formato)
|
||||
answer = input("¿Aplicar? [s/N] ").strip().lower()
|
||||
@@ -68,11 +67,6 @@ def parse_args():
|
||||
parser.add_argument("--uniformizar-imagenes", action="store_true")
|
||||
parser.add_argument("--formato-imagen", choices=["jpg", "png", "webp"], default="png")
|
||||
|
||||
# Fix flags (interactivos)
|
||||
parser.add_argument("--fix_remove_trash", action="store_true")
|
||||
parser.add_argument("--fix_page_numbering", action="store_true")
|
||||
parser.add_argument("--fix_image_extensions", action="store_true")
|
||||
parser.add_argument("--fix_all", action="store_true")
|
||||
parser.add_argument("--no-preguntar", action="store_true")
|
||||
|
||||
return parser.parse_args()
|
||||
@@ -96,29 +90,7 @@ def main():
|
||||
print()
|
||||
return
|
||||
|
||||
# --- Fix flags (interactivos) ---
|
||||
fix_steps = []
|
||||
if args.fix_remove_trash or args.fix_all:
|
||||
fix_steps.append("clean")
|
||||
if args.fix_page_numbering or args.fix_all:
|
||||
fix_steps.append("normalize_pages")
|
||||
if args.fix_image_extensions or args.fix_all:
|
||||
fix_steps.append("normalize_images")
|
||||
|
||||
if fix_steps:
|
||||
confirm_fn = None if args.no_preguntar else make_confirm_fn(args)
|
||||
pipeline = Pipeline(
|
||||
steps=fix_steps,
|
||||
desired_format=args.formato,
|
||||
desired_image_format="." + args.formato_imagen,
|
||||
)
|
||||
for f in comic_files:
|
||||
print(f"\n=== {f} ===")
|
||||
result = pipeline.run(f, confirm_fn=confirm_fn)
|
||||
print(result.summary())
|
||||
return
|
||||
|
||||
# --- Flags clásicos (sin confirmación) ---
|
||||
# --- Construir steps ---
|
||||
steps = []
|
||||
if args.limpiar or args.estandarizar:
|
||||
steps.append("clean")
|
||||
@@ -130,13 +102,15 @@ def main():
|
||||
steps.append("convert")
|
||||
|
||||
if steps:
|
||||
confirm_fn = None if args.no_preguntar else make_confirm_fn(args)
|
||||
pipeline = Pipeline(
|
||||
steps=steps,
|
||||
desired_format=args.formato,
|
||||
desired_image_format="." + args.formato_imagen,
|
||||
)
|
||||
for f in comic_files:
|
||||
result = pipeline.run(f)
|
||||
print(f"\n=== {f} ===")
|
||||
result = pipeline.run(f, confirm_fn=confirm_fn)
|
||||
print(result.summary())
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user