# drewmrobson/add-video-to-youtube-playlist architecture

> Architecture diagram of the GitHub repository drewmrobson/add-video-to-youtube-playlist, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/drewmrobson/add-video-to-youtube-playlist
- Repository: https://github.com/drewmrobson/add-video-to-youtube-playlist

## Overview

##### Main Components

a. External Components:
- YouTube Data API (as an external service)
- Configuration Files (credentials.json and channels.json)
- YouTube Channels (data source)
- YouTube Playlists (target destination)

b. Internal Components:
- Program (entry point)
- PlaylistManager (core business logic)
- Channel (data model)
- AddVideoToYouTubePlaylist (main service class)

##### Component Relationships

**[Configuration Files]**
- ↓
**[Program]**
- ↓
**[AddVideoToYouTubePlaylist]**
- ↓
**[PlaylistManager] ←→ [Channel Model]**
- ↓
**[YouTube Data API]**
- ↓
**[YouTube Platform (Channels/Playlists)]**

##### Important Details

a. Data Flow Annotations:
- JSON configuration input
- YouTube API authentication flow
- Video metadata retrieval
- Playlist modification operations

b. Key Processes:
- Configuration loading
- Channel video fetching
- Playlist management
- API interaction

##### Notes for Implementation Details
- Notes about the MaxResults parameter influence
- Information about the date-descending order of video retrieval
- Playlist pre-existence requirement
- Service account authentication method

Remember to emphasize:
- The automation aspect of the tool
- The configuration-driven nature of the application
- The clear separation between data sources (channels) and targets (playlists)
- The service-oriented architecture with YouTube API integration

This level of detail will provide a clear understanding of the system's architecture while maintaining the simplicity appropriate for a focused utility application.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Config
        CF[credentials.json]:::config
        CJ[channels.json]:::config
    end

    subgraph Core
        P[Program]:::internal
        AV[AddVideoToYouTubePlaylist]:::internal
        PM[PlaylistManager]:::internal
        CM[Channel Model]:::internal
    end

    subgraph External
        YTA[YouTube Data API]:::external
        YTP[YouTube Platform]:::platform
        YTC[YouTube Channels]:::platform
        YPL[YouTube Playlists]:::platform
    end

    CF & CJ --> P
    P --> AV
    AV --> PM
    PM <--> CM
    PM --> YTA
    YTA --> YTP
    YTP --> YTC
    YTP --> YPL

    %% Click Events
    click P "https://github.com/drewmrobson/add-video-to-youtube-playlist/blob/main/add-video-to-youtube-playlist/Program.cs"
    click AV "https://github.com/drewmrobson/add-video-to-youtube-playlist/blob/main/add-video-to-youtube-playlist/AddVideoToYouTubePlaylist.cs"
    click PM "https://github.com/drewmrobson/add-video-to-youtube-playlist/blob/main/add-video-to-youtube-playlist/PlaylistManager.cs"
    click CM "https://github.com/drewmrobson/add-video-to-youtube-playlist/blob/main/add-video-to-youtube-playlist/Channel.cs"

    %% Styling
    classDef config fill:#90EE90,stroke:#333,stroke-width:2px
    classDef internal fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:2px
    classDef platform fill:#FFA07A,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Configuration Files]:::config
        L2[Internal Components]:::internal
        L3[External Services]:::external
        L4[Platform Components]:::platform
    end
```
