import argparse import logging import os import sources from detector import Detector from downloader_manager import download_mp4_and_extract_audio from sorter import SlideSorter def process_video(link): try: temp_video_file_path, audio_path = download_mp4_and_extract_audio(link) detector = Detector(temp_video_file_path) logging.info("Detecting Slides...") detected_slides = detector.detect_slides() sorter = SlideSorter(sources.ListSource(detected_slides)) logging.info("Sorting Slides...") sorted_slides = sorter.sort() os.remove(temp_video_file_path) return sorted_slides, audio_path except Exception as e: logging.exception("Failed to execute process_video: %s", e) return None, None if __name__ == '__main__': Parser = argparse.ArgumentParser(description="File Processor") Parser.add_argument("-p", "--link") Args = Parser.parse_args() try: slides, path = process_video(Args.link) if slides is not None and path is not None: print("Video processed successfully.") else: print("Failed to process the video.") except Exception as e: logging.exception("An error occurred in main: %s", e)