Skip to content

library: import Traktor collection.nml (tracks, playlists, cues) - #5

Merged
vynulldev merged 2 commits into
mainfrom
traktor-import
Jul 8, 2026
Merged

vynulldev merged 2 commits into
mainfrom
traktor-import

Conversation

@vynulldev

@vynulldev vynulldev commented Jul 8, 2026 •

Copy link
Copy Markdown
Owner

What & why

Adds a Traktor NML importer alongside the existing rekordbox XML / master.db / backup importers, so a Traktor user can bring their whole library into Vynull. First non-rekordbox library format. Traktor stores everything in one XML file (collection.nml), so this mirrors the rekordbox-XML importer and plugs into the same import pipeline.

Imports:

  • Tracks: title, artist, album, genre, BPM, key, rating, year, track number, label, comment, play count, bitrate, file size. Key prefers the text INFO KEY (e.g. "Am") and falls back to mapping Traktor's MUSICAL_KEY VALUE (0 to 23) to standard notation; rating maps Traktor's 0 to 255 scale to 0 to 5 stars; bitrate converts bits/s to kbps.
  • Playlists: the full nested folder + playlist tree, resolving each PRIMARYKEY back to a track via its VOLUME+DIR+FILE location key.
  • Cues: hot cues (Traktor's 0 to 7 mapped to the 1 to 8 slot convention), memory cues, and loops from CUE_V2, reusing the existing import cue carrier so they land in the cue store with no new plumbing. The grid anchor (TYPE 4) and stray fade markers are dropped.

Paths: Traktor encodes the directory with "/:" separators, so the importer rebuilds the real path, prepends a Windows drive volume, and leaves the mac/Linux boot volume off. Files that do not resolve locally fall through to the existing missing-file flagging and the import dialog's path-remap field, exactly like a rekordbox import from another machine.

UI: the import dialog gets a Traktor source radio, the tracks/playlists/cues include options, and a collection.nml placeholder. Because the form now handles more than rekordbox, the source-specific copy is generalized ("Import your library" / "Import a library", "IMPORT LIBRARY").

Caveats: best-effort path reconstruction across platforms, and worth validating against a real collection.nml since the NML format drifts between Traktor versions. Traktor CUE_V2 carries no per-cue colour, so imported cues take the default.

Hardware testing

  • Tested on: N/A for code paths: no change to the load, serve, or analysis code; imported tracks and cues flow to decks through the existing rekordbox serving path. That said, this feeds new data (Traktor-authored cues, BPM, paths) to a deck for the first time, so a sanity check on hardware (load a Traktor-imported track, confirm it plays and its hot cues render) is recommended before relying on it.

Checklist

  • go build ./..., go vet ./..., and go test ./... pass
  • gofmt -l . is clean
  • New source files carry an SPDX header (GPL-3.0-or-later)
  • Tested on real hardware (deck + firmware noted above), or this change doesn't affect deck behaviour
  • I agree my contribution is licensed under the project's GPLv3

vynulldev added 2 commits July 8, 2026 06:27
Add a Traktor NML importer alongside the rekordbox XML/master.db ones.
It parses collection.nml into library.Track plus the nested playlist
tree, and converts CUE_V2 markers into the shared MasterDBCue carrier
the import applier already consumes.

- Tracks: title/artist/album/genre, BPM, key (INFO KEY text, falling
  back to a MUSICAL_KEY 0-23 -> standard-notation map), rating (0-255
  -> 0-5 stars), year, track number, label, comment, play count,
  bitrate (bits/s -> kbps), file size.
- Paths: decode Traktor's "/:"-separated DIR, prepend a Windows drive
  volume, leave the mac/Linux boot volume off. Unresolved files fall
  through to the existing missing-file flagging + path remap.
- Playlists: walk the NODE/SUBNODES tree, resolving each PRIMARYKEY to
  a track via its VOLUME+DIR+FILE location key.
- Cues: hot cues map Traktor's 0-7 to the 1-8 slot convention, memory
  cues and loops carry through, and the grid anchor (TYPE 4) and stray
  fade markers are dropped.

Wired into the api.go import dispatch (.nml) and the import dialog
(Traktor source, tracks/playlists/cues options, collection.nml
placeholder). Covered by a unit test over a 2-track fixture with a
nested playlist folder and a full CUE_V2 set.
The import form now handles Traktor as well as rekordbox, so the
rekordbox-specific button and title copy was misleading. Rename the
empty-state and settings buttons to "Import your library" / "Import a
library", retitle the dialog "IMPORT LIBRARY", note both ecosystems in
the sub-label, and add a Traktor collection.nml line to the dialog hint.
Internal ids and handler names are left unchanged.
@vynulldev
vynulldev marked this pull request as ready for review July 8, 2026 21:15
@vynulldev
vynulldev merged commit 89b9ada into main Jul 8, 2026
1 check passed
@vynulldev
vynulldev deleted the traktor-import branch July 8, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant