Skip to content

feat: Traktor NML export#97

Open
Radexito wants to merge 14 commits into
devfrom
feature/traktor-nml-export
Open

feat: Traktor NML export#97
Radexito wants to merge 14 commits into
devfrom
feature/traktor-nml-export

Conversation

@Radexito

@Radexito Radexito commented Mar 16, 2026

Copy link
Copy Markdown
Owner

Adds the ability to export the library and playlists as a Traktor NML collection file, importable directly into Traktor Pro. Closes #28.


Changes

src/audio/nmlWriter.js (new)

Pure-JS NML writer — no external dependencies.

  • Generates valid Traktor Pro 3 NML (XML version 19)
  • Encodes Traktor DIR paths in /:segment1/:segment2/: format
  • Maps Camelot wheel keys to MUSICAL_KEY integer values (0–23) and key text
  • Writes per-track COLLECTION entries containing:
    - LOCATION (volume + encoded directory + filename)
    - INFO (genre, key text, bitrate, playtime, rating, label, comment, import date)
    - TEMPO (BPM with 6 decimal places, supports bpm_override)
    - LOUDNESS (peak, perceived, and analyzed dB)
    - MUSICAL_KEY (numeric value for Traktor's key display)
    - CUE_V2 AutoGrid beat marker (uses intro_secs when available, defaults to 0 ms)
  • Writes PLAYLISTS section with $ROOT folder node and named playlist child nodes, each containing PRIMARYKEY track references

src/main.js

  • Added export-nml IPC handler — exports a single playlist plus all tracks to a chosen .nml file, emitting export-nml-progress events
  • Added export-nml-all IPC handler — exports all tracks and all playlists

src/preload.js

  • Exposed window.api.exportNml, window.api.exportNmlAll, and window.api.onExportNmlProgress

renderer/src/NmlExportModal.jsx + .css (new)

Export modal following the same idle → exporting → done/error pattern as the existing Rekordbox export modal. Lets the user pick an output folder via the directory dialog; writes to collection.nml.

renderer/src/Sidebar.jsx

Added two context menu items after the existing M3U export entries:

  • Export playlist as NML…
  • Export all as NML…

renderer/src/App.jsx

Wired NmlExportModal and the two new sidebar handler props.

src/tests/nmlWriter.test.js (new)

19 unit tests covering: file creation, XML structure, COLLECTION entry count, LOCATION encoding, TEMPO/BPM, MUSICAL_KEY mapping, INFO genre, LOUDNESS, CUE_V2 beat marker, PLAYLISTS section, PRIMARYKEY references, XML escaping, optional field
handling, and multi-track output. All passing.

vitest.config.js

Added nmlWriter.test.js to the unit test project.

package.json

Added "*.js" pattern to lint-staged so root-level JS files (e.g. vitest.config.js, eslint.config.js) are auto-formatted on commit.

.gitignore

Added *.so / .so. to prevent system shared libraries from being tracked.

@Radexito Radexito force-pushed the feature/traktor-nml-export branch from 4d8725b to b24e505 Compare March 16, 2026 23:49
Radexito and others added 7 commits March 21, 2026 04:28
- Add src/audio/nmlWriter.js — pure-JS NML writer (Traktor Pro 3 format)
  * Encodes Traktor DIR paths (/:seg1/:seg2/: format)
  * Maps Camelot keys to MUSICAL_KEY (0-23) and key text
  * Writes COLLECTION entries with LOCATION, INFO, TEMPO, LOUDNESS,
    MUSICAL_KEY, and AutoGrid CUE_V2 beat marker
  * Writes PLAYLISTS section with $ROOT folder and named playlist nodes
- Add renderer/src/NmlExportModal.jsx + .css — export modal (idle →
  exporting → done/error), mirrors ExportModal pattern
- Add IPC handlers export-nml and export-nml-all in src/main.js with
  progress events; expose via src/preload.js
- Add context menu items in Sidebar: Export playlist as NML, Export all as NML
- Wire NmlExportModal in App.jsx
- Add 19 unit tests in src/__tests__/nmlWriter.test.js (all passing)
- Ignore *.so / *.so.* in .gitignore

Closes #28

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mirror M3U export behaviour: copy tracks to <outputDir>/music/ with
friendly 'Artist - Title.ext' names and write LOCATION paths pointing
to those copies instead of the internal hash-based storage paths.
This makes the exported NML self-contained and importable on any machine.
After selecting files via the import dialog, show a modal that
lets the user save them to a new or existing playlist (or skip).

- New ImportPlaylistModal component with select + name input
- Sidebar fetches playlists, shows modal before importing
- On confirm: creates playlist if needed, imports files, then
  adds all track IDs to the chosen playlist in one batch call

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Radexito Radexito force-pushed the feature/traktor-nml-export branch from 9344848 to fb93266 Compare March 21, 2026 03:47
Radexito and others added 5 commits April 3, 2026 05:27
Keep both Traktor NML and Rekordbox USB export features.
Merge DownloadProvider/DownloadContext, TopBar, search, and
always-mounted DownloadView from dev into this branch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…port

# Conflicts:
#	renderer/src/Sidebar.jsx
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Radexito Radexito force-pushed the feature/traktor-nml-export branch from aaed4a3 to 7b7f689 Compare April 4, 2026 18:46
@Radexito Radexito added area: usb/export USB export, Rekordbox, Serato, Traktor enhancement New feature or request priority: medium Normal priority labels Apr 9, 2026
Radexito and others added 2 commits April 19, 2026 15:30
Keeps NML export Sidebar props + NmlExportModal from HEAD while adopting
dev's TidalDownloadProvider, always-mounted views, and analysis/waveform
progress states.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: usb/export USB export, Rekordbox, Serato, Traktor enhancement New feature or request priority: medium Normal priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant