# fliegendewurst/kit-ilias-downloader architecture

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

- Interactive diagram: https://gitdiagram.com/fliegendewurst/kit-ilias-downloader
- Repository: https://github.com/fliegendewurst/kit-ilias-downloader

## Overview

##### Main Components

a. Core Components:
- CLI Interface (entry point)
- ILIAS Client (main downloader logic)
- Authentication System
- Download Queue Manager
- File System Handler
- Plugin System (for different content types)

b. Content Type Handlers:
- Files Handler
- Exercise Handler
- Video Handler (Opencast)
- Forum Handler
- Weblink Handler

**┌─ User Interface Layer ─────────────────────┐**
- CLI (src/cli.rs, src/main.rs)             │
- ┬─────────────────────┬─┘

**┌─ Core Layer ──────┼─────────────────────┼─┐**
- ┌────────────────▼──────────────┐      │ │
- ILIAS Client              │      │ │
- (src/ilias.rs)           │      │ │
- ┬──────────────┘      │ │

- ┌────────────────▼──────────────┐      │ │
- Queue Manager             │      │ │
- (src/queue.rs)           │      │ │
- ┬──────────────┘      │ │

- ┌────────────────▼──────────────┐      │ │
- Plugin Dispatcher         │◄─────┘ │
- (src/ilias/plugin_dispatch.rs)      │ │
- ┬──────────────┘        │
- ┼────────────────────────┘

**┌─ Plugin Layer ───▼────────────────────────┐**
- ┌──────────┐ ┌─────────┐ ┌────────────┐  │
- Files   │ │Exercise │ │   Video    │  │
- Handler   │ │Handler  │ │  Handler   │  │
- ┘ └─────────┘ └────────────┘  │
- ┌──────────┐ ┌─────────┐ ┌────────────┐  │
- Forum   │ │ Folder  │ │  Weblink   │  │
- Handler   │ │Handler  │ │  Handler   │  │
- ┘ └─────────┘ └────────────┘  │
- ┘

**┌─ Utility Layer ──────────────────────────┐**
- Authentication | File System Operations   │
- Configuration  | Error Handling          │
- ┘

##### Important Elements to Highlight

a. Data Flow:
- How user commands flow from CLI to the ILIAS client
- How download tasks are queued and processed
- Demonstrate how different content types are handled by respective plugins

b. Key Interactions:
- Authentication flow with ILIAS server
- Download queue management
- Plugin dispatch mechanism
- File system operations

##### Technical Details

- Rate limiting mechanism (--rate option)
- Session management (--keep-session)
- Parallel job execution (-j option)
- Proxy support
- Content type filtering options

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#333,stroke-width:2px
    classDef plugin fill:#90EE90,stroke:#333,stroke-width:2px
    classDef utility fill:#FFE5B4,stroke:#333,stroke-width:2px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:2px

    %% User Interface Layer
    subgraph UI
        CLI["CLI Interface"]
    end
    click CLI "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/cli.rs"

    %% Core Layer
    subgraph Core
        IliasClient["ILIAS Client"]
        QueueManager["Download Queue Manager"]
        PluginDispatch["Plugin Dispatcher"]
        CourseManager["Course Manager"]
    end
    click IliasClient "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias.rs"
    click QueueManager "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/queue.rs"
    click PluginDispatch "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/plugin_dispatch.rs"
    click CourseManager "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/course.rs"

    %% Plugin Layer
    subgraph Plugins
        FilesHandler["Files Handler"]
        ExerciseHandler["Exercise Handler"]
        VideoHandler["Video Handler"]
        ForumHandler["Forum Handler"]
        WebLinkHandler["Weblink Handler"]
        FolderHandler["Folder Handler"]
        ThreadHandler["Forum Thread Handler"]
    end
    click FilesHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/file.rs"
    click ExerciseHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/exercise.rs"
    click VideoHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/video.rs"
    click ForumHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/forum.rs"
    click WebLinkHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/weblink.rs"
    click FolderHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/folder.rs"
    click ThreadHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/ilias/thread.rs"

    %% Utility Layer
    subgraph Utilities
        FSHandler["File System Handler"]
        ConfigHandler["Configuration Handler"]
        AuthSystem["Authentication System"]
    end
    click FSHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/util.rs"
    click ConfigHandler "https://github.com/FliegendeWurst/KIT-ILIAS-downloader/blob/master/src/iliasignore.rs"

    %% External Systems
    subgraph External
        IliasServer["ILIAS Server"]
        FileSystem["File System"]
    end

    %% Connections
    CLI --> IliasClient
    IliasClient --> QueueManager
    IliasClient --> CourseManager
    QueueManager --> PluginDispatch
    PluginDispatch --> FilesHandler & ExerciseHandler & VideoHandler & ForumHandler & WebLinkHandler & FolderHandler
    ForumHandler --> ThreadHandler
    
    %% Utility Connections
    IliasClient --> AuthSystem
    AuthSystem --> IliasServer
    FilesHandler & ExerciseHandler & VideoHandler & ForumHandler & WebLinkHandler & FolderHandler --> FSHandler
    FSHandler --> FileSystem
    IliasClient --> ConfigHandler

    %% Apply Classes
    class CLI,IliasClient,QueueManager,PluginDispatch,CourseManager core
    class FilesHandler,ExerciseHandler,VideoHandler,ForumHandler,WebLinkHandler,FolderHandler,ThreadHandler plugin
    class FSHandler,ConfigHandler,AuthSystem utility
    class IliasServer,FileSystem external

    %% Legend
    subgraph Legend
        CoreComponent["Core Component"]:::core
        PluginComponent["Plugin Component"]:::plugin
        UtilityComponent["Utility Component"]:::utility
        ExternalComponent["External System"]:::external
    end
```
