# yne/dzr architecture

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

- Interactive diagram: https://gitdiagram.com/yne/dzr
- Repository: https://github.com/yne/dzr

## Overview

- How user input flows through the CLI
- API requests to Deezer
- Music stream flow to players
- Metadata flow to ID3 tagger

- Core components to their required external dependencies
- Integration points with the VSCode extension

##### Important Workflows to Highlight

a. Music Playback Flow:
1. User Input → CLI
2. API Request → Deezer
3. Stream Processing
4. Player Output

b. Lyrics Display:
1. Track Selection
2. Lyrics Fetch
3. SRT Conversion
4. Integration

c. ID3 Tagging:
1. Metadata Fetch
2. Tag Processing
3. File Writing

##### Additional Elements

- Version compatibility notes
- Platform-specific variations
- Security boundaries and data flow restrictions

##### Technical Notes

Annotations for:
- Legal compliance measures
- Cross-platform compatibility
- Runtime dependencies
- Security considerations

Remember to indicate the project's unique aspects, such as the legal-compliant approach to key management and the no-storage playback feature, as these are crucial architectural decisions that affect the overall design.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Components
    CLI[DZR CLI Interface]:::core
    DEC[DZR Decoder]:::core
    ID3[ID3 Tag Manager]:::core
    SRT[Subtitle/Lyrics Handler]:::core
    URL[URL Handler]:::core

    %% External Dependencies
    CURL[curl]:::dependency
    JQ[jq]:::dependency
    DIALOG[dialog]:::dependency
    SSL[openssl]:::dependency
    PLAYER[Media Players<br/>mpv/mpg123]:::dependency

    %% External Services
    DAPI((Deezer API)):::service
    DWP((Deezer Web<br/>Player)):::service

    %% VSCode Extension Components
    subgraph VSCode
        EXT[Extension Core]:::vscode
        EUI[Extension UI]:::vscode
        ECFG[Extension Config]:::vscode
    end

    %% Web Interface
    WEB[Web Interface]:::web
    CGI[CGI Handler]:::web

    %% Relationships
    CLI --> DEC
    CLI --> ID3
    CLI --> SRT
    CLI --> URL
    CLI --> DIALOG
    
    DEC --> SSL
    DEC --> CURL
    
    URL --> CURL
    URL --> JQ
    
    DEC --> PLAYER
    
    CURL --> DAPI
    CURL --> DWP
    
    EXT --> CLI
    EXT --> EUI
    EXT --> ECFG
    
    WEB --> CGI
    CGI --> CLI

    %% Click Events
    click CLI "https://github.com/yne/dzr/tree/master/dzr"
    click DEC "https://github.com/yne/dzr/tree/master/dzr-dec"
    click ID3 "https://github.com/yne/dzr/tree/master/dzr-id3"
    click SRT "https://github.com/yne/dzr/tree/master/dzr-srt"
    click URL "https://github.com/yne/dzr/tree/master/dzr-url"
    click EXT "https://github.com/yne/dzr/blob/master/extension/main.js"
    click EUI "https://github.com/yne/dzr/blob/master/extension/webview.html"
    click ECFG "https://github.com/yne/dzr/blob/master/extension/package.json"
    click WEB "https://github.com/yne/dzr/blob/master/index.html"

    %% Styles
    classDef core fill:#a8d1f0,stroke:#333,stroke-width:2px
    classDef dependency fill:#90EE90,stroke:#333,stroke-width:2px
    classDef service fill:#FFB347,stroke:#333,stroke-width:2px
    classDef vscode fill:#B19CD9,stroke:#333,stroke-width:2px
    classDef web fill:#FFE4B5,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Core Components]:::core
        L2[External Dependencies]:::dependency
        L3((External Services)):::service
        L4[VSCode Components]:::vscode
        L5[Web Components]:::web
    end
```
