Main entry point
()
| 354 | |
| 355 | |
| 356 | def main(): |
| 357 | """Main entry point""" |
| 358 | try: |
| 359 | # Parse arguments |
| 360 | args = parse_args() |
| 361 | |
| 362 | # Validate input file |
| 363 | input_path = validate_input_file(args.input) |
| 364 | |
| 365 | # Create output directory |
| 366 | output_dir = create_output_dir(args) |
| 367 | |
| 368 | log.info("%s", "=" * 60) |
| 369 | log.info("PPT2Polish - Step 1: Convert PPTX to Images") |
| 370 | log.info("%s", "=" * 60) |
| 371 | |
| 372 | # Step 1: Convert PPTX to PDF |
| 373 | pdf_path = convert_pptx_to_pdf(input_path, output_dir) |
| 374 | |
| 375 | # Step 2: Convert PDF to images |
| 376 | image_paths = convert_pdf_to_images(pdf_path, output_dir) |
| 377 | |
| 378 | log.info("%s", "=" * 60) |
| 379 | log.info("PPT2Polish - Step 2: Beautify Slides") |
| 380 | log.info("%s", "=" * 60) |
| 381 | |
| 382 | # Step 3: Run workflow to beautify slides |
| 383 | final_state = asyncio.run(run_ppt2polish_workflow(args, image_paths, output_dir)) |
| 384 | |
| 385 | # Print results |
| 386 | print_results(final_state, output_dir) |
| 387 | |
| 388 | return 0 |
| 389 | |
| 390 | except FileNotFoundError as e: |
| 391 | log.error("%s", e) |
| 392 | return 1 |
| 393 | except ValueError as e: |
| 394 | log.error("%s", e) |
| 395 | return 1 |
| 396 | except RuntimeError as e: |
| 397 | log.error("%s", e) |
| 398 | return 1 |
| 399 | except Exception as e: |
| 400 | log.exception("Workflow execution failed: %s", e) |
| 401 | import traceback |
| 402 | traceback.print_exc() |
| 403 | return 1 |
| 404 | |
| 405 | |
| 406 | if __name__ == "__main__": |
no test coverage detected