# frou/yt2pod architecture

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

- Interactive diagram: https://gitdiagram.com/frou/yt2pod
- Repository: https://github.com/frou/yt2pod

## Overview

##### Main Components Identification

a) External Services:
- YouTube Data API (for channel monitoring and video information)
- YouTube Content (for video downloads)
- Client Podcast Apps (consumers)

b) Core Components:
- HTTP Server (serves RSS feeds, artwork, and audio files)
- Channel Monitor/Watcher
- Media Processor
- Configuration Manager
- File System Storage

##### Configuration Layer
- Config Manager (config.go)
- System Setup (setup.go)

##### Monitoring Layer
- Channel Watcher (watcher.go)
- Health Monitor (health.go)

##### Processing Layer
- Video Processor (vid.go)
- Download Manager (internal/xplatform)
- Hit Counter (hits.go)

##### Serving Layer
- HTTP Server
- RSS Feed Generator
- File Server

##### Configuration flow
- Config file → Config Manager → All Components

##### Main processing flow
- YouTube API → Channel Watcher
- Channel Watcher → Video Processor
- Video Processor → File Storage
- File Storage → HTTP Server
- HTTP Server → Podcast Clients

##### Storage Elements

Storage components for:
- RSS Feeds (/meta/*.xml)
- Artwork (/meta/*.jpg)
- Audio/Video Episodes (/ep/*)
- Configuration (config.json)

##### Technical Details

Important technical aspects:
- HTTP endpoints (/meta/, /ep/)
- Configuration parameters
- YouTube API quota usage
- Cross-platform compatibility
- Docker volume mounts

Remember to indicate the asynchronous nature of the channel monitoring and video processing operations, as this is a daemon that runs continuously.

This system design should clearly show how the application fulfills its primary purpose of converting YouTube content into podcast feeds while maintaining efficiency and scalability.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph External
        YT[YouTube Data API]:::external
        YTC[YouTube Content]:::external
        PC[Podcast Clients]:::external
    end

    subgraph ConfigLayer
        CM["Configuration Manager"]:::config
        click CM "https://github.com/frou/yt2pod/blob/master/config.go"
        CF["Config File"]:::storage
        click CF "https://github.com/frou/yt2pod/blob/master/config.json"
        SU["System Setup"]:::config
        click SU "https://github.com/frou/yt2pod/blob/master/setup.go"
    end

    subgraph MonitoringLayer
        CW["Channel Watcher"]:::monitor
        click CW "https://github.com/frou/yt2pod/blob/master/watcher.go"
        HM["Health Monitor"]:::monitor
        click HM "https://github.com/frou/yt2pod/blob/master/health.go"
    end

    subgraph ProcessingLayer
        VP["Video Processor"]:::process
        click VP "https://github.com/frou/yt2pod/blob/master/vid.go"
        DM["Download Manager"]:::process
        click DM "https://github.com/frou/yt2pod/tree/master/internal/xplatform/"
        HC["Hit Counter"]:::process
        click HC "https://github.com/frou/yt2pod/blob/master/hits.go"
        CS["Cleanup Service"]:::process
        click CS "https://github.com/frou/yt2pod/blob/master/wclean.go"
    end

    subgraph StorageLayer
        RSS["RSS Feeds"]:::storage
        ART["Artwork"]:::storage
        EP["Episodes"]:::storage
    end

    subgraph ServingLayer
        HS["HTTP Server"]:::serve
        FG["Feed Generator"]:::serve
        FS["File Server"]:::serve
    end

    subgraph CrossPlatform
        SI["Syslog Integration"]:::platform
        click SI "https://github.com/frou/yt2pod/blob/master/internal/xplatform/syslog.go"
        PM["Process Management"]:::platform
        click PM "https://github.com/frou/yt2pod/blob/master/internal/xplatform/tickle.go"
    end

    %% Main Entry Point
    ME["Main Entry"]:::main
    click ME "https://github.com/frou/yt2pod/blob/master/main.go"

    %% Connections
    YT --> CW
    YTC --> VP
    CM --> CW
    CM --> VP
    CM --> HS
    CF --> CM
    SU --> CM
    CW --> VP
    VP --> EP
    VP --> RSS
    VP --> ART
    EP --> FS
    RSS --> FG
    ART --> FS
    FG --> HS
    FS --> HS
    HS --> PC
    HC --> HS
    HM --> CW
    HM --> VP
    CS --> EP
    ME --> CM
    SI --> VP
    SI --> CW
    PM --> VP
    PM --> CW

    %% Styles
    classDef external fill:#68B5E8,stroke:#333,stroke-width:2px
    classDef config fill:#A9A9A9,stroke:#333,stroke-width:2px
    classDef monitor fill:#90EE90,stroke:#333,stroke-width:2px
    classDef process fill:#98FB98,stroke:#333,stroke-width:2px
    classDef storage fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef serve fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef platform fill:#F0E68C,stroke:#333,stroke-width:2px
    classDef main fill:#FF6B6B,stroke:#333,stroke-width:2px
```
