# souzatharsis/podcastfy architecture

> Architecture diagram of the GitHub repository souzatharsis/podcastfy, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/souzatharsis/podcastfy
- Repository: https://github.com/souzatharsis/podcastfy

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Content Input Layer:
- Multimodal Content Handlers (PDF, Website, YouTube, Images)
- URL Processor
- File System Interface

b) Content Processing Layer:
- Content Parser Module
- Text Extraction Services
- Transcript Generation System

c) AI/ML Services Layer:
- LLM Integration (OpenAI, Anthropic, Google, Local LLMs)
- Text-to-Speech Providers (OpenAI, Google, ElevenLabs, Microsoft Edge)

d) Audio Processing Layer:
- Audio Generation System
- Multi-speaker Processing
- Audio Format Handlers

##### Component Relationships

**Input Sources → Content Parser → LLM Processing → TTS Generation → Final Audio Output**

With parallel paths for:
- Configuration Management
- Logging System
- Error Handling

##### Architectural Patterns

a) Factory Pattern (visible in tts/factory.py)
b) Provider Pattern (shown in tts/providers/)
c) Modular Architecture (content_parser separation)

##### Key Subsystems to Highlight

a) Content Parser Subsystem:
**content_parser/**
- content_extractor.py
- pdf_extractor.py
- website_extractor.py
- youtube_transcriber.py

b) TTS Provider Subsystem:
**tts/**
- providers/
- edge.py
- elevenlabs.py
- gemini.py
- geminimulti.py
- openai.py
- factory.py

##### Integration Points

Clear integration points for:
- External API Services
- Local LLM Options
- Custom Configuration Inputs
- Multiple Language Support

##### Configuration Management

Configuration components:
- config.yaml
- conversation_config.yaml
- API keys management
- Custom settings handling

This architecture should reflect both the current implementation and allow for the future expansions mentioned in the changelog, such as multi-speaker TTS models and real-time web search integration.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        URL[URL Input]
        PDF["PDF Handler"]:::file
        Web["Website Handler"]:::file
        YT["YouTube Handler"]:::file
        FS["File System"]
    end

    subgraph Processing
        CP["Content Parser"]:::file
        CG["Content Generator"]:::file
        TE["Text Extraction"]
    end

    subgraph "AI/ML Services"
        LLM["LLM Integration Factory"]:::file
        subgraph "TTS Providers"
            OAPI["OpenAI Provider"]:::file
            ELABS["ElevenLabs Provider"]:::file
            GEM["Gemini Provider"]:::file
            EDGE["Edge Provider"]:::file
        end
    end

    subgraph "Audio Processing"
        TTS["Text-to-Speech Core"]:::file
        TTSB["TTS Base"]:::file
        AF["Audio Format Handler"]
    end

    subgraph "System Services"
        LOG["Logging System"]:::file
        CLI["Client Interface"]:::file
        subgraph "Configuration"
            CONF["Main Config"]:::file
            CCONF["Conversation Config"]:::file
            CUTIL["Config Utils"]:::file
            CCUTIL["Conversation Config Utils"]:::file
        end
    end

    subgraph "Storage"
        AS["Audio Storage"]:::dir
        TS["Transcript Storage"]:::dir
        PS["PDF Storage"]:::dir
    end

    %% Connections
    URL --> CP
    PDF --> CP
    Web --> CP
    YT --> CP
    FS --> CP
    
    CP --> CG
    CG --> TE
    TE --> LLM
    
    LLM --> |Provider Selection| OAPI & ELABS & GEM & EDGE
    OAPI & ELABS & GEM & EDGE --> TTS
    TTS --> |Base Implementation| TTSB
    TTSB --> AF
    
    AF --> AS
    CP --> TS
    PDF --> PS
    
    CONF & CCONF --> CUTIL
    CCONF --> CCUTIL
    LOG --> CLI
    
    %% Click Events
    click PDF "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/content_parser/pdf_extractor.py"
    click Web "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/content_parser/website_extractor.py"
    click YT "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/content_parser/youtube_transcriber.py"
    click CP "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/content_parser/content_extractor.py"
    click CG "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/content_generator.py"
    click LLM "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/tts/factory.py"
    click OAPI "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/tts/providers/openai.py"
    click ELABS "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/tts/providers/elevenlabs.py"
    click GEM "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/tts/providers/gemini.py"
    click EDGE "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/tts/providers/edge.py"
    click TTS "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/text_to_speech.py"
    click TTSB "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/tts/base.py"
    click CONF "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/config.yaml"
    click CCONF "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/conversation_config.yaml"
    click CUTIL "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/utils/config.py"
    click CCUTIL "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/utils/config_conversation.py"
    click LOG "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/utils/logger.py"
    click CLI "https://github.com/souzatharsis/podcastfy/blob/main/podcastfy/client.py"
    click AS "https://github.com/souzatharsis/podcastfy/tree/main/data/audio/"
    click TS "https://github.com/souzatharsis/podcastfy/tree/main/data/transcripts/"
    click PS "https://github.com/souzatharsis/podcastfy/tree/main/data/pdf/"

    %% Styles
    classDef file fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef dir fill:#ffcc99,stroke:#333,stroke-width:2px
    
    %% Legend
    subgraph Legend
        L1["File"]:::file
        L2["Directory"]:::dir
    end
```
