Skip to content

tools: read My Tag smart-list values as rekordbox does - #197

Merged
vynulldev merged 1 commit into
mainfrom
mytag-values
Nov 24, 2026
Merged

vynulldev merged 1 commit into
mainfrom
mytag-values

Conversation

@vynulldev

Copy link
Copy Markdown
Owner

What & why

A rekordbox smart playlist's My Tag condition stores its tag as an integer attribute in the SmartList XML. rekordbox reads it with JUCE's signed 32-bit conversion and uses the value's bits as the tag ID (link-spec SMART_PLAYLIST_ORACLE.md, "My Tag condition semantics"):

  • a positive value past the signed range saturates to 2147483647, and one below it to -2147483648;
  • negative values carry the high bit, so -1 is tag 4294967295;
  • leading spaces, zeroes and a plus sign are allowed, and only the leading number counts: 0x1 is tag 0 and 1,2147483648 is tag 1;
  • malformed text is tag 0, while a blank value matches nothing.

The dump helper that imports master.db parsed the value with Python's int(). A saturated value therefore named the tag above the signed range instead of 2147483647, and anything int() rejected was looked up as a tag name, so 0x1 matched no track instead of tag 0's.

Changes:

  • juce_int saturates to the signed 32-bit range, like JUCE's conversion. The operator and logical-operator reads already use it; saturating can't change their outcome.
  • My Tag values resolve through juce_int, so they follow every rule above. A value that names no tag keeps the ID it read, and a blank value stays blank.

Real rekordbox writes in-range values, with a high tag ID as its negative form, and those resolve as before. The difference is for smart lists written by other tools or edited by hand.

Tests: TestDumpHelperReadsMyTagValuesLikeRekordbox runs the helper under python3 and resolves 16 values from the oracle: in range, past the range both ways, negative, padded, signed, hex, comma pairs, malformed, blank and unknown.

Conformance against main: 3,693 to 3,715 of 4,250 cases exact (+22, none lost): smart-mytag-matrix +20 (all of its remaining misses) and smart-property-matrix +2 (My Tag values written as signed numbers below the range).

Cost: none: the helper runs once per import, and resolving a value is one regular-expression match as before.

Build, vet, gofmt and all tests pass.

Hardware testing

  • Tested on: N/A: no deck-facing change. Only which tracks an imported smart playlist holds can differ, and only for My Tag values real rekordbox doesn't write; the decks see the playlist like any other.

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

rekordbox reads a My Tag condition's value as a signed 32-bit integer
attribute (JUCE getIntAttribute) whose bits are the tag ID: a positive
value past the signed range saturates to its top, an underflow to its
bottom, "0x1" and malformed text are tag 0, and "1,2147483648" is tag
1 (link-spec SMART_PLAYLIST_ORACLE.md, "My Tag condition semantics").
The dump helper parsed it with Python's int(), so a saturated value
named the tag above the range and anything else unparsable was looked
up as a tag name.

juce_int now saturates like JUCE's conversion, and the helper resolves
My Tag values with it; a value naming no tag keeps the ID it read. The
operator and logical-operator reads already used juce_int; saturating
can't change their outcome.
@vynulldev vynulldev added the bug Something isn't working label Nov 24, 2026
@vynulldev
vynulldev merged commit 379da3f into main Nov 24, 2026
1 check passed
@vynulldev
vynulldev deleted the mytag-values branch November 24, 2026 18:54
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