# packjc/youtubetomp3 architecture

> Architecture diagram of the GitHub repository packjc/youtubetomp3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/packjc/youtubetomp3
- Repository: https://github.com/packjc/youtubetomp3

## Overview

YoutubeToMP3 is a Windows Forms desktop app for downloading YouTube videos and converting them to user-selected audio formats. Users add URLs, choose a format, and start downloads; the form delegates each URL to the downloader, which fetches video details and streams, prompts for a save path, downloads to a temporary file with progress updates, converts the file, and reports completion. The app also provides URL-list controls, themes, an About window, and a GitHub release update check. The main workflow is supported by excerpts; unsampled form behavior is not assumed.

Main entry points: [`downloadAsync.cs`](https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs) (Download and convert), [`Form1.cs`](https://github.com/packjc/youtubetomp3/blob/main/Form1.cs) (Main window), [`AboutBox1.cs`](https://github.com/packjc/youtubetomp3/blob/main/AboutBox1.cs) (About window), [`Program.cs`](https://github.com/packjc/youtubetomp3/blob/main/Program.cs) (App startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_app["App startup<br/>[Program.cs]"]
  node_main["Main window<br/>[Form1.cs]"]
  node_url_list["URL list controls<br/>[Form1.cs]"]
  node_format["Format selection<br/>[Form1.cs]"]
  node_progress["Download progress<br/>[Form1.cs]"]
  node_theme["Theme controls<br/>[Form1.cs]"]
  node_about["About window<br/>[AboutBox1.cs]"]
  node_updater["Release updater<br/>[Form1.cs]"]
end

subgraph group_processing["Download and conversion"]
  node_downloader["Download and convert<br/>[downloadAsync.cs]"]
  node_save_dialog["Save location dialog<br/>[downloadAsync.cs]"]
  node_temp_file["Temporary video file<br/>[downloadAsync.cs]"]
  node_audio_file["Converted audio file<br/>[downloadAsync.cs]"]
end

subgraph group_integrations["External services"]
  node_youtube["YouTube streams"]
  node_media_toolkit["MediaToolkit"]
  node_github["GitHub releases API"]
end

node_user(("User"))

node_user -->|"uses"| node_main
node_app -->|"launches"| node_main
node_user -->|"enters URLs"| node_url_list
node_user -->|"chooses format"| node_format
node_main -->|"starts downloads"| node_downloader
node_url_list -->|"provides URLs"| node_downloader
node_format -->|"provides format"| node_downloader
node_downloader -->|"fetches video and streams"| node_youtube
node_downloader -->|"prompts save path"| node_save_dialog
node_downloader -->|"downloads video"| node_temp_file
node_downloader -->|"updates progress"| node_progress
node_downloader -->|"converts video"| node_media_toolkit
node_media_toolkit -->|"writes audio"| node_audio_file
node_user -->|"toggles theme"| node_theme
node_user -->|"opens About"| node_about
node_main -->|"opens window"| node_about
node_user -->|"checks updates"| node_updater
node_updater -->|"checks latest release"| node_github

click node_app "https://github.com/packjc/youtubetomp3/blob/main/Program.cs"
click node_main "https://github.com/packjc/youtubetomp3/blob/main/Form1.cs"
click node_url_list "https://github.com/packjc/youtubetomp3/blob/main/Form1.cs"
click node_format "https://github.com/packjc/youtubetomp3/blob/main/Form1.cs"
click node_progress "https://github.com/packjc/youtubetomp3/blob/main/Form1.cs"
click node_theme "https://github.com/packjc/youtubetomp3/blob/main/Form1.cs"
click node_about "https://github.com/packjc/youtubetomp3/blob/main/AboutBox1.cs"
click node_updater "https://github.com/packjc/youtubetomp3/blob/main/Form1.cs"
click node_downloader "https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs"
click node_save_dialog "https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs"
click node_temp_file "https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs"
click node_audio_file "https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_main,node_url_list,node_format,node_progress,node_theme,node_about,node_updater,node_user toneBlue
class node_downloader,node_save_dialog,node_temp_file,node_audio_file toneAmber
class node_youtube,node_media_toolkit,node_github toneMint
```

## Components

### Desktop interface

- [App startup](https://github.com/packjc/youtubetomp3/blob/main/Program.cs): `Program.cs`
- [Main window](https://github.com/packjc/youtubetomp3/blob/main/Form1.cs): `Form1.cs`
- [URL list controls](https://github.com/packjc/youtubetomp3/blob/main/Form1.cs): `Form1.cs`
- [Format selection](https://github.com/packjc/youtubetomp3/blob/main/Form1.cs): `Form1.cs`
- [Download progress](https://github.com/packjc/youtubetomp3/blob/main/Form1.cs): `Form1.cs`
- [Theme controls](https://github.com/packjc/youtubetomp3/blob/main/Form1.cs): `Form1.cs`
- [About window](https://github.com/packjc/youtubetomp3/blob/main/AboutBox1.cs): `AboutBox1.cs`
- [Release updater](https://github.com/packjc/youtubetomp3/blob/main/Form1.cs): `Form1.cs`

### Download and conversion

- [Download and convert](https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs): `downloadAsync.cs`
- [Save location dialog](https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs): `downloadAsync.cs`
- [Temporary video file](https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs): `downloadAsync.cs`
- [Converted audio file](https://github.com/packjc/youtubetomp3/blob/main/downloadAsync.cs): `downloadAsync.cs`

### External services

- **YouTube streams**
- **MediaToolkit**
- **GitHub releases API**

### Other components

- **User**

## Connections

- User → Main window: uses (evidence: `README.md`)
- App startup → Main window: launches (evidence: `Program.cs`)
- User → URL list controls: enters URLs (evidence: `README.md`)
- User → Format selection: chooses format (evidence: `Form1.cs`)
- Main window → Download and convert: starts downloads (evidence: `Form1.cs`)
- URL list controls → Download and convert: provides URLs (evidence: `Form1.cs`)
- Format selection → Download and convert: provides format (evidence: `Form1.cs`)
- Download and convert → YouTube streams: fetches video and streams (evidence: `downloadAsync.cs`)
- Download and convert → Save location dialog: prompts save path (evidence: `downloadAsync.cs`)
- Download and convert → Temporary video file: downloads video (evidence: `downloadAsync.cs`)
- Download and convert → Download progress: updates progress (evidence: `downloadAsync.cs`)
- Download and convert → MediaToolkit: converts video (evidence: `downloadAsync.cs`)
- MediaToolkit → Converted audio file: writes audio (evidence: `downloadAsync.cs`)
- User → Theme controls: toggles theme (evidence: `Form1.cs`)
- User → About window: opens About
- Main window → About window: opens window (evidence: `Form1.cs`)
- User → Release updater: checks updates (evidence: `Form1.cs`)
- Release updater → GitHub releases API: checks latest release (evidence: `Form1.cs`)
