# ahmedashrafaz/cms-downloader architecture

> Architecture diagram of the GitHub repository ahmedashrafaz/cms-downloader, 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/ahmedashrafaz/cms-downloader
- Repository: https://github.com/ahmedashrafaz/cms-downloader

## Overview

##### Main Components

a) Client-Side Components:
- Node.js Script (index.js)
- Python Script (vodDownloader.py)
- Configuration (.env)

b) External Systems:
- CMS Platform (GUC/GIU CMS)
- Chromium Browser
- Local File System

##### Component Relationships

**[.env] → [index.js] → [Chromium] → [CMS Platform]**
- ↓
**[Local Storage] ← [vodDownloader.py]**

##### Specific elements

a) Configuration Layer:
- .env file (credentials and URL)
- Environment variables for Chromium

b) Processing Layer:
- Node.js script functionality
- Python script for video processing
- Puppeteer automation

c) External Integration Layer:
- CMS Platform interaction
- File system operations
- FFMPEG integration (optional)

##### Security Flow
- Credential handling
- Local-only storage
- Secure connections

##### Process Flow
- Course discovery
- Content identification
- Download management
- File organization

##### Error Handling
- Connection retry mechanisms
- File system checks
- Authentication validation

##### Video processing

Remember to emphasize the automation aspect and the security considerations mentioned in the README, such as local credential storage and direct CMS platform communication.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Config
        ENV[".env"]
        PKG["package.json"]
        REQ["requirements.txt"]
    end

    subgraph Processing
        NODE["index.js"]
        PY["vodDownloader.py"]
    end

    subgraph External
        CMS["CMS Platform"]:::external
        CHROME["Chromium Browser"]:::browser
        STORAGE["Local File System"]:::storage
    end

    %% Configuration Flow
    ENV -->|"Credentials & Settings"| NODE
    PKG -->|"Node Dependencies"| NODE
    REQ -->|"Python Dependencies"| PY

    %% Authentication Flow
    NODE -->|"Launch & Control"| CHROME
    CHROME -->|"Authenticate"| CMS

    %% Content Discovery Flow
    CMS -->|"Course Content"| CHROME
    CHROME -->|"Content URLs"| NODE

    %% Download Flow
    NODE -->|"Video URLs"| PY
    PY -->|"Save Content"| STORAGE

    %% Styling
    classDef external fill:#f9f,stroke:#333
    classDef browser fill:#bbf,stroke:#333
    classDef storage fill:#fda,stroke:#333
    classDef script fill:#bfb,stroke:#333

    %% Click Events
    click ENV "https://github.com/AhmedAshrafAZ/cms-downloader/blob/main/.env"
    click NODE "https://github.com/AhmedAshrafAZ/cms-downloader/blob/main/index.js"
    click PY "https://github.com/AhmedAshrafAZ/cms-downloader/blob/main/vodDownloader.py"
    click PKG "https://github.com/AhmedAshrafAZ/cms-downloader/blob/main/package.json"
    click REQ "https://github.com/AhmedAshrafAZ/cms-downloader/blob/main/requirements.txt"

    %% Legend
    subgraph Legend
        L1["External Service"]:::external
        L2["Browser Component"]:::browser
        L3["Storage System"]:::storage
        L4["Script"]:::script
    end
```
