# vzhd1701/gridplayer architecture

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

- Interactive diagram: https://gitdiagram.com/vzhd1701/gridplayer
- Repository: https://github.com/vzhd1701/gridplayer

## Overview

##### Main Components

a. Core Application Layer:
- Main Application (gridplayer/__main__.py)
- Settings Manager
- Translation System
- Resource Manager

b. User Interface Layer:
- Dialog System (dialogs/)
- Video Widgets (widgets/)
- Custom UI Elements
- Menu System

c. Video Processing Layer:
- VLC Integration (vlc_player/)
- Video Decoder (Hardware/Software)
- Multi-process Video Management
- Stream Proxy System

d. Media Management Layer:
- Playlist Manager
- Grid State Manager
- Stream Resolution System
- Recent List Manager

##### Component Relationships

**[User Interface Layer]**
- ↕
**[Core Application Layer] ←→ [Settings/Config]**
- ↕
**[Media Management Layer]**
- ↕
**[Video Processing Layer] ←→ [External VLC]**

##### Specific Implementation Details

a. Process Management:
- Multi-process architecture for video handling
- Shared memory communication between processes
- Process manager's role

b. Video Pipeline:
**URL/File Input → Stream Resolver → VLC Decoder → Video Widget → Grid Display**

c. Plugin Systems:
- Stream resolvers (yt-dlp, streamlink)
- Video decoders (Hardware, Software, Hardware SP)

##### Important Architectural Patterns to Highlight

- Manager Pattern (multiple specialized managers)
- Multi-process architecture for video handling
- Event-driven UI system
- Plugin-based stream resolution

##### Technical Details

- Qt/PyQt as the UI framework
- VLC integration for media playback
- Multi-language support system
- Configuration management
- File handling and playlist management

**[UI Components] → [Core Application] → [Media Management]**
- ↑               ↑                      ↑
**[Event System] ← [Process Manager] ← [Video Processing]**

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef core fill:#b3d1ff,stroke:#333
    classDef ui fill:#ffd9b3,stroke:#333
    classDef media fill:#b3ffb3,stroke:#333
    classDef video fill:#ffb3d9,stroke:#333
    classDef plugin fill:#e6b3ff,stroke:#333
    classDef process fill:#f2f2f2,stroke:#333

    %% Core Application Layer
    subgraph CoreLayer["Core Application Layer"]
        MainApp["Main Application"]:::core
        Settings["Settings Manager"]:::core
        Translation["Translation System"]:::core
        Resources["Resource Manager"]:::core
    end

    %% User Interface Layer
    subgraph UILayer["User Interface Layer"]
        Dialogs["Dialog System"]:::ui
        VideoWidgets["Video Widgets"]:::ui
        UIElements["Custom UI Elements"]:::ui
        MenuSystem["Menu System"]:::ui
    end

    %% Video Processing Layer
    subgraph VideoLayer["Video Processing Layer"]
        VLCInt["VLC Integration"]:::video
        VideoDecoder["Video Decoder"]:::video
        MultiProcess["Multi-process Video Management"]:::video
        StreamProxy["Stream Proxy System"]:::video
    end

    %% Media Management Layer
    subgraph MediaLayer["Media Management Layer"]
        PlaylistMgr["Playlist Manager"]:::media
        GridState["Grid State Manager"]:::media
        StreamRes["Stream Resolution System"]:::media
        RecentList["Recent List Manager"]:::media
    end

    %% Plugin Systems
    subgraph PluginLayer["Plugin Systems"]
        YTDLPResolver["YT-DLP Resolver"]:::plugin
        StreamlinkRes["Streamlink Resolver"]:::plugin
    end

    %% Process Management
    subgraph ProcessMgmt["Process Management"]
        ProcessMgr["Process Manager"]:::process
        InstanceProc["Instance Process"]:::process
        SharedMem["Shared Memory"]:::process
    end

    %% Relationships
    CoreLayer --> UILayer
    CoreLayer --> MediaLayer
    MediaLayer --> VideoLayer
    VideoLayer --> ProcessMgmt
    PluginLayer --> StreamRes
    ProcessMgmt --> VideoLayer

    %% Click events
    click MainApp "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/__main__.py"
    click Settings "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/settings.py"
    click Translation "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/main/init_translator.py"
    click Resources "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/main/init_resources.py"
    click Dialogs "https://github.com/vzhd1701/gridplayer/tree/master/gridplayer/dialogs/"
    click VideoWidgets "https://github.com/vzhd1701/gridplayer/tree/master/gridplayer/widgets/"
    click UIElements "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/widgets/video_overlay.py"
    click MenuSystem "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/widgets/custom_menu.py"
    click VLCInt "https://github.com/vzhd1701/gridplayer/tree/master/gridplayer/vlc_player/"
    click MultiProcess "https://github.com/vzhd1701/gridplayer/tree/master/gridplayer/multiprocess/"
    click StreamProxy "https://github.com/vzhd1701/gridplayer/tree/master/gridplayer/utils/stream_proxy/"
    click PlaylistMgr "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/models/playlist.py"
    click GridState "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/models/grid_state.py"
    click StreamRes "https://github.com/vzhd1701/gridplayer/tree/master/gridplayer/utils/url_resolve/"
    click RecentList "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/models/recent_list.py"
    click ProcessMgr "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/multiprocess/process_manager.py"
    click InstanceProc "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/multiprocess/instance_process.py"
    click SharedMem "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/multiprocess/safe_shared_memory.py"
    click YTDLPResolver "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/utils/url_resolve/resolver_yt_dlp.py"
    click StreamlinkRes "https://github.com/vzhd1701/gridplayer/blob/master/gridplayer/utils/url_resolve/resolver_streamlink.py"

    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        UIComp["UI Component"]:::ui
        MediaComp["Media Component"]:::media
        VideoComp["Video Component"]:::video
        PluginComp["Plugin Component"]:::plugin
        ProcessComp["Process Component"]:::process
    end
```
