# alexpasmantier/television architecture

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

- Interactive diagram: https://gitdiagram.com/alexpasmantier/television
- Repository: https://github.com/alexpasmantier/television

## Overview

##### Main Components Identification

The system can be broken down into these major components:

a) Core Components:
- Television Core (main application logic)
- Fuzzy Matching Engine
- Channel System
- Preview System
- Screen/TUI Interface

b) Supporting Components:
- Configuration Management
- Theme Management
- Shell Integration
- Cache System

##### Component Organization

**┌─ User Interface Layer ─────────────────────┐**
- (television-screen)                        │
- TUI Components                          │
- Input Handling                          │
- Layout Management                       │
- Core Logic Layer ──────────────────────────┤
- (television)                               │
- Application State                       │
- Event Management                        │
- Configuration                           │
- Feature Layers ───────────────────────────┤
- ┌─ Channels ─┐ ┌─ Previewer ┐ ┌─ Fuzzy ─┐ │
- Multiple   │ │ File       │ │ Matcher │ │
- Sources    │ │ Preview    │ │ Engine  │ │
- ┘ └────────────┘ └─────────┘ │
- Utility Layer ───────────────────────────┤
- (television-utils)                        │
- Cache                                  │
- Shell Integration                      │
- File Operations                        │
- ┘

##### Key Relationships to Highlight

- Data flow from input sources through the channel system
- How the fuzzy matcher processes search queries
- Demonstrate preview generation pipeline
- Configuration flow affecting all components

##### Implementation Details

- Crate boundaries (television-channels, television-fuzzy, etc.)
- Where shell integration hooks in
- Cache interaction points
- Theme system integration

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        TUI["TUI Components"]:::ui
        Input["Input Handling"]:::ui
        Preview["Preview Rendering"]:::ui
    end

    subgraph Core
        TV["Television Core"]:::core
        Events["Event System"]:::core
        Config["Configuration"]:::config
        Themes["Theme System"]:::config
    end

    subgraph Search
        Fuzzy["Fuzzy Matcher"]:::search
        Query["Search Query"]:::search
    end

    subgraph Channels
        ChannelSys["Channel System"]:::channel
        Cable["Cable Channels"]:::channel
        Built["Built-in Channels"]:::channel
    end

    subgraph Preview
        PreviewSys["Preview System"]:::preview
        Cache["Cache Management"]:::preview
        Providers["Preview Providers"]:::preview
    end

    subgraph Utils
        Shell["Shell Integration"]:::util
        FileOps["File Operations"]:::util
        InputProc["Input Processing"]:::util
    end

    %% Relationships
    Input --> TV
    TV --> Events
    Events --> ChannelSys
    ChannelSys --> Cable
    ChannelSys --> Built
    TV --> Query
    Query --> Fuzzy
    Fuzzy --> TUI
    TUI --> Preview
    Preview --> PreviewSys
    PreviewSys --> Cache
    PreviewSys --> Providers
    Config --> TV
    Themes --> TUI
    Shell --> TV
    FileOps --> PreviewSys
    InputProc --> Input

    %% Click Events
    click TV "https://github.com/alexpasmantier/television/tree/main/crates/television/"
    click Events "https://github.com/alexpasmantier/television/blob/main/crates/television/event.rs"
    click ChannelSys "https://github.com/alexpasmantier/television/tree/main/crates/television-channels/"
    click Cable "https://github.com/alexpasmantier/television/blob/main/crates/television-channels/src/channels/cable.rs"
    click Fuzzy "https://github.com/alexpasmantier/television/tree/main/crates/television-fuzzy/"
    click TUI "https://github.com/alexpasmantier/television/tree/main/crates/television-screen/"
    click Preview "https://github.com/alexpasmantier/television/blob/main/crates/television-screen/src/preview.rs"
    click PreviewSys "https://github.com/alexpasmantier/television/tree/main/crates/television-previewers/"
    click Cache "https://github.com/alexpasmantier/television/blob/main/crates/television-previewers/src/previewers/cache.rs"
    click Config "https://github.com/alexpasmantier/television/tree/main/crates/television/config/"
    click Themes "https://github.com/alexpasmantier/television/tree/main/crates/television/config/themes/"
    click Shell "https://github.com/alexpasmantier/television/tree/main/crates/television-utils/shell/"
    click FileOps "https://github.com/alexpasmantier/television/blob/main/crates/television-utils/src/files.rs"
    click InputProc "https://github.com/alexpasmantier/television/blob/main/crates/television-utils/src/input.rs"

    %% Styles
    classDef ui fill:#3498db
    classDef core fill:#e74c3c
    classDef config fill:#f1c40f
    classDef search fill:#2ecc71
    classDef channel fill:#9b59b6
    classDef preview fill:#e67e22
    classDef util fill:#95a5a6

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        Core_L["Core Components"]:::core
        Config_L["Configuration"]:::config
        Search_L["Search Components"]:::search
        Channel_L["Channel Components"]:::channel
        Preview_L["Preview Components"]:::preview
        Util_L["Utilities"]:::util
    end
```
