Repository navigation
tools: read My Tag smart-list values as rekordbox does - #197
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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"):
-1is tag 4294967295;0x1is tag 0 and1,2147483648is tag 1;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 anythingint()rejected was looked up as a tag name, so0x1matched no track instead of tag 0's.Changes:
juce_intsaturates 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.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:
TestDumpHelperReadsMyTagValuesLikeRekordboxruns 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
Checklist
go build ./...,go vet ./..., andgo test ./...passgofmt -l .is cleanGPL-3.0-or-later)