# emy69/coomerdl architecture

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

- Interactive diagram: https://gitdiagram.com/emy69/coomerdl
- Repository: https://github.com/emy69/coomerdl

## Overview

##### Project Type and Purpose
- This is a standalone Python desktop application (“Coomer Downloader App”) with a GUI.
- Purpose: simplify and accelerate multithreaded downloads of images, videos, documents, and archives from a variety of “coomer”-style websites by pasting a URL into the UI.

a. Presentation Layer (GUI)
- app/ui.py
- app/about_window.py, settings_window.py, patch_notes.py
b. Application Logic (Controller / Orchestrator)
- main.py (entry point)
- app/progress_manager.py (manages download threads & progress updates)
- app/donors.py (optional credits display)
c. Download Engine & Plugins (Infrastructure)
- downloader/downloader.py (core download manager, task queue)
- downloader/*.py (site‐specific plugins: bunkr.py, erome.py, jpg5.py, simpcity.py)
d. Configuration & Resources
- resources/config/*.json, *.txt (languages, settings, patch notes)
- resources/img (logos, screenshot assets)
e. File System
- Local download folder (not coded but implied), settings file (“resources/config/settings.json”)
f. External Services (Third‐Party Sites)
- coomer.su, kemono.su, erome.com, bunkr-albums.io, simpcity.su, jpg5.su

##### Relationships & Data Flows
1. User clicks “Download” in the GUI.
2. UI layer calls ProgressManager (via main.py) to enqueue a download task.
3. ProgressManager dispatches tasks to downloader/downloader.py, which:
– Chooses the correct plugin module based on URL pattern.
– Spawns worker threads to fetch file lists & actual media in parallel.
4. Plugin module (e.g., erome.py) performs HTTP requests against the target site, parses HTML/json, and streams file data.
5. Downloaded files are written to disk (File System).
6. ProgressManager reports progress back to UI, which updates progress bars in app/ui.py.
7. Settings, translations, and patch notes are read from resources/config at startup or on‐demand.

##### Architectural Patterns & Principles
- MVC‐style separation:
- Model: download tasks & state (ProgressManager)
- View: tkinter/Qt‐based windows in app/ui.py
- Controller: main.py orchestrates interactions
- Plugin architecture: each “downloader” implements a common interface for URL parsing and file retrieval.
- Multithreading: thread pool in ProgressManager for concurrent downloads.
- Resource externalization: configs and language packs are stored in JSON/text under resources/config.

##### Essential Elements
- Component labels (e.g., “ProgressManager”, “Downloader Engine”, “Erome Plugin”)
- Config read events (on startup / settings change)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["UI (app/ui.py)"]:::ui
        About["About Window\n(app/about_window.py)"]:::ui
        Settings["Settings Window\n(app/settings_window.py)"]:::ui
        PatchNotes["Patch Notes\n(app/patch_notes.py)"]:::ui
    end

    %% Core Logic
    subgraph "Core Logic"
        Main["main.py"]:::core
        ProgressManager["ProgressManager\n(Thread Pool)\n(app/progress_manager.py)"]:::core
        Donors["Donors\n(app/donors.py)"]:::core
    end

    %% Download Engine & Plugins
    subgraph "Download Engine & Plugins"
        Engine["Downloader Engine\n(downloader/downloader.py)"]:::plugin
        subgraph "External Site Adapters"
            Bunkr["Bunkr Plugin\n(downloader/bunkr.py)"]:::plugin
            Erome["Erome Plugin\n(downloader/erome.py)"]:::plugin
            JPG5["JPG5 Plugin\n(downloader/jpg5.py)"]:::plugin
            SimpCity["SimpCity Plugin\n(downloader/simpcity.py)"]:::plugin
        end
    end

    %% Configuration & Resources
    Config["Configuration Store\n(resources/config)"]:::resource
    ResourcesImg["Image Assets\n(resources/img)"]:::resource

    %% File System
    FileSystem["Local Download Storage"]:::resource

    %% External Services
    subgraph "External Services"
        coomer["coomer.su"]:::external
        kemono["kemono.su"]:::external
        eromeSite["erome.com"]:::external
        bunkrSite["bunkr-albums.io"]:::external
        simpcitySite["simpcity.su"]:::external
        jpg5Site["jpg5.su"]:::external
    end

    %% Relationships
    UI -->|"click Download"| ProgressManager
    ProgressManager -->|"enqueue task"| Engine
    Engine -->|"select plugin"| Bunkr
    Engine -->|"select plugin"| Erome
    Engine -->|"select plugin"| JPG5
    Engine -->|"select plugin"| SimpCity

    Bunkr -->|"HTTP GET/POST"| bunkrSite
    Erome -->|"HTTP GET/POST"| eromeSite
    JPG5 -->|"HTTP GET/POST"| jpg5Site
    SimpCity -->|"HTTP GET/POST"| simpcitySite

    Bunkr -->|"write file"| FileSystem
    Erome -->|"write file"| FileSystem
    JPG5 -->|"write file"| FileSystem
    SimpCity -->|"write file"| FileSystem

    ProgressManager -->|"update progress"| UI
    Main -->|"load settings"| Config
    Main -->|"load patch notes"| Config
    Main -->|"load translations"| Config
    Main -->|"load languages"| Config

    Config -->|"provide resources"| UI
    Config -.->|"provide settings"| ProgressManager

    %% Click Events
    click UI "https://github.com/emy69/coomerdl/blob/main/app/ui.py"
    click About "https://github.com/emy69/coomerdl/blob/main/app/about_window.py"
    click Settings "https://github.com/emy69/coomerdl/blob/main/app/settings_window.py"
    click PatchNotes "https://github.com/emy69/coomerdl/blob/main/app/patch_notes.py"
    click Main "https://github.com/emy69/coomerdl/blob/main/main.py"
    click ProgressManager "https://github.com/emy69/coomerdl/blob/main/app/progress_manager.py"
    click Donors "https://github.com/emy69/coomerdl/blob/main/app/donors.py"
    click Engine "https://github.com/emy69/coomerdl/blob/main/downloader/downloader.py"
    click Bunkr "https://github.com/emy69/coomerdl/blob/main/downloader/bunkr.py"
    click Erome "https://github.com/emy69/coomerdl/blob/main/downloader/erome.py"
    click JPG5 "https://github.com/emy69/coomerdl/blob/main/downloader/jpg5.py"
    click SimpCity "https://github.com/emy69/coomerdl/blob/main/downloader/simpcity.py"
    click Config "https://github.com/emy69/coomerdl/blob/main/resources/config/settings.json"
    click ResourcesImg "https://github.com/emy69/coomerdl/tree/main/resources/img"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#2f75b5,color:#000;
    classDef core fill:#d4edda,stroke:#218838,color:#000;
    classDef plugin fill:#ffe5b4,stroke:#e69500,color:#000;
    classDef resource fill:#e2e3e5,stroke:#6c757d,color:#000;
    classDef external fill:#f8d7da,stroke:#c82333,color:#000;
```
