Finished Rekordbox adapter

This commit is contained in:
patben8 committed 2026-09-19 13:48:45 +02:00
1 parent 00dd3fe766
commit 7b0d7e3a07
5 files changed
+294 -11

No files matched your search

@@ -39,7 +39,7 @@ from sqlalchemy.orm import joinedload
from ...core.adapter import InvalidCommand, LibraryNotSupported, NotFound, SaveOutcome
from ...core.edit_journal import EditJournal
from ...core.pathmap import PathMapping
from .cue_types import beat_loop_size, kind_for
from .cue_types import beat_loop_size, kind_for, role_and_slot
log = logging.getLogger(__name__)
@@ -182,7 +182,12 @@ class RekordboxStore:
out: dict[str, tuple[int, int]] = {}
for content_id, kind, n in rows:
total, hot = out.get(str(content_id), (0, 0))
out[str(content_id)] = (total + n, hot + (n if (kind or 0) != 0 else 0))
# "Is this a hot cue?" must mean the same here as in the projection,
# or the count in the library table disagrees with the pads shown in
# the deck. `role_and_slot` is the single definition — it also rules
# out the reserved Kind, which occupies no pad.
is_hotcue = role_and_slot(kind)[0] == "hotcue"
out[str(content_id)] = (total + n, hot + (n if is_hotcue else 0))
return out
def cues(self, track_id: str) -> list:
+14
View File
@@ -431,6 +431,20 @@ with tempfile.TemporaryDirectory() as d:
check("Rekordbox has no grid lock",
_raises(lambda: adapter.set_grid_lock(grid_track.id, True), Unsupported))
print("== hot cue counting agrees with the projection ==")
# One definition of "is this a hot cue?", used by both the per-track count
# and the projection. They diverged once: the count treated the reserved
# Kind as a hot cue while the projection called it a memory cue, so the
# library table disagreed with the pads in the deck.
mismatched = []
for t in adapter.tracks[:40]:
cues = (adapter.track_cues(t.id) or TrackCues()).cues
projected = sum(1 for c in cues if c.role == "hotcue")
if adapter.track(t.id).hotcue_count != projected:
mismatched.append(f"{t.title}: {adapter.track(t.id).hotcue_count} vs {projected}")
check("Track.hotcue_count matches the projected hot cues",
not mismatched, "; ".join(mismatched[:3]))
print("== saving warns but proceeds while Rekordbox is running ==")
# pyrekordbox's own commit() refuses outright if it sees a Rekordbox process.
# Konduktor's settled behaviour is to warn, not block — matching Traktor —