def main()

in podcast/main.py [0:0]


def main(_) -> None:
    topic = "LLMs"

    gemini = make_gemini()

    producer = make_producer(gemini)
    marcus = agent_to_string("Marcus", make_marcus(gemini))
    elena = agent_to_string("Elena", make_elena(gemini))

    headlines = search_news(topic)

    intro = Crew(
        agents=[producer], tasks=[make_intro(producer)], verbose=2
    ).kickoff(
        inputs={
            "elena": elena,
            "marcus": marcus,
            "recipient": "Peter Danenberg",
            "date": date.today().strftime("%Y-%m-%d"),
            "topic": topic,
        }
    )

    segment = Crew(
        agents=[producer], tasks=[make_segment(producer)], verbose=2
    ).kickoff(
        inputs={
            "article": headlines,
            "elena": elena,
            "marcus": marcus,
        }
    )

    music = Crew(
        agents=[producer], tasks=[make_music(producer)], verbose=2
    ).kickoff(
        inputs={
            "article": headlines,
            "elena": elena,
            "marcus": marcus,
        }
    )

    (
        mix_intro(record_dialog(intro), AudioSegment.from_file(music))
        + record_dialog(segment)
    ).export(
        podcast := tempfile.NamedTemporaryFile(
            suffix=".mp3", delete=False
        ).name
    )

    cover = make_image(topic)

    ffmpeg_command = [
        "ffmpeg",
        "-loop",
        "1",  # Loop the image
        "-i",
        cover,  # Input image file
        "-i",
        podcast,  # Input audio file
        "-c:v",
        "libx264",  # Video codec to use
        "-tune",
        "stillimage",  # Tune for still image
        "-c:a",
        "aac",  # Audio codec to use
        "-b:a",
        "192k",  # Audio bitrate
        "-pix_fmt",
        "yuv420p",  # Pixel format
        "-shortest",  # Finish encoding when the shortest input stream ends
        "-vf",
        "fps=25",  # Set frame rate
        "-t",
        "10",  # Set the duration of the output file
        "podcast.mp4",  # Output file
    ]

    subprocess.run(ffmpeg_command, check=True)