# hugefrog24/sky-fsbext architecture

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

- Interactive diagram: https://gitdiagram.com/hugefrog24/sky-fsbext
- Repository: https://github.com/hugefrog24/sky-fsbext

## Overview

- Input Directory → FSB Extractor Core
- FSB Extractor Core → VGMStream Interface
- VGMStream Interface → Output Directory

- Command Line Arguments → Input Handler
- Storage Manager → FSB Extractor Core (disk space checks)
- Logger ← All Components (logging information)

1. Input Validation & Setup
2. Disk Space Verification
3. Worker Pool Initialization
4. FSB File Processing
5. Audio Conversion
6. Output Organization

##### External Dependencies (Use clouds)
- VGMStream CLI
- File System
- Operating System (Windows/Unix support)

##### Concurrent Processing
- Worker pool architecture (default 4 workers)
- Parallel processing flows

##### Cross-Platform Support
- A note about Windows/Unix compatibility
- Reference the separate disk space handling files (disk_space_unix.go and disk_space_windows.go)

##### File Organization
- Output directory structure (Music/SFX/Other)
- Logging output location

##### Resource Management
- Disk space verification
- Compression ratio handling

- Abbreviations
- Concurrent processing indicators

Special Considerations:

##### Performance
- Worker pool configuration
- Disk space calculation points

##### Error Handling
- Error propagation paths
- Logging points

##### Configuration
- Command-line argument flow
- Default value handling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "External Dependencies"
        VGM[VGMStream CLI]:::external
        FS[File System]:::external
        OS[Operating System]:::external
    end

    subgraph "Core Components"
        IH[Input Handler]:::core
        FSB[FSB Extractor Core]:::core
        VGMI[VGMStream Interface]:::core
        SM[Storage Manager]:::core
        LOG[Logger]:::utility
    end

    subgraph "Storage"
        IN[Input Directory]:::storage
        OUT[Output Directory]:::storage
        subgraph "Output Categories"
            MUSIC[Music]:::storage
            SFX[SFX]:::storage
            OTHER[Other]:::storage
        end
    end

    subgraph "Processing Stages"
        P1[1. Input Validation]:::process
        P2[2. Disk Space Check]:::process
        P3[3. Worker Pool Init]:::process
        P4[4. FSB Processing]:::process
        P5[5. Audio Conversion]:::process
        P6[6. Output Organization]:::process
    end

    %% Main Flow
    IN --> IH
    IH --> FSB
    FSB --> VGMI
    VGMI --> OUT
    OUT --> MUSIC & SFX & OTHER

    %% Control Flow
    SM -.-> FSB
    LOG -.-> IH & FSB & VGMI & SM

    %% Processing Flow
    P1 --> P2 --> P3 --> P4 --> P5 --> P6

    %% External Dependencies
    VGMI --> VGM
    SM --> FS
    FSB --> OS

    %% Click Events
    click IH "https://github.com/HugeFrog24/sky-fsbext/blob/main/fsbext.go"
    click FSB "https://github.com/HugeFrog24/sky-fsbext/blob/main/fsbext.go"
    click VGMI "https://github.com/HugeFrog24/sky-fsbext/blob/main/vgmstream-win64/vgmstream-cli.exe"
    click SM "https://github.com/HugeFrog24/sky-fsbext/blob/main/disk_space_unix.go"
    click IN "https://github.com/HugeFrog24/sky-fsbext/tree/main/in/"
    click OUT "https://github.com/HugeFrog24/sky-fsbext/tree/main/out/"

    %% Styles
    classDef core fill:#2374ab
    classDef storage fill:#57a773
    classDef external fill:#ffd23f
    classDef utility fill:#808080
    classDef process fill:#ddd,stroke:#333,stroke-width:2px
    classDef api fill:#ff6b6b

    %% Legend
    subgraph Legend
        L1[Core Component]:::core
        L2[Storage]:::storage
        L3[External Dependency]:::external
        L4[Utility]:::utility
        L5[Process Stage]:::process
    end
```
