Library & Set Exporters
Relevant source files
The following files were used as context for generating this wiki page:
The Library & Set Exporters system manages the preparation, organization, and distribution of music data to performance hardware and software. This module acts as the final stage of the DJ preparation pipeline, converting analyzed track metadata and sequenced sets into deterministic exports for industry-standard platforms.
The system ensures that all library modifications—such as metadata cleaning and cue placement—remain non-destructive by storing changes in a local SQLite database while keeping original source files untouched. Exports target specialized formats including rekordbox XML, Serato crates, and Pioneer-compatible USB media.
Sources: README.md:120-137, CHANGELOG.md:195-201, apps/desktop/src/App.tsx:885-894
Library Management Architecture
The library architecture utilizes a local-first approach where a Rust core handles performance-critical scanning and a React frontend provides the management interface. The system indexes local files by calculating BLAKE3 fingerprints to ensure deduplication and data integrity.
Data Flow for Library Ingestion
When you select a folder, the system performs a recursive scan and extracts metadata using various backends.
Metadata Extraction and Cleaning
The system extracts metadata using audiotags and id3 crates. It specifically targets title, artist, BPM, Camelot keys, and embedded artwork. If extraction fails, the system uses the filename as a fallback title to ensure the track remains importable.
| Component | Target Data | Backend/Crate |
|---|---|---|
| Tags | Title, Artist, Album, Genre, Year | audiotags, id3, metaflac |
| Audio | Duration, Format, File Size | riff.rs, aiff.rs, mp3.rs |
| Extras | BPM, Camelot Key, Ratings, Comments | id3, vorbis |
| Visuals | Embedded Artwork | EmbeddedArtwork struct |
Sources: crates/core/src/metadata.rs:43-69, CHANGELOG.md:214-230
Export Systems
The export system generates deterministic files and media packages. It validates exports against known hardware behaviors, such as CDJ-2000NXS2 and CDJ-3000 compatibility.
Export Targets
The system supports multiple export formats to bridge the gap between preparation and performance:
- rekordbox XML: A deterministic XML generation for Pioneer's ecosystem.
- Serato Crates: Native crate files for Serato DJ.
- USB Media: Preparation of FAT32/MBR formatted drives with Pioneer-compatible folder structures.
- Spotify (Post-MVP): Metadata-only playlist publishing using OAuth 2.0 and PKCE.
Sources: README.md:103-107, CHANGELOG.md:12-19, CHANGELOG.md:383-389
Export and Sync Process
The synchronization and export process ensures that the local database state is correctly mapped to the target format.
Sources: README.md:120-137, CHANGELOG.md:12-19
API and IPC Contracts
Communication between the React frontend and the Rust backend occurs through a typed IPC bridge. This ensures that library queries and export commands are structured correctly.
Key Library Endpoints
| Command | Parameters | Description |
|---|---|---|
list_tracks | ListTracksRequest | Fetches tracks with server-side SQL filtering and sorting. |
list_genres | None | Returns distinct genres with track counts. |
get_artwork | GetArtworkRequest | Retrieves base64 data URLs for cached artwork. |
chart_list | ChartListRequest | Lists Beatport snapshots with taste-matching scores. |
Sources: apps/desktop/src/services/api.ts:33-80, CHANGELOG.md:21-36
Sorting and Filtering Logic
The library supports server-side SQL query building for efficiency. Filters include BPM range, Camelot keys, analysis status, and minimum ratings.
export function normalizeFilters(
filters: ListTracksFilters | undefined
): ListTracksFilters | undefined {
if (!filters) return undefined;
const normalized: ListTracksFilters = {};
if (filters.bpmMin != null && Number.isFinite(filters.bpmMin)) {
normalized.bpmMin = filters.bpmMin;
}
// ... extra validation for keys and genres
return Object.keys(normalized).length > 0 ? normalized : undefined;
}
Sources: apps/desktop/src/lib/library.ts:79-112, CHANGELOG.md:21-36
Summary
The Library & Set Exporters module provides a robust, local-first foundation for DJ music management. By combining non-destructive metadata handling with deterministic export generation for platforms like rekordbox and Serato, the system accelerates the transition from track discovery to performance-ready sets. It utilizes a typed IPC bridge and server-side SQL filtering to maintain high performance even as libraries scale.
Sources: README.md:88-107, CHANGELOG.md:21-36