# realcgcristi/rpvlc architecture

> Architecture diagram of the GitHub repository realcgcristi/rpvlc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/realcgcristi/rpvlc
- Repository: https://github.com/realcgcristi/rpvlc

## Overview

rpvlc is a Node CLI that turns VLC playback into Discord listening activity, with a TUI and optional Last.fm scrobbling. Its main workflow polls or launches VLC, resolves track metadata and artwork, then updates Discord and records eligible scrobbles; users can also control playback and change settings in the TUI. The README documents provider matching, art caching, notifications, and headless operation. Some wiring is unsampled, so uncertain links are omitted; README-backed capability links cite the README.

Main entry points: [`src/index.js`](https://github.com/realcgcristi/rpvlc/blob/main/src/index.js) (Runtime coordinator), [`src/meta.js`](https://github.com/realcgcristi/rpvlc/blob/main/src/meta.js) (Track resolution), [`src/vlc.js`](https://github.com/realcgcristi/rpvlc/blob/main/src/vlc.js) (VLC HTTP control), [`src/settings.js`](https://github.com/realcgcristi/rpvlc/blob/main/src/settings.js) (Settings overlay)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime orchestration"]
  node_app["Runtime coordinator<br/>[index.js]"]
  node_config[("Configuration and history<br/>[config.js]")]
  node_secrets["Secret encryption<br/>[secrets.js]"]
  node_artcache[("Artwork cache<br/>[config.js]")]
end

subgraph group_playback["VLC playback"]
  node_vlc["VLC HTTP control<br/>[vlc.js]"]
end

subgraph group_metadata["Metadata and artwork"]
  node_metadata["Track resolution<br/>[meta.js]"]
  node_itunes["iTunes search<br/>[itunes.js]"]
  node_deezer["Deezer search<br/>[deezer.js]"]
  node_musicbrainz["MusicBrainz search<br/>[musicbrainz.js]"]
end

subgraph group_presence["Presence and scrobbling"]
  node_discordrpc["Discord IPC presence<br/>[rpc.js]"]
  node_lastfm["Last.fm scrobbling<br/>[lastfm.js]"]
end

subgraph group_interface["User interface and settings"]
  node_tui["Playback terminal UI<br/>[tui.js]"]
  node_settings["Settings overlay<br/>[settings.js]"]
end

node_user(("CLI user"))
node_vlcservice["VLC player"]
node_discord["Discord client"]
node_lastfmservice["Last.fm service"]
node_metadataapi["Metadata providers"]

node_user -->|"starts"| node_app
node_app -->|"loads settings"| node_config
node_config -->|"encrypts secrets"| node_secrets
node_app -->|"polls and controls"| node_vlc
node_vlc -->|"reads playback"| node_vlcservice
node_vlc -->|"sends commands"| node_vlcservice
node_app -->|"launches player"| node_vlc
node_app -->|"resolves track"| node_metadata
node_metadata -->|"searches candidates"| node_itunes
node_metadata -->|"searches candidates"| node_deezer
node_metadata -->|"searches candidates"| node_musicbrainz
node_metadata -->|"reads or saves art"| node_artcache
node_musicbrainz -->|"fetches cover art"| node_metadataapi
node_itunes -->|"queries catalog"| node_metadataapi
node_deezer -->|"queries catalog"| node_metadataapi
node_musicbrainz -->|"queries recordings"| node_metadataapi
node_app -->|"connects and updates"| node_discordrpc
node_discordrpc -->|"speaks IPC"| node_discord
node_app -->|"submits scrobbles"| node_lastfm
node_lastfm -->|"sends API requests"| node_lastfmservice
node_app -->|"updates playback view"| node_tui
node_user -->|"controls playback"| node_tui
node_tui -.->|"routes playback actions"| node_vlc
node_user -->|"opens settings"| node_settings
node_settings -->|"saves changes"| node_config
node_settings -->|"starts authentication"| node_lastfm
node_settings -->|"uses accent colors"| node_tui
node_app -->|"notifies track changes"| node_user

click node_app "https://github.com/realcgcristi/rpvlc/blob/main/src/index.js"
click node_config "https://github.com/realcgcristi/rpvlc/blob/main/src/config.js"
click node_secrets "https://github.com/realcgcristi/rpvlc/blob/main/src/secrets.js"
click node_vlc "https://github.com/realcgcristi/rpvlc/blob/main/src/vlc.js"
click node_metadata "https://github.com/realcgcristi/rpvlc/blob/main/src/meta.js"
click node_itunes "https://github.com/realcgcristi/rpvlc/blob/main/src/providers/itunes.js"
click node_deezer "https://github.com/realcgcristi/rpvlc/blob/main/src/providers/deezer.js"
click node_musicbrainz "https://github.com/realcgcristi/rpvlc/blob/main/src/providers/musicbrainz.js"
click node_artcache "https://github.com/realcgcristi/rpvlc/blob/main/src/config.js"
click node_discordrpc "https://github.com/realcgcristi/rpvlc/blob/main/src/rpc.js"
click node_lastfm "https://github.com/realcgcristi/rpvlc/blob/main/src/lastfm.js"
click node_tui "https://github.com/realcgcristi/rpvlc/blob/main/src/tui.js"
click node_settings "https://github.com/realcgcristi/rpvlc/blob/main/src/settings.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_config,node_secrets,node_artcache,node_user,node_discord toneBlue
class node_vlc toneAmber
class node_metadata,node_itunes,node_deezer,node_musicbrainz toneMint
class node_discordrpc,node_lastfm toneRose
class node_tui,node_settings,node_vlcservice,node_lastfmservice,node_metadataapi toneIndigo
```

## Components

### Runtime orchestration

- [Runtime coordinator](https://github.com/realcgcristi/rpvlc/blob/main/src/index.js): `src/index.js`
- [Configuration and history](https://github.com/realcgcristi/rpvlc/blob/main/src/config.js): `src/config.js`
- [Secret encryption](https://github.com/realcgcristi/rpvlc/blob/main/src/secrets.js): `src/secrets.js`
- [Artwork cache](https://github.com/realcgcristi/rpvlc/blob/main/src/config.js): `src/config.js`

### VLC playback

- [VLC HTTP control](https://github.com/realcgcristi/rpvlc/blob/main/src/vlc.js): `src/vlc.js`

### Metadata and artwork

- [Track resolution](https://github.com/realcgcristi/rpvlc/blob/main/src/meta.js): `src/meta.js`
- [iTunes search](https://github.com/realcgcristi/rpvlc/blob/main/src/providers/itunes.js): `src/providers/itunes.js`
- [Deezer search](https://github.com/realcgcristi/rpvlc/blob/main/src/providers/deezer.js): `src/providers/deezer.js`
- [MusicBrainz search](https://github.com/realcgcristi/rpvlc/blob/main/src/providers/musicbrainz.js): `src/providers/musicbrainz.js`

### Presence and scrobbling

- [Discord IPC presence](https://github.com/realcgcristi/rpvlc/blob/main/src/rpc.js): `src/rpc.js`
- [Last.fm scrobbling](https://github.com/realcgcristi/rpvlc/blob/main/src/lastfm.js): `src/lastfm.js`

### User interface and settings

- [Playback terminal UI](https://github.com/realcgcristi/rpvlc/blob/main/src/tui.js): `src/tui.js`
- [Settings overlay](https://github.com/realcgcristi/rpvlc/blob/main/src/settings.js): `src/settings.js`

### Other components

- **CLI user**
- **VLC player**
- **Discord client**
- **Last.fm service**
- **Metadata providers**

## Connections

- CLI user → Runtime coordinator: starts (evidence: `readme.md`)
- Runtime coordinator → Configuration and history: loads settings (evidence: `src/index.js`)
- Configuration and history → Secret encryption: encrypts secrets (evidence: `src/config.js`)
- Runtime coordinator → VLC HTTP control: polls and controls (evidence: `src/index.js`)
- VLC HTTP control → VLC player: reads playback (evidence: `src/vlc.js`)
- VLC HTTP control → VLC player: sends commands (evidence: `src/vlc.js`)
- Runtime coordinator → VLC HTTP control: launches player (evidence: `src/index.js`)
- Runtime coordinator → Track resolution: resolves track (evidence: `src/index.js`)
- Track resolution → iTunes search: searches candidates (evidence: `readme.md`)
- Track resolution → Deezer search: searches candidates (evidence: `readme.md`)
- Track resolution → MusicBrainz search: searches candidates (evidence: `readme.md`)
- Track resolution → Artwork cache: reads or saves art (evidence: `src/meta.js`)
- MusicBrainz search → Metadata providers: fetches cover art (evidence: `src/providers/musicbrainz.js`)
- iTunes search → Metadata providers: queries catalog (evidence: `src/providers/itunes.js`)
- Deezer search → Metadata providers: queries catalog (evidence: `src/providers/deezer.js`)
- MusicBrainz search → Metadata providers: queries recordings (evidence: `src/providers/musicbrainz.js`)
- Runtime coordinator → Discord IPC presence: connects and updates (evidence: `src/index.js`)
- Discord IPC presence → Discord client: speaks IPC (evidence: `src/rpc.js`)
- Runtime coordinator → Last.fm scrobbling: submits scrobbles (evidence: `src/index.js`)
- Last.fm scrobbling → Last.fm service: sends API requests (evidence: `src/lastfm.js`)
- Runtime coordinator → Playback terminal UI: updates playback view (evidence: `src/index.js`)
- CLI user → Playback terminal UI: controls playback (evidence: `readme.md`)
- Playback terminal UI → VLC HTTP control: routes playback actions
- CLI user → Settings overlay: opens settings (evidence: `readme.md`)
- Settings overlay → Configuration and history: saves changes (evidence: `src/settings.js`)
- Settings overlay → Last.fm scrobbling: starts authentication (evidence: `src/settings.js`)
- Settings overlay → Playback terminal UI: uses accent colors (evidence: `src/settings.js`)
- Runtime coordinator → CLI user: notifies track changes (evidence: `readme.md`)
