Skip to content

smart: read SmartList XML and numeric values as rekordbox does - #97

Merged
vynulldev merged 1 commit into
mainfrom
conformance-smart-fixtures
Oct 17, 2026
Merged

vynulldev merged 1 commit into
mainfrom
conformance-smart-fixtures

Conversation

@vynulldev

@vynulldev vynulldev commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

What & why

Two of link-spec's smart-playlist suites crashed before a case ran, so the conformance run skipped them:

  • smart-xml-matrix: the import's dump helper parses SmartList XML with Python's strict parser, which raised on a LogicalOperator of wat.
  • smart-numeric-boundaries: fractional values in rekordbox's integer columns broke the import's JSON decode.

Both now run and match rekordbox in full. The rules come from link-spec's live results and its notes on rekordbox's parser.

SmartList XML (the dump helper now parses as rekordbox's JUCE parser does)

  • Element names match in any case (node, NoDe).
  • A closing tag need not match its opening tag.
  • A repeated attribute keeps its first value.
  • Anything after the first root element is ignored: another root, trailing text, a NUL.
  • No rules are read when the XML has a byte-order mark, text before the root, an unclosed element, or a bad entity or attribute.
  • Operator and LogicalOperator read as integers, and any LogicalOperator but 2 means all-of.
  • Property names match in any case (GENRE works).

Numbers

  • Stored values are read as rekordbox reads them, truncated toward zero:

    • BPM as a signed 32-bit integer, and a track whose BPM reads as negative matches no rule;
    • Rating as a signed byte;
    • Length, ReleaseYear and DJPlayCount as small unsigned numbers.

    Real library values are unchanged.

  • Rule values read as integers saturating at the int32 limits, so 0.5 is 0 and blank or text is 0.

  • The KEY column shows the key alone for a track with zero tempo, and a negative stored tempo by its magnitude, as rekordbox does.

Conformance against rekordbox 7.2.19 goes from 2,764 to 2,942 of 4,250 exact (+178, none lost), and all 287 suites now complete: smart-numeric-boundaries 100/100, smart-xml-matrix 73/73, plus 2 in boundaries, 2 in smart-text-matrix and 1 in smart-rule-matrix.

Tests cover the dump helper's XML and number parsing (run under python3 with sqlcipher3 stubbed), rule integers, signed ratings, negative BPMs and the KEY column label.

Hardware testing

  • Tested on: CDJ-2000NXS2

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

Two link-spec suites crashed before a case ran. The dump helper's strict
XML parser rejected a LogicalOperator of "wat", and fractional values in
integer columns broke the import.

The helper now parses SmartList XML the way rekordbox's JUCE parser does:
element names in any case, a closing tag need not match, a repeated
attribute keeps its first value, and anything after the first root is
ignored, while a byte-order mark, leading text, an unclosed element, or a
bad entity leave no rules. Operator and LogicalOperator read as integers,
and anything but LogicalOperator 2 means all-of. Property names match in
any case.

Stored numbers are read as rekordbox reads them: truncated, BPM as a
signed 32-bit integer (a negative BPM matches no rule), Rating as a signed
byte, and Length, ReleaseYear, and DJPlayCount as small unsigned numbers.
Rule values read as integers saturating at the int32 limits, so 0.5 is 0.
Real library values are unchanged. The KEY column shows the key alone for
a zero tempo and a negative tempo by its magnitude, as rekordbox does.
@vynulldev
vynulldev marked this pull request as ready for review October 17, 2026 22:06
@vynulldev
vynulldev merged commit 2785d56 into main Oct 17, 2026
1 check passed
@vynulldev
vynulldev deleted the conformance-smart-fixtures branch October 17, 2026 22:07
@vynulldev vynulldev added the bug Something isn't working label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant