198 lines
5.7 KiB
Markdown
198 lines
5.7 KiB
Markdown
# Echoion Music Bot - Technical Documentation
|
|
|
|
## Overview
|
|
|
|
This documentation provides comprehensive technical information about the Echoion Music Bot architecture, components, data flows, and development guidelines.
|
|
|
|
## System Architecture
|
|
|
|
```mermaid
|
|
flowchart TB
|
|
subgraph "User Interfaces"
|
|
TS[TeamSpeak Client]
|
|
DT[Desktop Client<br/>Qt6 Application]
|
|
end
|
|
|
|
subgraph "Echoion System"
|
|
PL[EchoionPlugin<br/>TeamSpeak Plugin]
|
|
CL[CoreLoader<br/>Dynamic Loader]
|
|
CO[EchoionCore<br/>Music Engine]
|
|
API[EchoionApi<br/>Shared Interfaces]
|
|
end
|
|
|
|
subgraph "External Services"
|
|
YT[YouTube<br/>via yt-dlp]
|
|
DB[(SQLite<br/>Database)]
|
|
end
|
|
|
|
TS <-->|TS3 SDK| PL
|
|
DT <-->|WebSocket RPC| CO
|
|
PL <-->|Hot Reload| CL
|
|
CL <-->|Load/Unload| CO
|
|
PL <-->|ICoreInterface| CO
|
|
CO <-->|IPluginInterface| PL
|
|
CO -->|Stream| YT
|
|
CO -->|Persist| DB
|
|
API -.->|Types/Interfaces| PL
|
|
API -.->|Types/Interfaces| CO
|
|
API -.->|Types/Interfaces| DT
|
|
```
|
|
|
|
## Documentation Index
|
|
|
|
### Getting Started
|
|
|
|
| Document | Description |
|
|
|----------|-------------|
|
|
| **[01-overview.md](01-overview.md)** | Project overview, high-level architecture, key features, technology stack |
|
|
|
|
### Component Documentation
|
|
|
|
| Document | Component | Topics |
|
|
|----------|-----------|--------|
|
|
| **[02-echoion-api.md](02-echoion-api.md)** | EchoionApi | Core types, interfaces (ICoreInterface, IPluginInterface), EventBus, Cache, Database |
|
|
| **[03-echoion-core.md](03-echoion-core.md)** | EchoionCore | MusicManager, AudioDecoder, NetworkClient, YouTubeClient, CommandManager, RpcServer |
|
|
| **[04-echoion-plugin.md](04-echoion-plugin.md)** | EchoionPlugin | Plugin lifecycle, PluginInterface, CoreLoader, TeamSpeak SDK integration |
|
|
| **[05-echoion-desktop.md](05-echoion-desktop.md)** | EchoionDesktop | Qt6 GUI, CoreClient, WebSocket RPC, authentication |
|
|
|
|
### System Documentation
|
|
|
|
| Document | Topic | Coverage |
|
|
|----------|-------|----------|
|
|
| **[06-data-flow.md](06-data-flow.md)** | Data Flow | Communication protocols, sequence diagrams, message formats, audio pipeline |
|
|
| **[07-configuration.md](07-configuration.md)** | Configuration | Config locations, structure, reloading, YouTube auth, proxy settings |
|
|
| **[08-commands.md](08-commands.md)** | Commands | Command system, available commands, permissions, adding commands |
|
|
| **[09-audio-pipeline.md](09-audio-pipeline.md)** | Audio | Pipeline architecture, formats, FFmpeg, hardware acceleration |
|
|
| **[10-database-cache.md](10-database-cache.md)** | Persistence | Database schema, SQLite, LRU cache, performance tuning |
|
|
| **[11-events.md](11-events.md)** | Events | EventBus architecture, event types, pub-sub patterns |
|
|
| **[12-hot-reload.md](12-hot-reload.md)** | Hot Reload | State preservation, reload process, auto-reload |
|
|
| **[13-security.md](13-security.md)** | Security | Authentication, permissions, rate limiting, audit logging |
|
|
| **[14-building.md](14-building.md)** | Building | Build requirements, platform instructions, development workflow |
|
|
|
|
## Architecture Overview
|
|
|
|
### Component Interaction
|
|
|
|
```mermaid
|
|
sequenceDiagram
|
|
actor User
|
|
participant TS as TeamSpeak
|
|
participant PL as EchoionPlugin
|
|
participant CO as EchoionCore
|
|
participant YT as YouTube
|
|
|
|
User->>TS: Type !play song
|
|
TS->>PL: onTextMessage
|
|
PL->>CO: Process command
|
|
CO->>YT: Fetch stream URL
|
|
YT-->>CO: Stream URL
|
|
CO->>CO: Start playback
|
|
CO->>PL: Audio data
|
|
PL->>TS: Voice transmission
|
|
TS->>User: Hear music
|
|
```
|
|
|
|
### Key Interfaces
|
|
|
|
```mermaid
|
|
classDiagram
|
|
class IPluginInterface {
|
|
+sendTextMessage(targetId, message)
|
|
+sendAudioData(data)
|
|
+getClients()
|
|
+moveClient(clientId, channelId)
|
|
}
|
|
|
|
class ICoreInterface {
|
|
+play(track)
|
|
+pause()
|
|
+resume()
|
|
+stop()
|
|
+skip(count)
|
|
+queueTrack(track, clientId)
|
|
+getQueue()
|
|
}
|
|
|
|
Plugin ..> ICoreInterface : uses
|
|
Core ..> IPluginInterface : uses
|
|
```
|
|
|
|
## Configuration
|
|
|
|
### Config File Locations
|
|
|
|
| Platform | Path |
|
|
|----------|------|
|
|
| Linux | `~/.config/echoion/config.json` |
|
|
| macOS | `~/Library/Application Support/echoion/config.json` |
|
|
| Windows | `%APPDATA%/echoion/config.json` |
|
|
|
|
### Configuration Architecture
|
|
|
|
```mermaid
|
|
flowchart TB
|
|
subgraph "Configuration"
|
|
File[config.json]
|
|
Env[Environment Vars]
|
|
Code[Default Values]
|
|
end
|
|
|
|
CM[ConfigManager] --> Load[Load Config]
|
|
File --> Load
|
|
Env -->|Override| Load
|
|
Code -->|Fallback| Load
|
|
|
|
Load --> Core
|
|
Load --> Plugin
|
|
Load --> Desktop
|
|
```
|
|
|
|
## Development Workflow
|
|
|
|
### Quick Commands
|
|
|
|
```mermaid
|
|
flowchart LR
|
|
subgraph "Common Tasks"
|
|
Build[Build] --> Reload[Hot Reload]
|
|
Test[Test] --> Debug[Debug]
|
|
end
|
|
|
|
subgraph "Commands"
|
|
B["cmake --build build"]
|
|
R["cmake --build build --target EchoionCore"]
|
|
T["cd build && ctest"]
|
|
D["gdb ./build/test"]
|
|
end
|
|
|
|
Build --> B
|
|
Reload --> R
|
|
Test --> T
|
|
Debug --> D
|
|
```
|
|
|
|
| Task | Command |
|
|
|------|---------|
|
|
| Build all | `cmake -B build && cmake --build build` |
|
|
| Hot reload Core | `cmake --build build --target EchoionCore` |
|
|
| Run tests | `cd build && ctest` |
|
|
| Debug | `gdb ./build/EchoionCore_test` |
|
|
|
|
## Documentation Diagrams
|
|
|
|
All documentation files contain Mermaid diagrams for:
|
|
|
|
- **Architecture diagrams** - Component relationships
|
|
- **Sequence diagrams** - Interaction flows
|
|
- **Data flow diagrams** - How data moves through the system
|
|
- **Class diagrams** - Data structures and interfaces
|
|
- **State diagrams** - Lifecycle management
|
|
|
|
## Contributing
|
|
|
|
Refer to [14-building.md](14-building.md) for development guidelines and AGENTS.md for coding conventions.
|
|
|
|
## License
|
|
|
|
MIT License - See LICENSE file for details
|