Skip to content

Architecture

Giwi edited this page Nov 9, 2026 · 12 revisions

Architecture

Crates

core/   musicwasp-core   library DB, scanning, tags, playback/DSP, auto-tag, playlists, search
gui/    musicwasp        egui/eframe application, settings, themes, dialogs
cli/    musicwasp-cli    headless library and playlist tool

gui has a library target (musicwasp_gui) and a thin binary launcher. This lets kittest integration tests drive the real application.

Core modules

  • library - SQLite connection, queries, scans, imports, ratings, history and restore
  • backup - timestamped VACUUM INTO backups and validation
  • player - audio thread, queue handoff, gapless and crossfade
  • dsp - 10-band RBQ peaking EQ and preamp
  • analysis - lock-free post-EQ PCM tap for the visualizer
  • tags - tag reading/writing and undo snapshots
  • bounded - size-capped reads for feeds, sidecars and downloaded covers
  • netguard - address policy for podcast feeds, enclosures and redirects (public addresses by default)
  • dev - endpoint overrides for tests, honoured only in debug builds
  • lyrics - .lrc parsing, sidecar lookup and embedded tag lyrics
  • playlist - manual playlists, smart-playlist folders and nested folders
  • m3u - M3U parsing and export for manual and smart playlists
  • smart - JSON rule definitions compiled to SQL
  • search - advanced query parser and saved searches
  • autotag - MusicBrainz/Cover Art Archive workflow
  • reconcile - dry-run matching of vanished rows to renamed files
  • organize - tag-based file moves, collision checks and the undo journal
  • podcast - RSS/Atom parsing and podcast subscription/episode storage
  • radio - internet radio station storage
  • scrobble - ListenBrainz submissions

GUI modules

  • app - application state, transport, jobs, dialogs, library actions
  • ui - panels, track table, playlists, dialogs, settings windows
  • hygiene - missing files, duplicates and the rename preview window
  • organize - file organizer preview table and apply/undo window
  • mini_player - compact viewport and its command bridge
  • debug_hooks - MUSICWASP_* developer hooks, active only with MUSICWASP_DEBUG=1
  • tray - Linux StatusNotifierItem menu and transport commands
  • theme - palettes, JSON skins, live colour editor, surface/typography tokens, glass backdrop, accessibility scaling
  • visualizer - lactea MilkDrop engine, wgpu offscreen texture, preset list and transitions
  • i18n - translation catalogues and language switching
  • settings - persisted settings, shortcuts, columns and layouts
  • icons - Inter and Phosphor font registration, labels and logos
  • images - bounded image decoding (dimension and allocation limits) for skins and cover art
  • mpris - Linux desktop integration

Background work

  • scanning uses a worker thread with its own SQLite connection
  • progress and cancellation travel over a small channel
  • cover fetch and auto-tag work on worker threads
  • the watcher debounces filesystem events
  • the UI polls jobs and requests repaints instead of blocking

Database migrations

Migrations are additive. Columns are checked with PRAGMA table_info before ALTER TABLE; indexes are created separately. date_added is backfilled from the older added_at field.

Native Wayland

Native Wayland is the default. File drops use winit's Wayland data-device support. The repository temporarily pins a reviewed winit 0.30 backport and a local egui-winit clipboard patch so Hyprland and similar compositors receive both drops and clipboard on one data device. The removal checklist lives in patches/REMOVAL.md, and a dependency-update test guards the pins. Set MUSICWASP_X11=1 to force XWayland for one launch.

Tests

  • core integration tests live in core/tests
  • GUI integration tests live in gui/tests
  • private GUI unit tests live in gui/tests/unit and are included with #[path]
  • kittest drives the real app through AccessKit
  • a fake MusicBrainz server covers auto-tag without network
  • tests synthesize WAV files and need no sample library or audio device

See Development for commands.

Clone this wiki locally