# donteatoreo/dis architecture

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

- Interactive diagram: https://gitdiagram.com/donteatoreo/dis
- Repository: https://github.com/donteatoreo/dis

## Overview

##### Main Components
- CLI/Command Interface: Represented by Program.cs, RootCommand.cs, and ServiceCollectionExtensions.cs. This is the entry point handling arguments, initialization, and configuration.
- Download Module: Under the Features/Download directory, this module contains classes such as GenericDownloader, VideoDownloaderBase, VideoDownloaderFactory, and YouTubeDownloader along with related models and interfaces (for instance, IDownloader, IDownloaderFactory, IVideoDownloader). This module facilitates obtaining video content from various online sources.
- Conversion Module: Found under the Features/Conversion directory. It includes components like Converter, CodecParser, ProcessHandler, and StreamConfigurator, together with supporting models (for valid resolutions, video codecs, etc.). This module is responsible for invoking and coordinating FFmpeg processes to compress and convert video files.
- TrimSlider Module: Represented by the Features/TrimSlider directory. It contains classes for handling slider state, parsing times, and managing trimming operations, which is especially significant given the tool’s TUI mode for video trimming.
- Common Utilities: Features/Common houses shared files like Globals.cs, Settings.cs, and TrimSettings.cs that are used across modules.
- Infrastructure/Dependency Management: Features/Infrastructure (with components like TypeRegistrar and TypeResolver) that help with dependency injection or service resolution across the application.

##### Data Flow and Components’ Interactions
– If the user input is a URL (or an online source), the Download module is activated. A label can indicate “Download: Obtain video using yt-dlp.”
- Common Utilities block is visually connected to all these components (Conversion, Download, TrimSlider) since they rely on shared settings and global configurations.
- The Infrastructure component (TypeRegistrar/TypeResolver) should be connected to the CLI and each module to represent dependency injection.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CLI Entry Point Subgraph
    subgraph "CLI Entry Point"
        Program["Program.cs"]:::cli
        RootCommand["RootCommand.cs"]:::cli
        ServiceCollection["ServiceCollectionExtensions.cs"]:::cli
    end

    %% Modules
    Download_Module["Download Module"]:::module
    Conversion_Module["Conversion Module"]:::module
    TrimSlider_Module["TrimSlider Module"]:::module
    Common_Utilities["Common Utilities"]:::module
    Infrastructure["Infrastructure"]:::module

    %% External Dependencies
    yt_dlp["yt-dlp"]:::external
    FFmpeg["FFmpeg"]:::external
    Nix_Env["Nix Dev Environment"]:::environment

    %% Data Flow / Arrows
    %% CLI triggers modules and dependency injection
    Program -->|"command"| Download_Module
    Program -->|"command"| Conversion_Module
    Program -->|"command"| TrimSlider_Module

    RootCommand -->|"parses options"| Download_Module
    RootCommand -->|"parses options"| Conversion_Module
    RootCommand -->|"parses options"| TrimSlider_Module

    ServiceCollection -->|"registers dependencies"| Infrastructure

    %% Download Module interactions
    Download_Module -->|"downloads video"| Conversion_Module
    Download_Module -->|"calls yt-dlp"| yt_dlp

    %% Conversion Module interactions
    Conversion_Module -->|"processes video"| FFmpeg
    Conversion_Module -->|"passes media"| TrimSlider_Module

    %% Common Utilities shared by modules
    Common_Utilities --- Download_Module
    Common_Utilities --- Conversion_Module
    Common_Utilities --- TrimSlider_Module

    %% Infrastructure links to CLI and Modules
    Infrastructure --- Program
    Infrastructure --- RootCommand
    Infrastructure --- ServiceCollection
    Infrastructure --- Download_Module
    Infrastructure --- Conversion_Module
    Infrastructure --- TrimSlider_Module

    %% Nix Environment influences CLI (build and dev)
    Nix_Env --- Program
    Nix_Env --- RootCommand

    %% Click Events for Component Mappings
    click Program "https://github.com/donteatoreo/dis/blob/master/Program.cs"
    click RootCommand "https://github.com/donteatoreo/dis/blob/master/RootCommand.cs"
    click ServiceCollection "https://github.com/donteatoreo/dis/blob/master/ServiceCollectionExtensions.cs"
    click Download_Module "https://github.com/donteatoreo/dis/tree/master/Features/Download"
    click Conversion_Module "https://github.com/donteatoreo/dis/tree/master/Features/Conversion"
    click TrimSlider_Module "https://github.com/donteatoreo/dis/tree/master/Features/TrimSlider"
    click Common_Utilities "https://github.com/donteatoreo/dis/tree/master/Features/Common"
    click Infrastructure "https://github.com/donteatoreo/dis/tree/master/Features/Infrastructure"

    %% Styles
    classDef cli fill:#cce5ff,stroke:#337ab7,stroke-width:2px;
    classDef module fill:#dff0d8,stroke:#3c763d,stroke-width:2px;
    classDef external fill:#f2dede,stroke:#a94442,stroke-width:2px,shape:hexagon;
    classDef environment fill:#fcf8e3,stroke:#8a6d3b,stroke-width:2px,shape:octagon;
```
