mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Compare commits
199
Commits
v0.1.1-b4
...
v0.3.5-b26
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
210c1ab135 | ||
|
|
e211fd180a | ||
|
|
5d059c7604 | ||
|
|
667068c2f1 | ||
|
|
75cb0c8138 | ||
|
|
068e4da08b | ||
|
|
1a28ad6102 | ||
|
|
dd82fa99bb | ||
|
|
fae91e8772 | ||
|
|
68128a123e | ||
|
|
23a5cd72f4 | ||
|
|
17c177e34e | ||
|
|
ee0e055b3f | ||
|
|
21e249ff97 | ||
|
|
3e9d5d5528 | ||
|
|
13ba2c721a | ||
|
|
4cb630d0d5 | ||
|
|
64b0396d66 | ||
|
|
284a7514fe | ||
|
|
6eecb2288a | ||
|
|
d70a7c5de2 | ||
|
|
5c9387f136 | ||
|
|
9329236955 | ||
|
|
2821ba124d | ||
|
|
f9ef38d826 | ||
|
|
518542c7bb | ||
|
|
bf427a628e | ||
|
|
4340e948ac | ||
|
|
fe63acc2a2 | ||
|
|
06361a851f | ||
|
|
0605dbabe6 | ||
|
|
6be99e6d7e | ||
|
|
0eac972173 | ||
|
|
422297d890 | ||
|
|
ee48e80440 | ||
|
|
0aeb5019ad | ||
|
|
1f2ca18e8a | ||
|
|
19a604f730 | ||
|
|
83b0978b14 | ||
|
|
0ced274f73 | ||
|
|
fc4e7804b3 | ||
|
|
77b063ba0e | ||
|
|
16c3552be6 | ||
|
|
32cfb034e2 | ||
|
|
b70798a0fe | ||
|
|
4c51f57fe9 | ||
|
|
7b2d6de411 | ||
|
|
8230722105 | ||
|
|
1464b1e211 | ||
|
|
10f175b206 | ||
|
|
a65ef959b2 | ||
|
|
87cbd3720e | ||
|
|
591f2bc791 | ||
|
|
ebe30c1128 | ||
|
|
cd1914216f | ||
|
|
d10b11f8eb | ||
|
|
79a8a843c5 | ||
|
|
0204a322ff | ||
|
|
05051e7056 | ||
|
|
b5dabbc8a0 | ||
|
|
86bbb7b961 | ||
|
|
d474c662db | ||
|
|
a0df683fee | ||
|
|
3385b794e9 | ||
|
|
2c352b76a1 | ||
|
|
40630ff78e | ||
|
|
966f3fe8c5 | ||
|
|
a03b9056a9 | ||
|
|
26b556d975 | ||
|
|
c87444bda5 | ||
|
|
7ba71981c8 | ||
|
|
89c7dade25 | ||
|
|
b154df430a | ||
|
|
e5c7b67626 | ||
|
|
9f79f5a849 | ||
|
|
c8b86100f0 | ||
|
|
0fac84cb73 | ||
|
|
71ee877784 | ||
|
|
920146f2c0 | ||
|
|
ba7b662b93 | ||
|
|
e5fb0f0dbb | ||
|
|
e8a53eee07 | ||
|
|
36a6df4d3b | ||
|
|
72a52d3291 | ||
|
|
c3571fd054 | ||
|
|
b5b3dd04c3 | ||
|
|
4e9472c14a | ||
|
|
957525393b | ||
|
|
bdc62f2c1b | ||
|
|
7960a5a68f | ||
|
|
c5280a95f2 | ||
|
|
e73fa05e1f | ||
|
|
775e94168c | ||
|
|
2784879872 | ||
|
|
702e5d86a6 | ||
|
|
d7f8768d4c | ||
|
|
5c193e0ab7 | ||
|
|
badf12b991 | ||
|
|
ecc0e4c8df | ||
|
|
ae03a93f98 | ||
|
|
c560876c02 | ||
|
|
e805635383 | ||
|
|
27471a82cd | ||
|
|
28b705173e | ||
|
|
681add852a | ||
|
|
376569ec75 | ||
|
|
b5b0fa91fe | ||
|
|
34b18893ef | ||
|
|
2c02019bb2 | ||
|
|
08c53e1150 | ||
|
|
9be2c029b2 | ||
|
|
a6f96d5943 | ||
|
|
bd35418a89 | ||
|
|
86b26e3229 | ||
|
|
bb9f6e2bd3 | ||
|
|
3a9dc90344 | ||
|
|
4b9716d47a | ||
|
|
0b909a84f4 | ||
|
|
157c2c0a04 | ||
|
|
4878d82671 | ||
|
|
c2f5191962 | ||
|
|
99d590a051 | ||
|
|
eccd352ae5 | ||
|
|
90beeef226 | ||
|
|
84947bb0bb | ||
|
|
08884ca6bd | ||
|
|
9851c3c056 | ||
|
|
17b68c40bb | ||
|
|
cb76277016 | ||
|
|
24b9dfe49f | ||
|
|
513808a6d2 | ||
|
|
85f01f6723 | ||
|
|
2e04bcb9f6 | ||
|
|
bd425f8cd6 | ||
|
|
b9d43dd7ea | ||
|
|
a3747e887b | ||
|
|
8c875cb6cd | ||
|
|
ce06731dc8 | ||
|
|
c6aaded26d | ||
|
|
c1f121ae1d | ||
|
|
f1087b60fa | ||
|
|
394520c2cf | ||
|
|
642977e9bc | ||
|
|
9f299051fa | ||
|
|
738d04eada | ||
|
|
22f59c5c1e | ||
|
|
805d360907 | ||
|
|
46d3978580 | ||
|
|
0a9764ee89 | ||
|
|
f9497b391b | ||
|
|
be80e572e5 | ||
|
|
2810f24563 | ||
|
|
950352f7ec | ||
|
|
b4dc8949de | ||
|
|
0fd5d56a4e | ||
|
|
88737f2b08 | ||
|
|
efdd0f6203 | ||
|
|
d18db9566c | ||
|
|
76bf142fb4 | ||
|
|
73694fe532 | ||
|
|
532dc5d6ac | ||
|
|
b71436fad6 | ||
|
|
5909c704f4 | ||
|
|
07e85cfdc9 | ||
|
|
6c123e2597 | ||
|
|
46ce3db916 | ||
|
|
6cc73267a6 | ||
|
|
68e0b032b3 | ||
|
|
a5f995562f | ||
|
|
4aeb5d65d3 | ||
|
|
7160fa3978 | ||
|
|
805b95fe5e | ||
|
|
93ec2ef425 | ||
|
|
8d11acd783 | ||
|
|
a081a7a44d | ||
|
|
06137f5c99 | ||
|
|
36cfb96c05 | ||
|
|
ed9dfc9d6b | ||
|
|
ba3e7c251e | ||
|
|
0b38d4826f | ||
|
|
7b0d7e3a07 | ||
|
|
00dd3fe766 | ||
|
|
5aeb9956cd | ||
|
|
30065a94fe | ||
|
|
43e712afbd | ||
|
|
010f67cd2d | ||
|
|
4592e13228 | ||
|
|
6e24f5ef1d | ||
|
|
c9e85bbdb5 | ||
|
|
08c9b8121d | ||
|
|
dd97f27ac7 | ||
|
|
3f51444e2a | ||
|
|
73f7fc4282 | ||
|
|
b8b466b608 | ||
|
|
bd85d6794c | ||
|
|
ed2b72c749 | ||
|
|
f19a662bd3 | ||
|
|
41111c7c4c | ||
|
|
e8d2c66e06 |
No files matched your search
@@ -0,0 +1,635 @@
|
||||
# Discussion: Multi-platform library support (Traktor / Rekordbox / Serato)
|
||||
Date: 2026-09-17
|
||||
Status: Concluded
|
||||
|
||||
## Context
|
||||
Konduktor currently targets Traktor only (NML v20 via `traktor-nml-utils`), with a
|
||||
save path whose central guarantee is byte-exact fidelity: a no-op save is
|
||||
byte-identical, and only edited objects diff (`test_save_fidelity.py`).
|
||||
|
||||
Ben wants to extend to Rekordbox and Serato. Proposed shape:
|
||||
1. A generic library data structure that supports **all** features of **all**
|
||||
platforms ("full support is critical").
|
||||
2. Load any platform's library into that structure.
|
||||
3. Edit/prepare with Konduktor's existing features.
|
||||
4. Save back to the **original** library format.
|
||||
5. Ultimate goal: **convert** a library from one platform to another.
|
||||
|
||||
## Open Questions
|
||||
- [ ] **Command vocabulary for grids** (now evidenced): `set_grid(bpm, anchor_sec)`
|
||||
cannot express per-marker edits. Needs marker-level commands — add / move /
|
||||
set-BPM / delete marker — plus marker selection in `GridControls`. Design these.
|
||||
- [ ] Verification tests: write the per-platform "localized change" analogues —
|
||||
Rekordbox row-level table-dump diff, Serato byte diff excluding the patched GEOB
|
||||
frame + whole-file diff of crates.
|
||||
- [ ] Rekordbox `rb_local_usn` / update-sequence + cloud-sync columns: writing rows
|
||||
without maintaining these may corrupt RB's own sync state. Needs investigation.
|
||||
|
||||
## Decisions Made
|
||||
|
||||
### Write scope: full read/write for all three platforms
|
||||
- **Decision**: Konduktor must edit and save back into each platform's own live
|
||||
library — Traktor NML, Rekordbox (`master.db`), and Serato (binary crates +
|
||||
in-file GEOB tags). Not read-only, not export-only.
|
||||
- **Rationale**: The user's existing library on their chosen platform is the
|
||||
canonical source; Konduktor is a management tool for it, so it must be able to
|
||||
write back wherever the user actually works.
|
||||
- **Alternatives considered**: Traktor-write-only with read+export for the others
|
||||
(smaller, safer v1); Traktor+Serato write with Rekordbox read-only (avoids the
|
||||
encrypted/unsupported RB DB); read-all/export-only (no in-place editing at all).
|
||||
All rejected as too limited.
|
||||
- **Consequence**: Rekordbox and Serato writes carry materially higher risk than
|
||||
NML — both formats are reverse-engineered and neither has a fidelity guarantee
|
||||
equivalent to the current byte-exact NML save. Per-platform backup + verification
|
||||
strategy becomes a first-class requirement.
|
||||
|
||||
### End goal: canonical-library management + converted exports
|
||||
- **Decision**: The user's main platform library remains the canonical source of
|
||||
truth. Konduktor manages and edits it in place, and *additionally* can produce
|
||||
converted exports for other platforms.
|
||||
- **Rationale**: Keeps the user's existing workflow intact — they keep using their
|
||||
DJ software normally — while making conversion a deliberate, separate output.
|
||||
- **Alternatives considered**: one-shot migration only (too narrow); two-way sync
|
||||
between libraries (rejected — requires cross-platform track identity, change
|
||||
detection and conflict resolution; much larger project); Konduktor owning its own
|
||||
canonical library format with platforms as import/export only (rejected — changes
|
||||
the product's identity and displaces the user's real library).
|
||||
- **Consequence**: Two distinct write paths must coexist: a high-fidelity in-place
|
||||
*edit* path per platform, and a lossy-by-design *export* path. They have opposite
|
||||
requirements and should not share an implementation.
|
||||
|
||||
### Track identity: not needed — export always generates a fresh target library
|
||||
- **Decision**: An Export is a one-time conversion that generates a **fresh** target
|
||||
library. It never merges into an existing library on the target platform. The
|
||||
originally-loaded library remains canonical and is the only thing edited in place.
|
||||
- **Rationale**: Keeps the canonical-source model clean — edits go back to the source
|
||||
library, exports are disposable output. Removes the need for any cross-platform
|
||||
track-matching mechanism.
|
||||
- **Alternatives considered**: path-only matching (fails on relocation); path with
|
||||
artist/title/duration tag fallback (false positives); audio content hashing (robust,
|
||||
survives moves, but requires a full library scan); acoustic fingerprinting
|
||||
(Chromaprint/AcoustID — heavy, solves a problem this product doesn't have). All
|
||||
rejected as unnecessary given fresh-export-only.
|
||||
- **Consequence**: The existing `volume + dir + file` primary key remains sufficient.
|
||||
Cross-library identity is deferred indefinitely; it would only return if merge-style
|
||||
export were ever wanted.
|
||||
|
||||
### Serato backup: GEOB-frame sidecar, not full file copies
|
||||
- **Decision**: Before patching a Serato GEOB frame, snapshot the original frame bytes
|
||||
to a sidecar restore file. Do not copy whole audio files. Crate files are copied
|
||||
wholesale (tiny).
|
||||
- **Rationale**: Kilobytes instead of gigabytes per save, and a complete restore for
|
||||
everything Konduktor actually touches, since Konduktor only ever rewrites those frames.
|
||||
- **Alternatives considered**: full audio-file backups — rejected on cost (~1 GB for a
|
||||
100-track save).
|
||||
- **Risk accepted**: does not protect against the tag library corrupting an unrelated
|
||||
region of the audio file. This exposure already exists via `file_tags.py` cover-art
|
||||
writes; Serato support widens it from occasional to routine.
|
||||
|
||||
### Export = a new self-contained library, always including copied audio
|
||||
- **Decision**: An export/conversion always produces a whole new library at a
|
||||
user-chosen destination, complete with copies of the music files — for every target
|
||||
platform, not just Serato. Reference-in-place is not offered.
|
||||
- **Audio folder layout**: a **global, persistent export setting** with two options —
|
||||
**flat single folder (default)** or **mirror source directory structure**.
|
||||
*Rationale*: flat is predictable and simple for the common case; mirroring is there
|
||||
for users who want their original structure preserved. *Alternatives considered*:
|
||||
organised Artist/Album from metadata (clean but depends on metadata quality and needs
|
||||
sanitising); mirror playlist structure (legible on USB, but duplicates tracks that
|
||||
appear in multiple playlists).
|
||||
- **Rationale**: The export is self-contained and portable (USB drive, another machine,
|
||||
handing it to someone else). Consistent behaviour across targets.
|
||||
- **Alternatives considered**: copy only where the format forces it (Serato), letting
|
||||
Traktor/Rekordbox exports reference originals in place for a near-instant export;
|
||||
offering it as a per-export user choice. Both rejected in favour of one predictable
|
||||
behaviour.
|
||||
|
||||
### Export Sets: user-curated export scope
|
||||
- **Decision**: Introduce an **Export Set** (not "Crate" — see naming decision) — a named, persisted list of track and playlist
|
||||
*references* defining what a given export includes. Enables partial exports. Each
|
||||
crate belongs to a specific library, and crate data is persisted in Konduktor's own
|
||||
storage (not in the platform library).
|
||||
- **Flow**: open library → prep tracks → save back to the canonical library → create a
|
||||
crate → drag tracks/playlists into it → export crate (choose target platform +
|
||||
destination) → Konduktor writes the target library files and copies the audio.
|
||||
- **Rationale**: Users rarely want to convert an entire library; export scope needs to
|
||||
be curated and re-usable across repeat exports.
|
||||
- **Naming**: called **Export Set**, not "Crate". *Rationale*: "Crate" is Serato's own
|
||||
term for a playlist and Konduktor imports Serato crates — the collision would be
|
||||
confusing in a multi-platform tool. *Alternatives considered*: keeping "Crate"
|
||||
(familiar DJ vocabulary, but ambiguous); "Bundle"; "Package".
|
||||
- **Reference semantics: live**. An Export Set stores pointers to playlists; export
|
||||
resolves them at export time, so later additions to a playlist are picked up.
|
||||
*Alternatives considered*: snapshot-at-add (frozen and auditable, but stale);
|
||||
live-with-optional-freeze (more flexible, more UI + model complexity).
|
||||
*Consequence*: the export preview must be computed at export time, never stored.
|
||||
- **Storage: own store, keyed by stable library ID**. A dedicated Export Sets store,
|
||||
separate from `userprefs.json`, with each library assigned a stable generated ID so
|
||||
that moving or renaming the collection file does not orphan its export sets.
|
||||
*Alternatives considered*: keying by collection file path (simple, orphans on move);
|
||||
storing inside `userprefs.json` (best-effort I/O, no backup — inadequate for curated
|
||||
user work); a sidecar file next to the user's library (travels automatically, but
|
||||
writes Konduktor files into the user's Traktor/Serato folders).
|
||||
|
||||
### Export mechanics
|
||||
- **Flat-layout filename collisions: counter suffix.** Second and later collisions
|
||||
become `Xtal-2.mp3`, `Xtal-3.mp3`. *Rationale*: human-readable and predictable.
|
||||
*Alternatives considered*: metadata-based disambiguation (`Xtal (Aphex Twin).mp3` —
|
||||
most legible and stable, but depends on metadata quality and needs sanitising); short
|
||||
hash suffix (stable across re-exports regardless of order, but ugly).
|
||||
*Known consequence*: numbering depends on processing order, so repeat exports may
|
||||
assign different suffixes to the same tracks.
|
||||
- **Playlist folder structure: preserve where supported, flatten with path names
|
||||
otherwise.** Keep the tree on Traktor and Rekordbox; on flat targets, flatten to names
|
||||
encoding the path (e.g. `House / Peak Time`). *Rationale*: retains the structural
|
||||
information in readable form on every target and avoids name collisions between
|
||||
same-named playlists in different folders. *Alternatives considered*: flatten to bare
|
||||
names (cleaner, but collides); always flatten (uniform, but discards structure the
|
||||
target could represent).
|
||||
- **Re-export to an occupied destination: warn, then overwrite on confirm.** *Rationale*:
|
||||
the destination stays the single current copy, which is what re-export usually means,
|
||||
with a guard against accidental loss. *Alternatives considered*: always write a new
|
||||
timestamped folder (safe, but fills the drive with copies of a large collection);
|
||||
refuse and require an empty destination (tedious for a routine operation); incremental
|
||||
update in place (fast, but reintroduces target-library matching/diffing, which the
|
||||
fresh-export decision deliberately avoided).
|
||||
- **Whole-library export: an explicit "export entire library" action.** A separate
|
||||
action that skips export-set creation. *Rationale*: wholesale migration is a common
|
||||
real use case and shouldn't require busywork. *Alternatives considered*: export sets
|
||||
only (uniform, but forces a select-everything set); a select-all shortcut inside the
|
||||
export set editor (single code path, but less discoverable).
|
||||
|
||||
### Export set resolution and export UX
|
||||
- **Playlist resolution: auto-include, deduplicate, copy once.** Every track referenced
|
||||
by a playlist in the export set is included automatically; a track appearing in
|
||||
multiple playlists, or also added individually, is copied to disk exactly once.
|
||||
*Alternatives considered*: auto-include but surface the implied tracks in the UI (more
|
||||
transparent, more UI); require explicit inclusion (precise, but surprising).
|
||||
- **Missing audio files: pre-scan, report, let the user decide.** Verify every file
|
||||
exists before copying anything; present what's missing and let the user cancel or
|
||||
proceed without them. *Rationale*: fails fast rather than halfway through a multi-hour
|
||||
copy. *Alternatives considered*: skip silently (incomplete export the user never
|
||||
learns about — worse given the loss report was deferred); abort entirely (one
|
||||
unmounted drive blocks an otherwise fine export).
|
||||
- **Export UX: pre-check space, progress with cancel.** Estimate total size and verify
|
||||
the destination has room before starting; show per-file progress with a working
|
||||
cancel. *Alternatives considered*: cancel with rollback (destination never left
|
||||
half-finished, but deleting files from a user-chosen location needs care);
|
||||
progress-only with no pre-check (discovers a full drive after an hour of copying).
|
||||
*Known consequence*: cancelling leaves a partial export that must be cleaned up or
|
||||
clearly marked incomplete.
|
||||
|
||||
### Serato export copies the audio files
|
||||
- **Decision**: Exporting to Serato copies the original audio files to the export
|
||||
destination and writes the GEOB frames into the **copies**, leaving the canonical
|
||||
library's files untouched.
|
||||
- **Rationale**: Serato's prep data lives inside the audio files, so a Serato export
|
||||
cannot reference the originals without mutating them — and the originals belong to
|
||||
the canonical library.
|
||||
- **Open consequence**: creates an asymmetry with Traktor/Rekordbox exports, whose data
|
||||
lives in a library file and could reference originals in place. See Open Questions.
|
||||
|
||||
### Rekordbox open-app handling: warn and proceed
|
||||
- **Decision**: If Rekordbox appears to be running when the user saves, Konduktor
|
||||
**warns but allows the save to proceed** — it does not hard-refuse.
|
||||
- **Rationale**: Consistent with the existing Traktor behaviour (the user is warned to
|
||||
close Traktor before saving, not blocked).
|
||||
- **Alternatives considered**: detect-and-refuse (safer, but blocks the user on a
|
||||
detection heuristic that may be wrong).
|
||||
- **Risk accepted**: Rekordbox may hold `master.db` open and runs cloud sync, so a
|
||||
concurrent write is riskier than Traktor's overwrite-on-exit behaviour. The backup
|
||||
taken before the write is the mitigation.
|
||||
|
||||
### Backup/verification: same invariant, per-platform mechanism
|
||||
- **Decision**: Keep the existing invariant — *an edit changes only what it was
|
||||
supposed to change* — and implement a per-platform comparison mechanism for it:
|
||||
Traktor byte diff (existing), Rekordbox full table dump with row-level diff, Serato
|
||||
byte diff of the audio file excluding the patched GEOB frame plus whole-file diff of
|
||||
crate files. Backups: copy `collection.nml` / copy `master.db` (+ WAL/SHM) /
|
||||
Serato strategy TBD (see Open Questions).
|
||||
- **Rationale**: Generalizes `test_save_fidelity.py`'s guarantee to formats where a
|
||||
byte-identical whole-file comparison is meaningless.
|
||||
- **Alternatives considered**: dropping the fidelity guarantee for the non-Traktor
|
||||
platforms — rejected, it is the project's core safety property.
|
||||
|
||||
### Cue model: rich core cue, adapters collapse on write
|
||||
- **Decision**: Model a cue richly enough to cover all three platforms:
|
||||
`{ position_sec, length_sec?, role: hotcue|memory, slot?, type: cue|fade_in|fade_out|
|
||||
load|loop, color?, name? }`. Adapters collapse it per platform — Traktor rejects
|
||||
`role: memory`; Rekordbox and Serato have no `fade_in`/`fade_out`/`load` types;
|
||||
Serato keeps loops in a separate saved-loop bank rather than consuming a cue slot.
|
||||
- **Platform differences captured**: Traktor = 8 typed hotcue slots (loop is a cue
|
||||
*type*); Rekordbox = 8 hotcues A–H plus unlimited memory cues, colour per cue;
|
||||
Serato = 8 cues plus a separate saved-loop bank, colour per cue.
|
||||
- **Correction noted during discussion**: Traktor's `CueV2Type` *does* carry a `color`
|
||||
field, so NML supports cue colours — an earlier assumption to the contrary was wrong.
|
||||
**Lesson: establish capabilities empirically per format rather than assuming them.**
|
||||
|
||||
### Lossiness policy: degrade where sensible, drop otherwise
|
||||
- **Decision**: On export, data the target cannot represent is **degraded to the
|
||||
nearest equivalent where one exists, and dropped only where none does** — e.g. a
|
||||
Traktor fade-in cue becomes a plain cue in Serato; Rekordbox memory cues fill spare
|
||||
hotcue slots in Traktor until they run out.
|
||||
- **Rationale**: The project aims for as much feature parity across platforms as
|
||||
possible; silently discarding representable data works against that.
|
||||
- **Alternatives considered**: drop silently (clean output, but the user only discovers
|
||||
the loss on the gear); refuse to export when data would be lost (too rigid).
|
||||
- **No loss report for now**: an export summary of what was degraded or dropped was
|
||||
explicitly deferred ("not for now"). The adapters will know what they collapsed, so
|
||||
it remains cheap to add later.
|
||||
|
||||
### Proposed sequencing (not yet confirmed)
|
||||
1. Fix the flexible-grid bug standalone (small, independent, fixes a present-day data
|
||||
risk). Requires verifying the NML representation first.
|
||||
2. Refactor to generic model + adapter interface with **Traktor as the only adapter** —
|
||||
no new formats, all existing tests must still pass, so `test_save_fidelity.py` proves
|
||||
the projection+command split broke nothing. Takes the architectural risk where it is
|
||||
verifiable.
|
||||
3. Add the second platform — where a one-adapter abstraction gets tested for real.
|
||||
4. Export — only meaningful once two platforms exist.
|
||||
|
||||
### Sequencing: grid fix → Traktor-only refactor → Rekordbox → export
|
||||
- **Decision**:
|
||||
1. Fix the flexible-beatgrid handling as a **standalone change first** (small,
|
||||
independent, and currently writing inconsistent grids to real collections).
|
||||
2. Refactor to the generic model + adapter interface with **Traktor as the only
|
||||
adapter** — no new formats, every existing test must still pass, so
|
||||
`test_save_fidelity.py` proves the projection+command split changed nothing.
|
||||
3. Add **Rekordbox** as the second platform.
|
||||
4. Build the **export** path last (it only becomes meaningful once two platforms
|
||||
exist).
|
||||
- **Rationale**: takes the architectural risk where it is verifiable against existing
|
||||
invariants, before any unverifiable format is introduced. A one-adapter abstraction is
|
||||
always wrong in ways that only surface with the second adapter.
|
||||
- **Second platform — Rekordbox over Serato**: chosen despite the riskier write target
|
||||
(SQLCipher-encrypted DB, cloud sync, version-fragile schema) because `pyrekordbox` is
|
||||
the more mature library. *Alternative considered*: Serato second — no library-file
|
||||
risk, but writes go into users' audio files and the format is entirely
|
||||
reverse-engineered.
|
||||
- **Tauri packaging: dropped from scope for now.**
|
||||
- **CDJ/USB export (`export.pdb` + ANLZ files): explicitly OUT OF SCOPE.** Raised in a
|
||||
forked conversation and rejected as impractical to implement. Recorded here only so
|
||||
it is not rediscovered and re-proposed.
|
||||
- **Bulk metadata editing: dropped from scope for now.** Not built before the refactor;
|
||||
revisit after the adapter architecture exists so it only has to be written once.
|
||||
|
||||
### One library open at a time
|
||||
- **Decision**: `AppState` continues to hold exactly one loaded library. Export always
|
||||
reads the currently-open library.
|
||||
- **Rationale**: Simplest plumbing, no ambiguity about which library an edit or export
|
||||
targets, and the existing collection-picker flow is unchanged.
|
||||
- **Alternatives considered**: multiple loaded with one active (faster switching, but
|
||||
dirty-flag/save-bar/unsaved-changes state all become per-library); fully concurrent
|
||||
multi-library (powerful, but multiplies UI and state complexity and invites the
|
||||
merge/sync expectations already ruled out).
|
||||
|
||||
### Capability detection: version first, probe as fallback
|
||||
- **Decision**: Derive capabilities from the library's declared version where one
|
||||
exists (NML version, Rekordbox schema version); where no version is stamped — Serato
|
||||
— infer capabilities from the data actually present.
|
||||
- **Rationale**: Accurate per-library capability reporting without assuming a floor that
|
||||
denies users features their software actually has.
|
||||
- **Alternatives considered**: probe-only (uniform and empirical, but an empty or simple
|
||||
library under-reports); assume-newest-and-degrade-on-failure (least work, risks
|
||||
writing data older software can't read); static per-platform floor (trivial, but
|
||||
penalises users on current versions).
|
||||
- **Consequence**: each adapter needs its own version-detection story.
|
||||
- **Serato exception**: Serato has no version-stamped library file, so rather than
|
||||
probing the data, Konduktor simply **assumes the latest Serato version** and reports
|
||||
the full capability set. *Rationale*: keeps it simple, and probing under-reports on
|
||||
small or fresh libraries. *Risk accepted*: a user on an older Serato build could be
|
||||
written prep data their install cannot read; mitigated by Serato's aggressive
|
||||
auto-update and the relative stability of the GEOB tag format.
|
||||
|
||||
### Field mapping: normalise, but keep the native value alongside
|
||||
- **Implementation requirement**: this demands **per-field dirty tracking**. The rule
|
||||
"reuse the native value unless the user edited this field" needs to know *which
|
||||
fields* changed, not just which tracks — `PlaylistStore` currently tracks dirtiness at
|
||||
track level. It must exist from the start: retrofitted, it cannot distinguish
|
||||
edited-to-the-same-value from untouched. It pairs well with projection+command, since
|
||||
a command already names the field it changes, so the flag falls out of the command
|
||||
rather than requiring a diff.
|
||||
- **Decision**: Ratings, keys, colours and comments are stored in canonical form in the
|
||||
generic model (rating 0–5, key as canonical pitch-class + mode, colour as RGB), and
|
||||
**each field also retains its untouched native value**. On write-back the native value
|
||||
is reused unless the user actually edited that field, so untouched tracks round-trip
|
||||
exactly and only genuine edits go through conversion.
|
||||
- **Rationale**: Gets a clean, convertible canonical model without introducing
|
||||
round-trip drift on data the user never touched — consistent with the project's
|
||||
fidelity-first posture.
|
||||
- **Alternatives considered**: normalise-in/denormalise-out only (clean model, but
|
||||
round-tripping through a lossy scale shifts values); preserve native and convert only
|
||||
on export (zero round-trip risk, but every UI consumer must interpret
|
||||
platform-specific values).
|
||||
|
||||
### Prep UI: generic model with capability-gated controls
|
||||
- **Decision**: The prep UI (waveform, cues, grid) works purely off the generic model,
|
||||
with capability flags disabling or hiding the individual controls the loaded platform
|
||||
cannot persist (e.g. no memory-cue control on Traktor). No platform branching inside
|
||||
components.
|
||||
- **Rationale**: One UI to maintain, and users are never offered an edit that will
|
||||
silently vanish on save.
|
||||
- **Alternatives considered**: no gating, letting adapters silently collapse on write
|
||||
(simplest, but is precisely the failure mode the capability system exists to prevent);
|
||||
gate-plus-warn with controls left enabled (more discoverable, but risks nagging during
|
||||
normal prep work).
|
||||
|
||||
## Findings
|
||||
|
||||
### VERIFIED: Traktor flexible-grid representation in NML
|
||||
Checked against `All I Need` (Shiba San, Tim Baresko) in
|
||||
`/Users/ben/Documents/Native Instruments/Traktor 4.5.0/collection.nml`. A flexible grid
|
||||
is stored as **multiple `CUE_V2 TYPE="4"` markers, each with its own `<GRID BPM>`
|
||||
child**:
|
||||
|
||||
```
|
||||
TEMPO BPM="124.999908"
|
||||
CUE_V2 TYPE="4" NAME="AutoGrid" START="71.815535" GRID BPM="124.999908"
|
||||
CUE_V2 TYPE="4" NAME="Beat Marker" START="46151.849285" GRID BPM="62.499954"
|
||||
CUE_V2 TYPE="4" NAME="Beat Marker" START="76871.871785" GRID BPM="249.999817"
|
||||
```
|
||||
|
||||
- The first marker is named `AutoGrid`; subsequent ones are `Beat Marker`.
|
||||
- `TEMPO BPM` mirrors the **first** marker's BPM.
|
||||
- The half/double BPMs (62.5 / 250 against a base of 125) are genuine half-time and
|
||||
double-time sections.
|
||||
- A non-flexible track (`Cash Money`) has exactly one `TYPE="4"` marker — so the same
|
||||
structure covers both cases; a constant grid is just a marker list of length one.
|
||||
- Separately, tracks carry a `TYPE="0"` cue named `AutoGrid` in **hotcue slot 0** with
|
||||
`COLOR="#FFFFFF"`, positioned at almost (not exactly) the type-4 anchor's START.
|
||||
- `COLOR` is populated in practice, confirming Traktor does carry per-cue colour.
|
||||
|
||||
### Current `set_grid` is incorrect for flexible beatgrids (present-day bug risk)
|
||||
`PlaylistStore._grid_marker()` ([backend/konduktor/playlist_store.py:395](../../backend/konduktor/playlist_store.py#L395))
|
||||
returns only the **first** `CUE_V2` with a `grid` child. Consequences on a track with
|
||||
a flexible (multi-marker) grid:
|
||||
- `set_grid(bpm=X)` updates `TEMPO` and only the *first* marker's BPM, leaving
|
||||
subsequent markers at their old BPM → internally inconsistent grid written to disk.
|
||||
- `set_grid(anchor_sec=X)` moves only the first marker.
|
||||
- `delete_grid()` removes all grid markers, but **leaves the companion `TYPE="0"`
|
||||
`AutoGrid` hotcue-slot-0 cue behind** as debris, since it only strips cues with a
|
||||
`grid` child.
|
||||
- Concretely on `All I Need`: `set_grid(bpm=130)` would set `TEMPO` and the `AutoGrid`
|
||||
marker to 130 and leave the Beat Markers at 62.5 and 250 — a destroyed grid.
|
||||
- The frontend beatgrid drawing (`cues.ts`) is built around a single BPM + anchor, so
|
||||
a flexible grid would also render incorrectly.
|
||||
|
||||
CLAUDE.md describes the grid as "the grid marker (`CUE_V2` type 4 with a `<GRID BPM>`
|
||||
child)" — singular — so this assumption is baked into the docs as well as the code.
|
||||
|
||||
**Implication for step 1**: this is not a small bug fix. `set_grid(bpm, anchor_sec)`
|
||||
structurally cannot express per-marker edits, so the fix requires a new marker-level
|
||||
command vocabulary and marker selection in the `GridControls` UI.
|
||||
|
||||
## Next Steps
|
||||
1. **Design the grid marker command vocabulary** (plan mode, with
|
||||
`backend/konduktor/playlist_store.py` and `frontend/src/components/GridControls.tsx`
|
||||
open). `set_grid(bpm, anchor_sec)` must be replaced by marker-level commands, and
|
||||
`GridControls` needs marker selection.
|
||||
2. **Fix flexible-beatgrid handling** as a standalone change, including the
|
||||
`delete_grid` debris bug (the companion `TYPE="0"` `AutoGrid` hotcue-0 cue is left
|
||||
behind). Add a test fixture based on `All I Need` (three grid markers at 125 / 62.5 /
|
||||
250 BPM). Update CLAUDE.md, which documents the grid as singular.
|
||||
3. **Refactor to generic model + adapter interface, Traktor-only.** All existing tests
|
||||
must still pass unchanged — `test_save_fidelity.py` is the proof that the
|
||||
projection+command split changed nothing.
|
||||
4. **Add the Rekordbox adapter.** Research `rb_local_usn` / cloud-sync columns first.
|
||||
Write the Rekordbox verification test (row-level table-dump diff).
|
||||
5. **Add the Serato adapter.** GEOB-frame sidecar backups; write the Serato verification
|
||||
test (byte diff excluding the patched frame, plus whole-file crate diff).
|
||||
6. **Build the export path.** Only meaningful once two platforms exist.
|
||||
|
||||
### Command vocabulary: strictly generic, no adapter escape hatches
|
||||
- **Decision**: Every command is defined in generic-model terms and each adapter
|
||||
translates it. Adapters may not expose platform-specific commands.
|
||||
- **Rationale**: Keeps the UI fully platform-agnostic and forces genuine abstraction
|
||||
rather than letting platform specifics leak upward.
|
||||
- **Alternatives considered**: a generic core plus adapter escape hatches (pragmatic,
|
||||
but the hatch gets used and generic coverage quietly erodes); starting generic and
|
||||
adding hatches only on demonstrated need.
|
||||
- **Two-platform promotion rule** (resolves the single-platform-feature problem):
|
||||
- A feature that exists on only **one** platform is **preserved but not editable** —
|
||||
no command, no generic concept, no editing UI. Under projection+command it survives
|
||||
round-trip intact for free, because unmodelled native data never leaves the native
|
||||
model. The strictly-generic vocabulary therefore constrains what Konduktor can
|
||||
**edit**, not what it **preserves**.
|
||||
- A concept is **promoted into the core vocabulary once at least two platforms have
|
||||
it**, at which point there is real evidence of what the shared abstraction should
|
||||
be, rather than a concept invented to accommodate a single format.
|
||||
- *Rationale*: avoids both failure modes — inventing a fake abstraction to house a
|
||||
one-platform feature (e.g. a "performance sequence" concept only Serato ever uses),
|
||||
and opening an escape hatch that quietly erodes generic coverage.
|
||||
- *UI affordance*: show preserved-but-uneditable data as read-only, so users can see
|
||||
that e.g. their Serato Flip data is intact rather than assuming Konduktor discarded
|
||||
it. Makes the limitation honest instead of invisible.
|
||||
- *Consequence accepted*: conversion coverage is capped at what two or more platforms
|
||||
share — which matches the stated parity goal rather than compromising it.
|
||||
|
||||
### Save model: projection + command replay
|
||||
- **Decision**: The generic model is a **read projection**. Edits are expressed as
|
||||
commands and replayed by a per-platform adapter onto the **retained native model**,
|
||||
which remains the write target. Export is a separate, lossy path reading from the
|
||||
projection.
|
||||
- **Rationale**: It is the only model that matches how all three storage formats
|
||||
actually behave — Rekordbox `master.db` requires row `UPDATE`s (cannot be
|
||||
regenerated: internal IDs, FKs, ANLZ pointers, `rb_local_usn` sync columns), Serato
|
||||
requires patching individual GEOB frames inside audio files, and Traktor already
|
||||
deliberately avoids regeneration. It also preserves the byte-exact NML guarantee and
|
||||
`test_save_fidelity.py`, makes unknown native fields survive **for free** (they are
|
||||
never lifted out of the native model), and keeps edit *intent* explicit. Critically,
|
||||
Konduktor already implements this shape for Traktor: `CollectionService` is the read
|
||||
projection, `PlaylistStore` holds the native model with command methods, the HTTP API
|
||||
is already a command bus, and `replace_track()` is the projection refresh. This is a
|
||||
generalization, not a rewrite.
|
||||
- **Alternatives considered**: *Generic model as source of truth* — rejected: would
|
||||
lose unmodelled fields on real irreplaceable data, discards the byte-exact guarantee,
|
||||
cannot work for `master.db`, and its headline benefit (free conversion) is illusory
|
||||
since per-target serializers are needed either way; its only real prize is simpler UI
|
||||
mutation code. *Source of truth + diff-based writeback* — rejected: diffing destroys
|
||||
edit intent exactly where platforms disagree (grid phase-shift vs. retempo is
|
||||
indistinguishable in a marker-position diff), ordered-list diffs are fiddly, and it
|
||||
needs a full deep snapshot at load.
|
||||
- **Cost accepted**: an N×M adapter matrix (~15 commands × 3 platforms), plus careful
|
||||
choice of command altitude.
|
||||
|
||||
### Model shape: rich core + capability system
|
||||
- **Decision**: Model the union of *concepts* at full fidelity in the generic model —
|
||||
beatgrid is always a marker list, a cue always carries position/type/colour/role/slot
|
||||
— and build a per-platform **capability system** so the UI never offers an edit the
|
||||
loaded platform cannot persist.
|
||||
- **Rationale**: The conversion goal requires one shared vocabulary; anything parked in
|
||||
a platform-specific extension namespace cannot be converted. Ben confirmed
|
||||
willingness to build the capability UI.
|
||||
- **Alternatives considered**: *Union superset* — rejected, forces every UI consumer to
|
||||
branch on the loaded platform. *Core + per-platform extensions* — rejected, because
|
||||
the data that would land in extensions (Rekordbox memory cues, Serato saved loops) is
|
||||
central rather than exotic, and extensions do not convert.
|
||||
- **Note from Ben**: Traktor 3.4+ supports **flexible beatgrids**, so the marker-list
|
||||
model is right for all three platforms rather than being a Traktor-side compromise.
|
||||
This also means the current single-marker assumption in the codebase is already wrong
|
||||
(see Findings).
|
||||
|
||||
### Undo/redo: deferred but not precluded
|
||||
- **Decision**: Do not implement undo/redo now, but design the command layer so
|
||||
inverse commands can be added later.
|
||||
- **Rationale**: Keeps the adapter surface smaller for the initial build while
|
||||
retaining the option; the command model makes it cheap to add.
|
||||
- **Alternatives considered**: designing for inverses from day one (more discipline in
|
||||
every adapter method); ruling it out entirely (loses a strong safety feature).
|
||||
|
||||
### Format layers: reuse mature libraries
|
||||
- **Decision**: Use existing libraries for the Rekordbox and Serato format layers
|
||||
(e.g. `pyrekordbox` for `master.db`/SQLCipher/XML/ANLZ, an existing Serato
|
||||
crate+GEOB library), wrapped behind Konduktor's adapter interface.
|
||||
- **Rationale**: Fastest path to coverage; the project already accepts this class of
|
||||
dependency risk with `traktor-nml-utils`.
|
||||
- **Alternatives considered**: reuse for reading but own all write paths (more control
|
||||
over surgical patching and fidelity, more work); build everything in-house (maximum
|
||||
control, very large reverse-engineering effort); spike first and decide per platform.
|
||||
|
||||
## Agent Onboarding
|
||||
|
||||
### Summary
|
||||
Konduktor is today a Traktor-only tool whose defining property is **save fidelity**: it
|
||||
never regenerates `collection.nml`, it surgically patches a parsed dataclass model and
|
||||
renders through the library's own pipeline, so a no-op save is byte-identical and only
|
||||
edited objects diff (`test_save_fidelity.py`, CLAUDE.md gotcha 3).
|
||||
|
||||
Ben wants to extend it to Rekordbox and Serato, with library conversion as the ultimate
|
||||
payoff. His opening proposal was a generic data structure that all platforms load into,
|
||||
are edited through, and are saved back out of.
|
||||
|
||||
The central tension explored was that **"load into a generic model and serialize back
|
||||
out" would destroy the fidelity guarantee**. The discussion resolved it by establishing
|
||||
that for two of the three platforms, whole-model serialization is not even a coherent
|
||||
operation: Rekordbox's `master.db` is SQLite with internal IDs, FKs, ANLZ pointers and
|
||||
sync columns (you `UPDATE` rows, you cannot regenerate), and Serato's prep data lives as
|
||||
binary GEOB frames inside the audio files themselves (you patch a frame). Both are
|
||||
inherently mutation-oriented. This made **projection + command replay** the only model
|
||||
that generalizes — and, critically, Konduktor already implements exactly that shape for
|
||||
Traktor (`CollectionService` = read projection, `PlaylistStore` = native model + command
|
||||
methods, the HTTP API = command bus, `replace_track()` = projection refresh). The work is
|
||||
a generalization, not a rewrite.
|
||||
|
||||
A second thread established that the generic model should be **rich** (model the union
|
||||
of concepts at full fidelity, adapters collapse on write) rather than
|
||||
lowest-common-denominator or core-plus-extensions, because anything parked in a
|
||||
platform-specific namespace cannot be converted. This makes a **capability system**
|
||||
mandatory so the UI never offers an edit that silently won't persist.
|
||||
|
||||
A third thread covered **exports**: always a fresh, self-contained target library with
|
||||
copied audio, scoped by a user-curated **Export Set**. Because exports never merge into
|
||||
an existing target, cross-platform track identity is not needed at all — the existing
|
||||
path-based primary key suffices.
|
||||
|
||||
Along the way the discussion surfaced a **present-day bug**: Ben noted Traktor 3.4+
|
||||
supports flexible beatgrids, and verification against his real collection confirmed
|
||||
Traktor stores them as multiple `CUE_V2 TYPE="4"` markers each with its own `<GRID BPM>`.
|
||||
`PlaylistStore._grid_marker()` only ever reads the first, so `set_grid(bpm=X)` writes
|
||||
internally inconsistent grids to real collections today. This became step 1 of the plan,
|
||||
and it is bigger than a bug fix because the `set_grid(bpm, anchor_sec)` signature
|
||||
structurally cannot express per-marker edits.
|
||||
|
||||
Note: a "CDJ/USB export" requirement appeared in this log mid-discussion from a forked
|
||||
conversation. Ben confirmed it was rejected as impractical and had it removed. **Do not
|
||||
re-propose it.**
|
||||
|
||||
### If Continuing This Discussion
|
||||
All design questions are resolved. Three items remain, none of them decisions:
|
||||
- Grid marker command vocabulary — a design task for plan mode, not an open question.
|
||||
- Per-platform verification tests — implementation work landing with each adapter.
|
||||
- Rekordbox `rb_local_usn` / cloud-sync columns — research for the Rekordbox phase.
|
||||
|
||||
Deliberately deferred, do not reopen without Ben raising them: the export loss report
|
||||
("not for now"), bulk metadata editing, Tauri packaging, and CDJ/USB export (rejected).
|
||||
|
||||
### If Moving to Planning/Implementation
|
||||
|
||||
**Requirements**
|
||||
|
||||
1. **Save model — projection + command replay.** The generic model is a *read
|
||||
projection*. Edits are commands replayed by a per-platform adapter onto the
|
||||
**retained native model**, which stays the write target. Never serialize the generic
|
||||
model back over a native library. This preserves byte-exact NML saves and means
|
||||
unmodelled native fields survive for free.
|
||||
2. **Command vocabulary — strictly generic.** All commands are defined in generic-model
|
||||
terms; adapters translate. **No platform-specific escape hatches.** Single-platform
|
||||
features are *preserved but not editable*; a concept is promoted into the core
|
||||
vocabulary only once **two or more platforms have it**. Surface preserved-but-
|
||||
uneditable data as read-only in the UI.
|
||||
3. **Generic model — rich core.** Model the union of concepts at full fidelity.
|
||||
Beatgrid is **always a marker list** (a constant grid is a list of length one — this
|
||||
is correct for all three platforms, not a compromise). Cue shape:
|
||||
`{ position_sec, length_sec?, role: hotcue|memory, slot?, type: cue|fade_in|fade_out|
|
||||
load|loop, color?, name? }`.
|
||||
4. **Capability system — mandatory.** Capabilities are `f(platform, version)`, derived
|
||||
from the declared version where one exists; **Serato assumes the latest version** for
|
||||
simplicity. The prep UI works purely off the generic model with capability-gated
|
||||
controls — no platform branching inside components.
|
||||
5. **Field mapping — normalise, keep native alongside.** Canonical forms in the model
|
||||
(rating 0–5, canonical key, RGB colour) *plus* the untouched native value. On
|
||||
write-back, reuse the native value unless the user actually edited that field.
|
||||
**This requires per-field dirty tracking** — `PlaylistStore` is track-level today, and
|
||||
it must exist from the start because it cannot be retrofitted (edited-to-same-value
|
||||
becomes indistinguishable from untouched). It falls out of the command, which already
|
||||
names the field it changes.
|
||||
6. **Write scope — full read/write for all three platforms**, in place, to the user's
|
||||
canonical library. One library open at a time (`AppState` keeps holding exactly one).
|
||||
7. **Safety — same invariant, per-platform mechanism.** "An edit changes only what it
|
||||
was supposed to change." Traktor: byte diff (exists). Rekordbox: full table dump,
|
||||
row-level diff; back up `master.db` + WAL/SHM; **warn but proceed** if Rekordbox is
|
||||
running. Serato: byte diff of the audio file excluding the patched GEOB frame, plus
|
||||
whole-file crate diff; **back up GEOB frames to a sidecar, not whole audio files**
|
||||
(KB not GB; accepted risk: no protection if the tag library mangles an unrelated
|
||||
region — an exposure `file_tags.py` already carries).
|
||||
8. **Export — always a fresh, self-contained library** at a user-chosen destination,
|
||||
**including copied audio, for every target** (not just Serato). Never merges into an
|
||||
existing target library, so no cross-platform track identity is required.
|
||||
- Scoped by an **Export Set**: a named, persisted list of track and playlist
|
||||
references. **Live references** — resolved at export time, so the preview must be
|
||||
computed then, never stored. Playlist tracks auto-included, deduplicated, copied
|
||||
once.
|
||||
- Stored in Konduktor's own store (not `userprefs.json`), keyed by a stable library
|
||||
ID held in a **sidecar file next to the user's collection**.
|
||||
- Audio layout: a **global persistent setting** — flat single folder (**default**) or
|
||||
mirror source structure. Flat collisions get a **counter suffix** (`Xtal-2.mp3`).
|
||||
- Playlist folders preserved where the target supports them, otherwise flattened to
|
||||
**path-encoding names** (`House / Peak Time`).
|
||||
- **Pre-scan for missing audio files**, report, let the user decide. **Pre-check disk
|
||||
space**; progress with a working cancel (cancel leaves a partial export — clean up
|
||||
or mark clearly).
|
||||
- Re-export to an occupied destination: **warn, overwrite on confirm**.
|
||||
- Provide an explicit **"export entire library"** action that skips export-set creation.
|
||||
9. **Lossiness — degrade where sensible, drop otherwise.** Goal is maximum feature
|
||||
parity. No loss report for now (deferred, cheap to add later since adapters know what
|
||||
they collapsed).
|
||||
10. **Format layers — reuse mature libraries** (`pyrekordbox` for master.db/SQLCipher/
|
||||
XML/ANLZ; an existing Serato crate+GEOB library) behind Konduktor's adapter
|
||||
interface, consistent with the existing `traktor-nml-utils` dependency posture.
|
||||
11. **Undo/redo — not now, but do not preclude it.** Design commands so inverses can be
|
||||
added later.
|
||||
|
||||
**Sequencing** (see Next Steps for the actionable breakdown)
|
||||
Grid fix → Traktor-only refactor → Rekordbox → Serato → export. Rekordbox was chosen as
|
||||
the second platform over Serato because `pyrekordbox` is the more mature library, despite
|
||||
the riskier write target.
|
||||
|
||||
**Out of scope**: Tauri packaging, bulk metadata editing, CDJ/USB export
|
||||
(`export.pdb` + ANLZ — rejected as impractical), two-way sync, Konduktor owning its own
|
||||
canonical library format.
|
||||
|
||||
**Rejected alternatives worth not relitigating**
|
||||
- Generic model as source of truth, and source-of-truth + diff-based writeback — both
|
||||
rejected; see the save model decision. The claimed "free conversion" benefit is
|
||||
illusory (per-target serializers are needed either way), and diffing destroys edit
|
||||
intent exactly where platforms disagree.
|
||||
- Union superset and core-plus-extensions model shapes.
|
||||
- Cross-platform track matching by path/tags/content-hash/fingerprint — unnecessary
|
||||
given fresh-export-only.
|
||||
- Full audio-file backups for Serato writes.
|
||||
- Reference-in-place exports for non-Serato targets.
|
||||
|
||||
**Standing lesson from this discussion**: establish format capabilities **empirically**
|
||||
against real files rather than assuming them. An assumption that Traktor could not store
|
||||
cue colours was wrong (`CueV2Type` has a `color` field, populated in practice), and the
|
||||
flexible-grid assumption was only settled by reading Ben's actual collection.
|
||||
@@ -0,0 +1,221 @@
|
||||
# Handoff: the export feature
|
||||
|
||||
**For**: an agent picking up Konduktor with no prior context.
|
||||
**Task**: build library export — converting a curated slice of the loaded library
|
||||
into a **fresh, self-contained library for another platform**, with the audio
|
||||
files copied alongside.
|
||||
**Status of the plan**: the multi-platform work is done through the Rekordbox
|
||||
adapter. Export was originally sequenced *after* a Serato adapter; Ben has
|
||||
chosen to bring it forward, so **the only export targets that can exist today are
|
||||
Traktor and Rekordbox**.
|
||||
|
||||
Every *design* decision was settled in
|
||||
[`.claude/discussions/discuss-multi-platform-library-2026-09-17.md`](../discussions/discuss-multi-platform-library-2026-09-17.md)
|
||||
— read its **Export** sections and **"If Moving to Planning/Implementation"**
|
||||
before designing anything. This handoff is the current-state companion: what
|
||||
exists, what to build, and what will bite you. Where they disagree, the
|
||||
discussion doc wins on intent and this one on facts about the code.
|
||||
|
||||
The Rekordbox handoff ([`rekordbox-adapter.md`](rekordbox-adapter.md)) is worth
|
||||
skimming too — its §8 Findings are the format knowledge any Rekordbox *writer*
|
||||
will need, and its history is a good model of how this project verifies things.
|
||||
|
||||
---
|
||||
|
||||
## 1. Where the project is
|
||||
|
||||
Konduktor is a library-management and track-prep tool for DJ software, built on a
|
||||
**generic model + per-platform adapter** architecture. Two adapters exist:
|
||||
|
||||
- **Traktor** (`collection.nml`) — full read/write, byte-exact saves, version
|
||||
history.
|
||||
- **Rekordbox** (`master.db` + ANLZ analysis files) — read/write for metadata,
|
||||
playlists, hot cues and beatgrids. No version history (a deliberate, accepted
|
||||
scope decision). Gaps: cover art, `remap_locations`.
|
||||
|
||||
```
|
||||
backend/konduktor/
|
||||
core/ generic. MUST NOT import a native library type (test_layering.py)
|
||||
model.py Track, CuePoint, GridMarker, TrackCues, PlaylistNode…
|
||||
adapter.py LibraryAdapter / LibraryDriver protocols, SaveOutcome, errors
|
||||
capabilities.py what a loaded library can persist
|
||||
query.py TrackIndex: query/filter/sort/facets/stats
|
||||
registry.py adapter selection by can_open() probe
|
||||
adapters/traktor/ store.py (native model) adapter.py projection.py driver.py …
|
||||
adapters/rekordbox/ same shape; store.py owns the SQLCipher session + ANLZ
|
||||
app_state.py the one loaded library + version-history commits
|
||||
prefs.py userprefs.json in the per-OS app-data dir (paths.app_data_dir())
|
||||
main.py thin FastAPI routes, all under /api
|
||||
```
|
||||
|
||||
**Tests**: `cd backend && ./run_tests.sh` → 331 assertions across
|
||||
`test_layering.py`, `test_save_fidelity.py`, `test_traktor_adapter.py`,
|
||||
`test_rekordbox_adapter.py`, `test_rekordbox_fidelity.py`, `test_phase3.py`,
|
||||
`test_history.py`. Frontend: `npm run build && npm run test`.
|
||||
**The suite must be green at the end of every step** — that discipline is why a
|
||||
1,500-line refactor of the save path landed without a fidelity regression.
|
||||
|
||||
---
|
||||
|
||||
## 2. The one architectural gap, and it is not small
|
||||
|
||||
**No adapter can create a library from nothing.**
|
||||
|
||||
`LibraryDriver` is `can_open` / `open` / `detect` / `describe` / `restore`.
|
||||
`LibraryAdapter` is built entirely around *one already-open library* that commands
|
||||
are replayed onto. Export needs the opposite: **write a brand-new library at a
|
||||
path where nothing exists yet.**
|
||||
|
||||
This is the central design question of the whole feature, and the discussion doc
|
||||
does not settle it. Decide it deliberately and write down why. The obvious
|
||||
shapes:
|
||||
|
||||
1. **A separate `LibraryWriter` protocol** — `create(path)` returning something
|
||||
that accepts tracks, playlists and prep data, implemented per target. Keeps
|
||||
the edit path untouched, which matters because the edit path is the one with
|
||||
the fidelity guarantees. Some duplication with the adapters' write code.
|
||||
2. **Extend `LibraryDriver` with `create(path) -> LibraryAdapter`** — an empty
|
||||
library is then just a library, and the existing commands populate it. Elegant
|
||||
on paper; the risk is that "empty new file" and "the user's real library"
|
||||
start sharing code paths, and the *reason* the current architecture is safe is
|
||||
that the write target is always a retained native model that was parsed from a
|
||||
real file.
|
||||
3. **Target-specific exporters with no shared protocol** — fastest to a working
|
||||
Traktor export, and it will rot.
|
||||
|
||||
The discussion doc's strongest constraint bears on this: *"Two distinct write
|
||||
paths must coexist: a high-fidelity in-place edit path per platform, and a
|
||||
lossy-by-design export path. They have opposite requirements and should not
|
||||
share an implementation."* Read that as pointing at (1), but make the call
|
||||
yourself with the code in front of you.
|
||||
|
||||
---
|
||||
|
||||
## 3. What the design already settles
|
||||
|
||||
Do not relitigate these. They are decided, with rationale and rejected
|
||||
alternatives recorded in the discussion doc.
|
||||
|
||||
**Shape of an export**
|
||||
- Always a **fresh, self-contained library** at a user-chosen destination.
|
||||
**Never merges** into an existing target library. This is what removes any need
|
||||
for cross-platform track identity — there is nothing to match against.
|
||||
- **Always copies the audio files**, for every target, not just Serato.
|
||||
- Audio layout is a **global, persisted setting**: **flat single folder
|
||||
(default)** or **mirror the source directory structure**.
|
||||
- Flat-layout filename collisions get a **counter suffix** (`Xtal-2.mp3`).
|
||||
Known consequence: numbering depends on processing order, so repeat exports may
|
||||
assign different suffixes to the same tracks.
|
||||
- Playlist folders: **preserve where the target supports them**, otherwise
|
||||
flatten to path-encoding names (`House / Peak Time`).
|
||||
- Re-export to an occupied destination: **warn, overwrite on confirm.**
|
||||
- Provide an explicit **"export entire library"** action that skips export-set
|
||||
creation entirely.
|
||||
|
||||
**Export Sets** (the unit of curation)
|
||||
- A named, persisted list of **track and playlist references** scoping an export.
|
||||
Called an **Export Set**, never a "Crate" — Serato uses "crate" for a playlist
|
||||
and Konduktor will import those.
|
||||
- **References are LIVE**: an export set stores pointers, and export resolves
|
||||
them at export time, so later additions to a playlist are picked up.
|
||||
**Consequence: the export preview must be computed at export time, never
|
||||
stored.**
|
||||
- Playlist resolution **auto-includes** referenced tracks, **deduplicates**, and
|
||||
copies each file **exactly once**.
|
||||
- Stored in **Konduktor's own store**, not in the platform library and not in
|
||||
`userprefs.json`, keyed by a **stable library ID**.
|
||||
|
||||
**Running an export**
|
||||
- **Pre-scan for missing audio files**, report them, let the user cancel or
|
||||
proceed without them — fail fast rather than halfway through a multi-hour copy.
|
||||
- **Pre-check disk space** before starting.
|
||||
- **Progress with a working cancel.** Known consequence: cancelling leaves a
|
||||
partial export, which must be cleaned up or clearly marked incomplete.
|
||||
|
||||
**Lossiness**
|
||||
- **Degrade to the nearest equivalent where one exists, drop only where none
|
||||
does.** A Traktor fade-in cue becomes a plain cue on a target without them;
|
||||
Rekordbox memory cues fill spare hot cue slots until they run out.
|
||||
- **No loss report for now** — explicitly deferred. Adapters know what they
|
||||
collapsed, so it stays cheap to add.
|
||||
|
||||
---
|
||||
|
||||
## 4. Landmines, earned
|
||||
|
||||
**There is no stable library ID.** Export sets are specified as keyed by one,
|
||||
held in a sidecar next to the user's collection — and nothing like it exists.
|
||||
Today everything keys off the library's **OS path**: `prefs.get_path_mapping`,
|
||||
`prefs.get_last_collection`, and `history`'s repo directory (a hash of the
|
||||
resolved path). Moving a collection silently orphans all of it. Building export
|
||||
sets on the path would inherit that; building the sidecar is the decided design
|
||||
but is genuinely new work. Do it first — retrofitting an ID once sets exist means
|
||||
migrating them.
|
||||
|
||||
**The lossiness rule needs capabilities the target does not have loaded.**
|
||||
`Capabilities` describes *the currently open library*, via an adapter instance
|
||||
built from a real file. Export needs to know what a target platform can hold
|
||||
*before* any such library exists. Either capabilities must become derivable from
|
||||
a platform alone (not an instance), or exporters must carry their own static
|
||||
declaration. This is exactly where a "what can the target represent?" question
|
||||
will first bite, and `capabilities_for()` in each adapter currently takes a
|
||||
`path`.
|
||||
|
||||
**The two-platform promotion rule still applies.** A concept enters the generic
|
||||
vocabulary only once **two or more** platforms have it. Export will tempt you to
|
||||
add target-specific knobs to generic types; don't. Single-platform concepts stay
|
||||
*preserved but not editable* — for instance Rekordbox **memory cues** are
|
||||
projected and displayed and never written.
|
||||
|
||||
**Rekordbox as an export TARGET is much harder than Traktor.** A Traktor export
|
||||
is one XML file Konduktor already renders byte-exactly. A Rekordbox export needs
|
||||
a `master.db` — SQLCipher, foreign keys into lookup tables, USN bookkeeping — plus
|
||||
per-track ANLZ analysis files containing the beatgrid, plus `masterPlaylists6.xml`.
|
||||
Worse, `.DAT`/`.EXT` analysis files can currently only be *modified*, never
|
||||
created: `beatgrid.write_pqtz()` rebuilds the `PQTZ` tag **inside an existing
|
||||
file**. Generating ANLZ from scratch is unexplored, and `PQT2` (the extended
|
||||
grid) is undecoded — `pyrekordbox` names its per-beat field `unkown`.
|
||||
**Strongly consider shipping Traktor as the only export target first.**
|
||||
|
||||
**CDJ/USB export (`export.pdb` + ANLZ) is rejected as impractical.** It has been
|
||||
re-proposed twice. Do not raise it again.
|
||||
|
||||
---
|
||||
|
||||
## 5. Working agreements
|
||||
|
||||
- **`./run_tests.sh` green at the end of every step.**
|
||||
- **`schemas.py` and `api.ts` land in the same commit** — one contract in two
|
||||
languages.
|
||||
- **Verify against reality, do not infer.** The project's standing lesson, and it
|
||||
has been proved right four times: Traktor cue colours, flexible grid marker
|
||||
naming, whether Rekordbox reads `PQTZ` or `PQT2`, and the hot cue slot
|
||||
encoding. That last one cost two rounds of wrong theory built on three
|
||||
incidental data points; one deliberate probe across the full range settled it.
|
||||
For export the equivalent is: **write an export, then open it in the real DJ
|
||||
software** before believing it works.
|
||||
- **Ben's Rekordbox library is a disposable test library** — write to it directly,
|
||||
no backups needed. **His Traktor collection is real, irreplaceable data**
|
||||
(8,485 entries): always work against copies. `./dev-sandbox.sh` already
|
||||
encodes exactly this split and refuses to start if another server holds the
|
||||
ports.
|
||||
- **Capability-gate every control.** The UI must never offer an edit — or an
|
||||
export target — that cannot actually be produced. This has failed twice and
|
||||
both times it was a stale flag, not missing machinery.
|
||||
|
||||
## 6. Suggested first steps
|
||||
|
||||
1. **Decide the writer architecture** (§2) and record the decision and its
|
||||
rejected alternatives, in the style of the discussion doc.
|
||||
2. **Build the stable library ID sidecar** (§4) — everything else keys off it.
|
||||
3. **Export Sets: model, store, API, UI.** Live references; preview computed at
|
||||
export time.
|
||||
4. **A Traktor exporter end to end**, with the audio copy, the pre-scan, the
|
||||
space check and cancellable progress.
|
||||
5. **Open the result in Traktor.** Not "the tests pass" — actually open it.
|
||||
6. Only then consider a Rekordbox exporter, knowing §4's warning.
|
||||
|
||||
Bulk metadata editing also remains unbuilt and unblocked; it is far smaller than
|
||||
this and was deferred specifically until the adapter architecture existed. If a
|
||||
shippable win is wanted sooner, that is the alternative — confirm with Ben rather
|
||||
than assuming.
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,97 @@
|
||||
"""Lay out one release's assets under user-facing names, plus the updater's
|
||||
latest.json and the release notes' Download section.
|
||||
|
||||
Run by build.yml's release job:
|
||||
|
||||
python3 .github/scripts/release_assets.py artifacts release \\
|
||||
--version 0.6.0 --tag v0.6.0-b42 --repo owner/konduktor
|
||||
|
||||
Finds, anywhere under `artifacts`, what `tauri build` produced: the macOS
|
||||
`*.dmg` and `*.app.tar.gz` (+ `.sig`) and the Windows `*-setup.exe` (+ `.sig`).
|
||||
Copies them into `release` as
|
||||
|
||||
Konduktor-<version>-macOS.dmg (download)
|
||||
Konduktor-<version>-Windows-Setup.exe (download; the Windows updater runs it too)
|
||||
Konduktor-<version>-app-updater.tar.gz (the macOS updater's package)
|
||||
latest.json (the updater's manifest)
|
||||
|
||||
and writes `download.md`. Renaming is safe: the signatures cover contents,
|
||||
not names, and latest.json is written from the final names. `latest.json`
|
||||
itself keeps its name: the app asks for releases/download/<tag>/latest.json.
|
||||
Fails if anything is missing: a manifest lacking a platform is refused by the
|
||||
updater as a whole.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import shutil
|
||||
import sys
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from urllib.parse import quote
|
||||
|
||||
|
||||
def find_one(root: Path, suffix: str) -> Path:
|
||||
found = [p for p in root.rglob(f"*{suffix}") if p.is_file()]
|
||||
if len(found) != 1:
|
||||
sys.exit(f"expected exactly one *{suffix} under {root}, found {len(found)}")
|
||||
return found[0]
|
||||
|
||||
|
||||
def signature(asset: Path) -> str:
|
||||
sig = asset.with_name(asset.name + ".sig")
|
||||
if not sig.is_file():
|
||||
sys.exit(f"missing signature {sig}")
|
||||
return sig.read_text(encoding="utf-8").strip()
|
||||
|
||||
|
||||
def lay_out(artifacts: Path, out: Path, version: str, tag: str, repo: str) -> None:
|
||||
def url(name: str) -> str:
|
||||
return f"https://github.com/{repo}/releases/download/{quote(tag)}/{quote(name)}"
|
||||
|
||||
dmg = find_one(artifacts, ".dmg")
|
||||
app = find_one(artifacts, ".app.tar.gz")
|
||||
setup = find_one(artifacts, "-setup.exe")
|
||||
|
||||
names = {
|
||||
dmg: f"Konduktor-{version}-macOS.dmg",
|
||||
setup: f"Konduktor-{version}-Windows-Setup.exe",
|
||||
app: f"Konduktor-{version}-app-updater.tar.gz",
|
||||
}
|
||||
# Tauri's platform keys -> the file that platform's updater installs.
|
||||
manifest = {
|
||||
"version": version,
|
||||
"pub_date": datetime.now(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z"),
|
||||
"platforms": {
|
||||
"darwin-aarch64": {"signature": signature(app), "url": url(names[app])},
|
||||
"windows-x86_64": {"signature": signature(setup), "url": url(names[setup])},
|
||||
},
|
||||
}
|
||||
|
||||
out.mkdir(parents=True, exist_ok=True)
|
||||
for src, name in names.items():
|
||||
shutil.copy2(src, out / name)
|
||||
(out / "latest.json").write_text(json.dumps(manifest, indent=2) + "\n", encoding="utf-8")
|
||||
(out / "download.md").write_text(
|
||||
"## Download\n"
|
||||
f"- **macOS** (Apple Silicon): [{names[dmg]}]({url(names[dmg])})\n"
|
||||
f"- **Windows**: [{names[setup]}]({url(names[setup])})\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
||||
ap.add_argument("artifacts", type=Path)
|
||||
ap.add_argument("out", type=Path)
|
||||
ap.add_argument("--version", required=True)
|
||||
ap.add_argument("--tag", required=True)
|
||||
ap.add_argument("--repo", required=True)
|
||||
args = ap.parse_args()
|
||||
lay_out(args.artifacts, args.out, args.version, args.tag, args.repo)
|
||||
for p in sorted(args.out.iterdir()):
|
||||
print(p.name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+125
-6
@@ -55,10 +55,11 @@ jobs:
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
# --- Step 1: freeze the FastAPI backend into a single-file sidecar ---
|
||||
# --- Step 1: freeze the FastAPI backend into a onedir sidecar folder ---
|
||||
# build_sidecar.* stages it as
|
||||
# frontend/src-tauri/binaries/konduktor-sidecar-<triple>[.exe]
|
||||
# which tauri.conf.json's externalBin bundles into the app.
|
||||
# frontend/src-tauri/binaries/konduktor-sidecar/
|
||||
# which tauri.macos.conf.json (bundle.macOS.files, keeps its symlinks) /
|
||||
# tauri.windows.conf.json (bundle.resources) put in the app as `sidecar/`.
|
||||
- name: Install backend deps
|
||||
working-directory: backend
|
||||
run: |
|
||||
@@ -85,20 +86,31 @@ jobs:
|
||||
working-directory: frontend
|
||||
run: npm ci
|
||||
|
||||
# createUpdaterArtifacts also signs the in-app update packages
|
||||
# (Konduktor.app.tar.gz / the NSIS setup.exe) with the updater key, whose
|
||||
# public half is plugins.updater.pubkey in tauri.conf.json. Losing the
|
||||
# private key means installed copies can never update themselves again.
|
||||
- name: Build Tauri app
|
||||
working-directory: frontend
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
run: npx tauri build
|
||||
|
||||
# Stage the single installer per OS into a flat folder. Uploading one
|
||||
# directory (not multiple bundle subpaths) keeps the artifact root at
|
||||
# ./installer, so the zip holds the bare file — no nested dmg/ or nsis/
|
||||
# folder. We ship the DMG on macOS and the NSIS -setup.exe on Windows
|
||||
# (the .msi is intentionally left out).
|
||||
# (the .msi is intentionally left out), plus what the in-app updater
|
||||
# installs: the .app.tar.gz on macOS (the setup.exe on Windows) and the
|
||||
# .sig files the release job folds into latest.json.
|
||||
- name: Stage installer (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
mkdir -p installer
|
||||
cp frontend/src-tauri/target/release/bundle/dmg/*.dmg installer/
|
||||
cp frontend/src-tauri/target/release/bundle/macos/*.app.tar.gz installer/
|
||||
cp frontend/src-tauri/target/release/bundle/macos/*.app.tar.gz.sig installer/
|
||||
|
||||
- name: Stage installer (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
@@ -106,6 +118,7 @@ jobs:
|
||||
run: |
|
||||
New-Item -ItemType Directory -Force installer | Out-Null
|
||||
Copy-Item frontend/src-tauri/target/release/bundle/nsis/*-setup.exe installer/
|
||||
Copy-Item frontend/src-tauri/target/release/bundle/nsis/*-setup.exe.sig installer/
|
||||
|
||||
- name: Upload installer
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -114,6 +127,52 @@ jobs:
|
||||
if-no-files-found: error
|
||||
path: installer/*
|
||||
|
||||
# The Konduktor SERVER image (server/Dockerfile): a remote library's half,
|
||||
# pushed to GHCR with the same version as the desktop app, so a TrueNAS app
|
||||
# can name the tag that matches the app it is opened from.
|
||||
server-image:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write # push to ghcr.io
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Resolve version and image name
|
||||
id: meta
|
||||
run: |
|
||||
echo "version=$(jq -r .version frontend/package.json)" >> "$GITHUB_OUTPUT"
|
||||
# GHCR names must be lower-case; the owner may not be.
|
||||
echo "image=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/konduktor-server" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
env:
|
||||
DOCKER_BUILD_RECORD_UPLOAD: false # no .dockerbuild artifact in the run
|
||||
with:
|
||||
context: .
|
||||
file: server/Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: |
|
||||
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}-b${{ github.run_number }}
|
||||
${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}
|
||||
${{ steps.meta.outputs.image }}:latest
|
||||
labels: |
|
||||
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
||||
org.opencontainers.image.version=${{ steps.meta.outputs.version }}
|
||||
|
||||
# Gather both platforms' installers and publish them as a single new Release.
|
||||
# Runs once, after both builds succeed, so the two matrix jobs never race to
|
||||
# create the same tag/release.
|
||||
@@ -122,6 +181,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write # required to create the tag + release
|
||||
pull-requests: read # to read the merged PR's patch notes
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -136,14 +196,73 @@ jobs:
|
||||
- name: Download installers from both builds
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
# Only the installers: the run also holds server-image's Docker build
|
||||
# record, which is not a release asset (and once failed to download).
|
||||
pattern: konduktor-*
|
||||
path: artifacts # → artifacts/konduktor-macOS/…, artifacts/konduktor-Windows/…
|
||||
|
||||
# The release's files under user-facing names, the in-app updater's
|
||||
# latest.json (the app reads releases/download/<tag>/latest.json) and the
|
||||
# notes' Download section. The .sig files are folded into latest.json and
|
||||
# not uploaded themselves.
|
||||
- name: Release assets
|
||||
run: |
|
||||
python3 .github/scripts/release_assets.py artifacts release \
|
||||
--version "${{ steps.version.outputs.version }}" \
|
||||
--tag "v${{ steps.version.outputs.version }}-b${{ github.run_number }}" \
|
||||
--repo "${{ github.repository }}"
|
||||
|
||||
# Release notes from the "Patch notes" section of the PR that merged this
|
||||
# commit into main (dev → main merges carry many features in one PR, so
|
||||
# its title alone says little). Written under "What's Changed", the
|
||||
# heading the app's update dialog reads. No PR (a manual run, a direct
|
||||
# push) or no such section → GitHub's generated notes, as before. The
|
||||
# Download section always comes first (the action puts the body above
|
||||
# generated notes); the dialog reads only "What's Changed".
|
||||
- name: Patch notes from the merged PR
|
||||
id: notes
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
gh api "repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \
|
||||
--jq '[.[] | select(.base.ref == "main" and .merged_at != null)][0].body // ""' \
|
||||
> pr-body.md || : > pr-body.md
|
||||
python3 - <<'EOF'
|
||||
import os, re
|
||||
body = open("pr-body.md", encoding="utf-8").read().replace("\r\n", "\n")
|
||||
body = re.sub(r"<!--.*?-->", "", body, flags=re.S)
|
||||
section, level = [], None
|
||||
for line in body.split("\n"):
|
||||
m = re.match(r"^(#{1,6})\s+(.*?)\s*#*\s*$", line)
|
||||
if level is None:
|
||||
if m and re.fullmatch(r"patch[\s-]?notes:?", m.group(2), re.I):
|
||||
level = len(m.group(1))
|
||||
elif m and len(m.group(1)) <= level:
|
||||
break
|
||||
else:
|
||||
section.append(line)
|
||||
notes = "\n".join(section).strip()
|
||||
found = bool(notes)
|
||||
with open("release-notes.md", "w", encoding="utf-8") as f:
|
||||
f.write(open("release/download.md", encoding="utf-8").read())
|
||||
if found:
|
||||
f.write("\n## What's Changed\n\n" + notes + "\n")
|
||||
with open(os.environ["GITHUB_OUTPUT"], "a") as out:
|
||||
out.write(f"found={'true' if found else 'false'}\n")
|
||||
print("Using the PR's patch notes." if found else "No patch notes section; using generated notes.")
|
||||
EOF
|
||||
|
||||
- name: Publish release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.version.outputs.version }}-b${{ github.run_number }}
|
||||
name: Konduktor v${{ steps.version.outputs.version }}-b${{ github.run_number }}
|
||||
target_commitish: ${{ github.sha }}
|
||||
generate_release_notes: true # auto changelog from commits/PRs since last release
|
||||
body_path: release-notes.md
|
||||
generate_release_notes: ${{ steps.notes.outputs.found != 'true' }}
|
||||
fail_on_unmatched_files: true
|
||||
files: artifacts/**/*
|
||||
files: |
|
||||
release/*.dmg
|
||||
release/*.exe
|
||||
release/*.tar.gz
|
||||
release/latest.json
|
||||
@@ -0,0 +1,142 @@
|
||||
# The stem engine: a frozen torch + Demucs program, built per target and
|
||||
# published on its OWN release channel (`engine-v<version>`), separate from the
|
||||
# app's `v<version>-b<N>` releases. The app downloads the one it needs on first
|
||||
# use (see backend/konduktor/stems/engine_manager.py).
|
||||
#
|
||||
# * A tag `engine-v1.2.3` builds, tests and publishes — the tag must match
|
||||
# `konduktor_engine.VERSION`.
|
||||
# * A manual run builds and tests only (artifacts, no release).
|
||||
#
|
||||
# Releases are `prerelease: true` and `make_latest: false`: GitHub's "latest"
|
||||
# is what an app would take for itself, and the app's update check reads the
|
||||
# release list (UpdateDialog.tsx) — an engine release must never look like one.
|
||||
#
|
||||
# The weights are NOT in the engine (their licence is ambiguous): CI fetches the
|
||||
# pinned files from Hugging Face only to run the golden test.
|
||||
name: Engine
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ["engine-v*"]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: engine-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: macos-arm64
|
||||
os: macos-latest
|
||||
torch_index: ""
|
||||
- target: windows-x64-cpu
|
||||
os: windows-latest
|
||||
torch_index: "" # PyPI's Windows torch is the CPU build
|
||||
- target: windows-x64-cuda
|
||||
os: windows-latest
|
||||
# CUDA 13: Turing (RTX 20) through Blackwell (RTX 50); needs an
|
||||
# NVIDIA driver from r580. Older cards get the CPU engine — the
|
||||
# manager checks `engine info`'s arch list before offering this.
|
||||
torch_index: "https://download.pytorch.org/whl/cu130"
|
||||
runs-on: ${{ matrix.os }}
|
||||
name: ${{ matrix.target }}
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
working-directory: engine
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Check the tag matches the engine version
|
||||
if: startsWith(github.ref, 'refs/tags/engine-v')
|
||||
run: |
|
||||
want="$(python -c 'import konduktor_engine as e; print(e.VERSION)')"
|
||||
[ "${GITHUB_REF_NAME#engine-v}" = "$want" ] || { echo "tag ${GITHUB_REF_NAME} != engine $want"; exit 1; }
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
python -m pip install --upgrade pip uv
|
||||
uv venv .venv --python 3.12
|
||||
PY=.venv/bin/python; [ -f .venv/Scripts/python.exe ] && PY=.venv/Scripts/python.exe
|
||||
echo "PY=$PY" >> "$GITHUB_ENV"
|
||||
if [ -n "${{ matrix.torch_index }}" ]; then
|
||||
uv pip install --python "$PY" "torch==2.14.0" --index-url "${{ matrix.torch_index }}"
|
||||
fi
|
||||
uv pip install --python "$PY" -r requirements.txt "pyinstaller==6.21.0"
|
||||
|
||||
- name: Weights (for the golden test only)
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: engine/weights
|
||||
key: htdemucs-ft-d74ac89c3a1e874fc78f152555cf4d8533f06cd4
|
||||
- run: $PY fetch_weights.py weights
|
||||
|
||||
- name: Freeze
|
||||
run: $PY -m PyInstaller --noconfirm --clean konduktor-engine.spec
|
||||
|
||||
- name: Golden test (frozen vs unfrozen, CPU)
|
||||
run: |
|
||||
EXE=dist/konduktor-engine/konduktor-engine; [ -f "$EXE.exe" ] && EXE="$EXE.exe"
|
||||
$PY test_engine.py --weights weights --frozen "$EXE"
|
||||
|
||||
- name: Package
|
||||
run: $PY package.py ${{ matrix.target }} dist out
|
||||
|
||||
- name: Paths fit Windows' limit once installed
|
||||
run: |
|
||||
# Installed under e.g. %LOCALAPPDATA%\Konduktor\engine\<ver>\<target>\
|
||||
# (~70 characters on a typical user name): the tree must stay short.
|
||||
$PY -c "import json,sys; n=json.load(open('out/${{ matrix.target }}.json'))['longest_path']; print('longest', n); sys.exit(n > 180)"
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: engine-${{ matrix.target }}
|
||||
path: engine/out/*
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/engine-v')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
- name: Manifest
|
||||
run: |
|
||||
python - <<'PY'
|
||||
import json, glob, os
|
||||
targets = {}
|
||||
for f in glob.glob("artifacts/*.json"):
|
||||
info = json.load(open(f))
|
||||
targets[info["target"]] = info
|
||||
version = os.environ["GITHUB_REF_NAME"].removeprefix("engine-v")
|
||||
weights = json.load(open("engine/weights.json"))
|
||||
json.dump({"version": version, "targets": targets, "weights": weights},
|
||||
open("artifacts/engine-manifest.json", "w"), indent=1)
|
||||
PY
|
||||
- uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: Konduktor stem engine ${{ github.ref_name }}
|
||||
prerelease: true
|
||||
make_latest: false
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
artifacts/*.tar.gz*
|
||||
artifacts/engine-manifest.json
|
||||
body: |
|
||||
The stem engine Konduktor downloads for **Convert to Stems** — not an app release.
|
||||
Konduktor fetches the right file for your computer itself; there is nothing to install by hand.
|
||||
+8
-1
@@ -18,11 +18,14 @@ frontend/dist-ssr/
|
||||
# The collection is personal, large, and irreplaceable — don't commit it.
|
||||
# Remove this if you deliberately want to version a sample .nml.
|
||||
*.nml
|
||||
# Backups Konduktor will create before any write (Phase 3+).
|
||||
# Legacy pre-git backups (superseded by version history; left ignored so any
|
||||
# old .bak files on disk stay out of git).
|
||||
*.nml.bak
|
||||
*.nml.backup
|
||||
*.nml.*.bak
|
||||
backups/
|
||||
# Version-history git repos, if a dev points KONDUKTOR_DATA_DIR inside the repo.
|
||||
history/
|
||||
|
||||
# ---- Editor / OS ----
|
||||
.vscode/
|
||||
@@ -44,3 +47,7 @@ backend/userprefs.json
|
||||
# build_sidecar.sh are source and ARE tracked.
|
||||
backend/build/
|
||||
backend/dist/
|
||||
|
||||
# ---- Stem engine (PyInstaller onedir build) ----
|
||||
engine/build/
|
||||
engine/dist/
|
||||
+107
-30
@@ -1,21 +1,27 @@
|
||||
# Building Konduktor for Windows
|
||||
|
||||
The desktop app can't be cross-compiled — a Windows build must be produced **on
|
||||
Windows** (Tauri needs the MSVC toolchain + WebView2; PyInstaller must freeze the
|
||||
backend into a Windows `.exe`). The macOS `.dmg` is built separately on a Mac.
|
||||
The desktop app can't be cross-compiled. A Windows build must be produced **on
|
||||
Windows**: Tauri needs the MSVC toolchain and WebView2, and PyInstaller must
|
||||
freeze the backend into a Windows `.exe`. The macOS `.dmg` is built separately
|
||||
on a Mac (see [docs/BUILDING.md](docs/BUILDING.md)).
|
||||
|
||||
This mirrors the macOS build exactly; only the toolchain install and the
|
||||
sidecar-build command differ.
|
||||
The recipe is the same as on macOS. Only the toolchain install and the
|
||||
sidecar-build command differ. CI does exactly this on `windows-latest`
|
||||
([.github/workflows/build.yml](.github/workflows/build.yml)), so if a local build
|
||||
disagrees with CI, check that workflow first.
|
||||
|
||||
## One-time setup
|
||||
|
||||
1. **Rust** — install via <https://rustup.rs> (gives the `x86_64-pc-windows-msvc`
|
||||
1. **Rust**: install via <https://rustup.rs> (gives the `x86_64-pc-windows-msvc`
|
||||
toolchain). You also need the **MSVC C++ build tools**: install "Desktop
|
||||
development with C++" from the Visual Studio Build Tools installer.
|
||||
2. **WebView2 Runtime** — preinstalled on current Windows 10/11. If missing, get
|
||||
the Evergreen runtime from Microsoft (Tauri's installer can also bootstrap it).
|
||||
3. **Python 3.11–3.14** — <https://python.org> (tick "Add to PATH").
|
||||
4. **Node 18+** — <https://nodejs.org>.
|
||||
2. **WebView2 Runtime**: preinstalled on current Windows 10/11. If it's missing,
|
||||
get the Evergreen runtime from Microsoft (Tauri's installer can also
|
||||
bootstrap it).
|
||||
3. **Python 3.11–3.14**: <https://python.org> (tick "Add to PATH"). CI builds
|
||||
with **3.12**, the safest choice.
|
||||
4. **Node 20.19+ or 22.12+**: <https://nodejs.org>. Vite 8 refuses older
|
||||
versions, so Node 18 no longer works. CI uses Node 20.
|
||||
|
||||
Then, from the repo root:
|
||||
|
||||
@@ -33,49 +39,120 @@ npm install
|
||||
cd ..
|
||||
```
|
||||
|
||||
## Build
|
||||
If PowerShell refuses to run `Activate.ps1` or `dev.ps1` ("running scripts is
|
||||
disabled on this system"), either allow local scripts once with
|
||||
`Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`, or run a script with
|
||||
`powershell -ExecutionPolicy Bypass -File .\dev.ps1`.
|
||||
|
||||
## Develop (no build)
|
||||
|
||||
```powershell
|
||||
.\dev.ps1 # backend on :8000 + Vite on :5173, both reloading; Ctrl-C stops both
|
||||
```
|
||||
|
||||
Then open <http://localhost:5173> in a browser. `dev.ps1` is the Windows
|
||||
counterpart of `dev.sh`. It needs the `backend\.venv` and `frontend\node_modules`
|
||||
from the setup above. It runs the Python source, not the frozen sidecar, so it
|
||||
can't show desktop-shell behaviour (startup screen, quit prompt, WebView2, file
|
||||
drops from Explorer). For that, run `npx tauri dev` in `frontend`. Note that this
|
||||
still spawns the **frozen** sidecar staged in `src-tauri\binaries\`, so backend
|
||||
changes need `build_sidecar.ps1` first.
|
||||
|
||||
### Tests
|
||||
|
||||
`backend/run_tests.sh` expects a POSIX venv (`.venv/bin/activate`), so it won't
|
||||
run as-is on Windows. Run a suite directly with the venv's Python instead:
|
||||
|
||||
```powershell
|
||||
# 1) Freeze + stage the backend sidecar (from the activated backend venv)
|
||||
cd backend
|
||||
.\.venv\Scripts\Activate.ps1 # if not already active
|
||||
.\build_sidecar.ps1 # → frontend\src-tauri\binaries\konduktor-sidecar-<triple>.exe
|
||||
.\.venv\Scripts\python.exe test_save_fidelity.py
|
||||
```
|
||||
|
||||
## Build
|
||||
|
||||
One command does both steps and lists the installers it produced:
|
||||
|
||||
```powershell
|
||||
.\build.ps1 # sidecar + app
|
||||
.\build.ps1 -SkipSidecar # frontend-only change: reuse the staged sidecar
|
||||
.\build.ps1 --debug # any other argument is passed on to `tauri build`
|
||||
```
|
||||
|
||||
By hand, that is:
|
||||
|
||||
```powershell
|
||||
# 1) Freeze + stage the backend sidecar
|
||||
cd backend
|
||||
.\build_sidecar.ps1 # → frontend\src-tauri\binaries\konduktor-sidecar\ (a folder)
|
||||
cd ..
|
||||
|
||||
# 2) Build the app
|
||||
# 2) Build the app (its beforeBuildCommand runs the Vite build)
|
||||
cd frontend
|
||||
npx tauri build
|
||||
npx tauri build --config src-tauri/tauri.unsigned.conf.json
|
||||
```
|
||||
|
||||
The `--config` override skips the in-app updater packages, which are signed
|
||||
with the release key that only CI holds (`TAURI_SIGNING_PRIVATE_KEY`). With
|
||||
that key set in the environment, plain `npx tauri build` makes them too.
|
||||
`build.ps1` picks the right one by itself.
|
||||
|
||||
`build_sidecar.ps1` uses `backend\.venv\Scripts\python.exe` when it exists (else
|
||||
whatever `python` resolves to), so the venv doesn't need to be activated. It
|
||||
replaces the whole staged folder, so no file from an older build survives.
|
||||
|
||||
The sidecar is a PyInstaller **onedir** folder (`konduktor-sidecar.exe` plus
|
||||
`_internal\`), not a single `.exe`. Don't switch it back to onefile; see
|
||||
gotcha 4 in [CLAUDE.md](CLAUDE.md).
|
||||
|
||||
## Output
|
||||
|
||||
Installers land in:
|
||||
|
||||
```
|
||||
frontend\src-tauri\target\release\bundle\msi\Konduktor_0.1.0_x64_en-US.msi
|
||||
frontend\src-tauri\target\release\bundle\nsis\Konduktor_0.1.0_x64-setup.exe
|
||||
frontend\src-tauri\target\release\bundle\nsis\Konduktor_<version>_x64-setup.exe
|
||||
frontend\src-tauri\target\release\bundle\msi\Konduktor_<version>_x64_en-US.msi
|
||||
```
|
||||
|
||||
Either one installs the app (bundling the sidecar `.exe` alongside it).
|
||||
`<version>` is the `version` in [frontend/package.json](frontend/package.json),
|
||||
the app's only version source. Either installer works. Releases ship only the
|
||||
NSIS `-setup.exe`. Both put the sidecar folder in the app's `sidecar\` resource
|
||||
folder (`tauri.windows.conf.json` → `bundle.resources`), where `lib.rs` spawns
|
||||
`sidecar\konduktor-sidecar.exe`.
|
||||
|
||||
## Rebuilding after changes
|
||||
|
||||
Same as macOS: if you changed **backend** Python, re-run `build_sidecar.ps1`
|
||||
first; then `npx tauri build`. Frontend-only changes just need `npx tauri build`
|
||||
(its `beforeBuildCommand` rebuilds the web app).
|
||||
If you changed **backend** Python, run `.\build.ps1` (or `build_sidecar.ps1`,
|
||||
then `npx tauri build` as above). Frontend-only changes just need
|
||||
`.\build.ps1 -SkipSidecar`.
|
||||
|
||||
## Not part of this build: the stem engine
|
||||
|
||||
Convert to Stems uses a separate program, `engine/` (torch + demucs), built and
|
||||
released on its own channel by
|
||||
[.github/workflows/engine.yml](.github/workflows/engine.yml) (`windows-x64-cpu`
|
||||
and `windows-x64-cuda`). The app downloads it at runtime into a short
|
||||
`%LOCALAPPDATA%\Konduktor\engine` path to stay under Windows' 260-character path
|
||||
limit. You don't need it to build or run the app.
|
||||
|
||||
## Known Windows caveats
|
||||
|
||||
- **Unsigned build → SmartScreen.** We don't code-sign yet, so the first launch
|
||||
shows a "Windows protected your PC" prompt. Click **More info → Run anyway**.
|
||||
(Signing is a future step.)
|
||||
- **Unsigned build → SmartScreen.** Builds aren't code-signed yet, so the first
|
||||
launch shows a "Windows protected your PC" prompt. Click **More info → Run
|
||||
anyway**.
|
||||
- **Mixed content is already handled.** The webview is forced to the `http`
|
||||
custom-protocol scheme (`use_https_scheme(false)` in `src-tauri/src/lib.rs`) so
|
||||
it can fetch the sidecar at `http://127.0.0.1:<port>` without being blocked.
|
||||
Leave that setting as-is.
|
||||
- **Sidecar console window.** The sidecar is frozen as a console app (needed for
|
||||
the `KONDUKTOR_PORT` stdout handshake). Tauri's shell plugin normally spawns it
|
||||
without a visible window; if a console flashes on launch, tell me and we'll add
|
||||
the `CREATE_NO_WINDOW` spawn flag.
|
||||
- **The sidecar must be frozen on Windows** — a macOS-built sidecar won't run.
|
||||
- **The sidecar is a console app, but no console appears.** It's frozen with
|
||||
`console=True` because the shell reads the `KONDUKTOR_PORT=<n>` line from its
|
||||
stdout. Tauri's shell plugin spawns it with `CREATE_NO_WINDOW`, so no window
|
||||
flashes.
|
||||
- **The sidecar doesn't watch stdin on Windows.** On macOS it exits when its
|
||||
stdin closes. On Windows a pending stdin read stalled loading scipy's OpenBLAS
|
||||
DLL, which hung the first analysis, so it waits on the parent process instead
|
||||
(`backend/sidecar.py`). Keep this in mind before touching that watcher.
|
||||
- **Decode audio through `waveform.load`, never `librosa.load`.** librosa reads
|
||||
AAC only through CoreAudio or a system ffmpeg, so on Windows every `.m4a` /
|
||||
`.stem.m4a` failed with "Format not recognised". PyAV bundles FFmpeg.
|
||||
- **The sidecar must be frozen on Windows.** A macOS-built sidecar won't run.
|
||||
`build_sidecar.ps1` handles this; just don't copy binaries between OSes.
|
||||
@@ -1,203 +1,141 @@
|
||||
# Konduktor
|
||||
<p align="center">
|
||||
<img src="design/konduktor-icon.svg" width="96" alt="Konduktor icon">
|
||||
</p>
|
||||
|
||||
**A fast, modern home for your Traktor collection.**
|
||||
<h1 align="center">Konduktor</h1>
|
||||
|
||||
Konduktor is a lightweight desktop-style app for DJs who run **Native
|
||||
Instruments Traktor** (Pro 4 / NML v20). It opens your existing
|
||||
`collection.nml`, gives you a beautiful dark library to explore, and lets you
|
||||
build playlists and prep tracks — without launching the whole heavyweight
|
||||
Traktor app just to tidy up your tags or drop a few cue points.
|
||||
<p align="center">
|
||||
<b>Prep your tracks and run your DJ libraries in one fast app.</b><br>
|
||||
Traktor, Rekordbox, or the USB stick in your pocket.
|
||||
</p>
|
||||
|
||||
Your collection stays exactly where it is. Konduktor reads and writes the same
|
||||
file Traktor uses, so everything you do shows up next time you open Traktor.
|
||||
<p align="center">
|
||||
<a href="https://github.com/MrPatben8/konduktor/releases"><b>Download for macOS & Windows</b></a>
|
||||
</p>
|
||||
|
||||

|
||||
|
||||
Konduktor opens the library you already have, in the format it already uses.
|
||||
You can tidy tags, build playlists, set grids and cues, and pack a USB stick
|
||||
for the gig without launching your full DJ software. When you open your DJ
|
||||
software again, everything you changed is there.
|
||||
|
||||
---
|
||||
|
||||
## Why you'll like it
|
||||
## One app for every library
|
||||
|
||||
- **Instant, searchable library.** Your whole collection loads into a snappy,
|
||||
virtualized grid. Search, filter by genre / key / BPM / rating, and sort by
|
||||
any column — all instant, no waiting.
|
||||
- **Make it yours.** Show only the columns you care about, drag them into the
|
||||
order you like, and resize them to fit. Your layout is remembered.
|
||||
- **Edit tags without the ceremony.** Double-click any field to fix a title or
|
||||
genre on the spot, click the stars to rate a track, or right-click for a full
|
||||
tag + cover-art editor. Great for quick one-off fixes.
|
||||
- **Playlists, the easy way.** Create, rename, and delete playlists, then
|
||||
drag-and-drop to reorder or add tracks.
|
||||
- **A real prep deck.** Load any track into the deck at the top and:
|
||||
- play it with a **frequency-colored waveform** (Traktor-style Spectrum look),
|
||||
scrolling under a fixed playhead with zoom in/out
|
||||
- scratch it by dragging the waveform
|
||||
- see and adjust the **beatgrid** and BPM
|
||||
- set, jump to, and delete **hotcues** (with a color-coded 8-slot bar)
|
||||
- build **loops** in fixed beat sizes, tied into the hotcue system
|
||||
- use keyboard shortcuts: **Space** to play/pause, **1–8** to fire hotcues,
|
||||
**Shift+1–8** to clear them
|
||||
- **Your data is safe.** Every save makes a timestamped backup first, and only
|
||||
ever touches the parts you changed — the rest of the file stays byte-for-byte
|
||||
identical.
|
||||
<img src="docs/screenshots/platforms.png" align="right" width="420" alt="Choosing a platform: Rekordbox, Traktor, OneLibrary or Remote">
|
||||
|
||||
- **Traktor** collections.
|
||||
- **Rekordbox** libraries.
|
||||
- **OneLibrary** USB sticks, the format CDJs read. Plug one in to browse it,
|
||||
preview tracks off it, import them, or edit the stick directly.
|
||||
- **Remote** libraries: keep your whole library and music on a home server and
|
||||
open it from any laptop ([set up a server](docs/REMOTE-SERVER.md)).
|
||||
- **Any folder or drive**: browse loose audio files, preview them, and add
|
||||
them to your library.
|
||||
|
||||
Your library is never converted into a Konduktor database. Saves write back to
|
||||
the original file and change only what you edited.
|
||||
|
||||
<br clear="right">
|
||||
|
||||
## A real prep deck
|
||||
|
||||

|
||||
|
||||
- A scrolling waveform, coloured by frequency, with zoom, scratching and an
|
||||
overview of the whole track.
|
||||
- Eight hotcue pads with names, types and colours, plus beat loops, beat jump
|
||||
and tap tempo.
|
||||
- **Beatgrid editing**, including grids with tempo changes. Nudge, retempo,
|
||||
halve or double without opening your DJ software.
|
||||
- Keyboard shortcuts for the whole deck: Space to play, 1–8 for hotcues,
|
||||
arrow keys to jump or move a loop.
|
||||
|
||||
## Stems, built in
|
||||
|
||||

|
||||
|
||||
**Play stem files as stems.** Load a stem file and the deck splits into
|
||||
drums, bass, synths and vocals, each drawn in its own lane. Click a lane's
|
||||
button to mute it, Alt/Option-click to solo it, or use Q W E R.
|
||||
|
||||
**Convert to Stems.** In a Traktor collection, right-click any tracks and
|
||||
choose Convert to Stems. They come back as standard Traktor stem files with their tags, cover art, cues and
|
||||
beatgrid intact.
|
||||
|
||||
- The separation runs on your own computer, so your music isn't sent to an
|
||||
online service.
|
||||
- Replace the originals, or save the stems to a folder and add them as new
|
||||
tracks.
|
||||
- Convert a whole playlist in one go.
|
||||
|
||||
## Let it do the boring parts
|
||||
|
||||
| Auto Hotcues | Analyze |
|
||||
|:---:|:---:|
|
||||
|  |  |
|
||||
| Pick an event for each pad (first beat, build, drop, breakdown, outro). Konduktor finds them in the track and places the cues. Run it on one track or a whole playlist. | Detects tempo, beatgrid and musical key, for one track or hundreds. |
|
||||
|
||||
## Export to USB for CDJs, or other platforms
|
||||
|
||||
<img src="docs/screenshots/export.png" align="right" width="380" alt="An export set for OneLibrary, Traktor and Rekordbox">
|
||||
|
||||
Make an **export** in the sidebar, drag playlists onto it, and press Export.
|
||||
One stick can carry a Traktor collection, a OneLibrary library for current
|
||||
CDJs and a Rekordbox Device Library for older players, all sharing **one copy
|
||||
of the audio**.
|
||||
|
||||
- Hotcues, memory cues, loops, grids, keys and cover art are converted for
|
||||
each platform.
|
||||
- Playlists stay linked: edit a playlist, re-export, and the stick catches up.
|
||||
- Re-exports copy only what changed, so updating a stick is quick.
|
||||
- Konduktor only ever clears a folder that it wrote itself.
|
||||
|
||||
<br clear="right">
|
||||
|
||||
## Your library is safe
|
||||
|
||||
- **Saves are surgical.** A Traktor save changes only the entries you edited.
|
||||
The rest of the file stays byte-for-byte identical.
|
||||
- **Backups and history.** Every Traktor save makes a backup first and is kept
|
||||
in a version history that you can restore from in the app.
|
||||
- **Nothing is written until you press Save.** Discard changes throws away
|
||||
everything you did since your last save.
|
||||
- Tag edits are also written into the audio files themselves, so other apps
|
||||
see them too.
|
||||
|
||||
## And also
|
||||
|
||||
- A fast library with search, filters, sorting and columns you can rearrange,
|
||||
even with thousands of tracks.
|
||||
- Edit tags inline or in a full tag and cover-art editor.
|
||||
- Drag and drop tracks onto playlists, exports or the deck, and drag playlists
|
||||
to reorganise them.
|
||||
- If you open a Traktor collection on a different computer or drive,
|
||||
Konduktor finds the missing files for you.
|
||||
|
||||
---
|
||||
|
||||
## Getting started
|
||||
## Get Konduktor
|
||||
|
||||
Konduktor runs as two small local servers (a Python backend and a web
|
||||
frontend). Do the one-time setup, then start them — the same steps work on
|
||||
macOS, Linux, and Windows.
|
||||
Download the latest build from
|
||||
[**Releases**](https://github.com/MrPatben8/konduktor/releases):
|
||||
a `.dmg` for macOS (Apple Silicon) and a `-setup.exe` for Windows.
|
||||
|
||||
### 1. Install (once)
|
||||
> **First launch:** builds aren't notarised yet, so your OS will warn you the
|
||||
> first time.
|
||||
> **macOS:** right-click the app, choose **Open**, then **Open** again. If it
|
||||
> still refuses, run `xattr -cr /Applications/Konduktor.app` once.
|
||||
> **Windows:** click **More info → Run anyway**.
|
||||
|
||||
**Backend** — needs Python 3.11+. Create a virtual environment and install the
|
||||
dependencies:
|
||||
> **Using Traktor?** Close it before saving in Konduktor. Traktor rewrites
|
||||
> `collection.nml` when it quits, which would overwrite your changes.
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
python3 -m venv .venv # Windows: python -m venv .venv
|
||||
```
|
||||
Want to run it from source or build it yourself? See
|
||||
[docs/BUILDING.md](docs/BUILDING.md).
|
||||
|
||||
Activate it, then install:
|
||||
## License
|
||||
|
||||
```bash
|
||||
source .venv/bin/activate # Windows (PowerShell): .\.venv\Scripts\Activate.ps1
|
||||
pip install -r requirements.txt
|
||||
cd ..
|
||||
```
|
||||
|
||||
**Frontend** — needs Node 18+ (same on every platform):
|
||||
|
||||
```bash
|
||||
cd frontend
|
||||
npm install
|
||||
cd ..
|
||||
```
|
||||
|
||||
### 2. Run it (development)
|
||||
|
||||
Konduktor runs as two local servers (backend on `:8000`, frontend on `:5173`).
|
||||
|
||||
**macOS / Linux** — one command starts both:
|
||||
|
||||
```bash
|
||||
./dev.sh
|
||||
```
|
||||
|
||||
**Windows** — start each server in its own terminal:
|
||||
|
||||
```powershell
|
||||
# Terminal 1 — backend
|
||||
cd backend; .\.venv\Scripts\Activate.ps1; uvicorn konduktor.main:app --reload --port 8000
|
||||
|
||||
# Terminal 2 — frontend
|
||||
cd frontend; npm run dev
|
||||
```
|
||||
|
||||
Either way, open **http://localhost:5173** in your browser (`Ctrl-C` stops a
|
||||
server). This is the fastest way to try Konduktor or hack on it — the frontend
|
||||
hot-reloads as you edit. To package a real double-clickable app instead, see
|
||||
[Build a standalone app](#build-a-standalone-app-production) below.
|
||||
|
||||
### 3. Open your collection
|
||||
|
||||
On launch, Konduktor offers to:
|
||||
|
||||
- **Automatically** open the collection from your latest installed Traktor,
|
||||
- reopen the **last collection** you used, or
|
||||
- **browse** for a `collection.nml` yourself.
|
||||
|
||||
That's it — you're in.
|
||||
|
||||
---
|
||||
|
||||
## Build a standalone app (production)
|
||||
|
||||
Prefer a real double-clickable app over running the dev servers? Konduktor
|
||||
packages into a native desktop app (via **Tauri**) that bundles the Python
|
||||
backend as a sidecar — no terminal, no servers to start by hand.
|
||||
|
||||
### Extra prerequisites
|
||||
|
||||
On top of the Python 3.11+ and Node 18+ from above:
|
||||
|
||||
- **Rust** — install from <https://rustup.rs> (the app shell is Tauri/Rust).
|
||||
- **PyInstaller** — into the backend venv:
|
||||
`pip install -r backend/requirements-build.txt`
|
||||
- **Windows only:** also the MSVC C++ build tools and the WebView2 runtime — see
|
||||
[BUILDING-WINDOWS.md](BUILDING-WINDOWS.md) for the one-time toolchain setup.
|
||||
|
||||
The build is a two-step recipe on both platforms: **freeze the backend into a
|
||||
sidecar binary**, then **build the app**. The only difference is which sidecar
|
||||
script you run — `.sh` on macOS/Linux, `.ps1` on Windows. Each build runs on its
|
||||
own OS (the app can't be cross-compiled).
|
||||
|
||||
### macOS / Linux
|
||||
|
||||
```bash
|
||||
# 1) Freeze the backend into a sidecar binary (from the activated backend venv)
|
||||
cd backend && source .venv/bin/activate && ./build_sidecar.sh && cd ..
|
||||
|
||||
# 2) Build the app
|
||||
cd frontend && npx tauri build
|
||||
```
|
||||
|
||||
The installer lands at
|
||||
`frontend/src-tauri/target/release/bundle/dmg/Konduktor_<version>_aarch64.dmg`
|
||||
(with the `.app` beside it).
|
||||
|
||||
### Windows
|
||||
|
||||
```powershell
|
||||
# 1) Freeze the backend into a sidecar binary (from the activated backend venv)
|
||||
cd backend; .\.venv\Scripts\Activate.ps1; .\build_sidecar.ps1; cd ..
|
||||
|
||||
# 2) Build the app
|
||||
cd frontend; npx tauri build
|
||||
```
|
||||
|
||||
The installers land in `frontend\src-tauri\target\release\bundle\` (an `.msi` and
|
||||
an NSIS `-setup.exe`). See [BUILDING-WINDOWS.md](BUILDING-WINDOWS.md) for the full
|
||||
walkthrough and Windows-specific notes.
|
||||
|
||||
> **Note:** builds are currently **unsigned**, so the first launch is flagged by
|
||||
> the OS — on macOS right-click → **Open** to get past Gatekeeper; on Windows
|
||||
> click **More info → Run anyway** past SmartScreen. The macOS `.dmg` is
|
||||
> Apple-Silicon (`aarch64`) only.
|
||||
|
||||
> **Faster local builds:** `npx tauri build --debug --bundles app` skips the
|
||||
> optimizer and the installer, giving you a runnable app in seconds — handy while
|
||||
> iterating.
|
||||
|
||||
### Rebuilding after changes
|
||||
|
||||
Changed **backend** Python? Re-run the sidecar script for your OS
|
||||
(`./build_sidecar.sh` or `.\build_sidecar.ps1`), then `npx tauri build`.
|
||||
Frontend-only change? Just `npx tauri build` — it rebuilds the web app for you.
|
||||
|
||||
---
|
||||
|
||||
## Saving back to Traktor
|
||||
|
||||
Playlist edits, tag changes, and prep tweaks all apply live in the app. When
|
||||
you're happy, hit **Save to Traktor** to write them to `collection.nml`.
|
||||
|
||||
> ⚠️ **Close Traktor before saving.** Traktor rewrites `collection.nml` when it
|
||||
> quits, so if it's open it will overwrite your changes. Konduktor always writes
|
||||
> a backup first (into a `backups/` folder next to your collection), but closing
|
||||
> Traktor first is the safe habit.
|
||||
|
||||
Want to experiment risk-free? Point Konduktor at a *copy* of your collection and
|
||||
play around.
|
||||
|
||||
---
|
||||
|
||||
## Good to know
|
||||
|
||||
- Konduktor is built on [`traktor-nml-utils`](https://github.com/MrPatben8/traktor-nml-utils)
|
||||
and speaks Traktor's real file format — no import/export, no separate database.
|
||||
- Run it in your browser from source, or package it into a native desktop app
|
||||
(macOS `.dmg` / Windows `.msi`) that bundles the backend — see
|
||||
[Build a standalone app](#build-a-standalone-app-production). A mobile version
|
||||
is on the horizon.
|
||||
- Under the hood: **FastAPI** (Python) backend + **React / TypeScript / Vite**
|
||||
frontend. Curious about internals or contributing? See
|
||||
[CLAUDE.md](CLAUDE.md) for the architecture and conventions.
|
||||
[AGPL-3.0](LICENSE)
|
||||
@@ -0,0 +1,189 @@
|
||||
"""Benchmark beatgrid detection against grids a DJ platform already analysed.
|
||||
|
||||
NOT part of `run_tests.sh`: it needs real audio, and the answer is a score to
|
||||
compare rather than a pass/fail. Every open is read-only — nothing is saved.
|
||||
|
||||
python bench_grid_detect.py # the local Rekordbox library
|
||||
python bench_grid_detect.py path/to/collection.nml path/to/master.db
|
||||
python bench_grid_detect.py --legacy # score the old librosa beat_track
|
||||
python bench_grid_detect.py --hold bpm # Grid alone: phase, given the right BPM
|
||||
python bench_grid_detect.py --hold anchor # BPM alone: tempo, given the right anchor
|
||||
|
||||
The reference is each track's own grid, and only single-marker grids are used:
|
||||
a multi-marker grid is either a real tempo change (which a constant-tempo
|
||||
detector cannot match by design) or a hand edit, and neither is ground truth
|
||||
for "what is this track's tempo".
|
||||
|
||||
Per track it reports:
|
||||
- BPM error, and whether it is an octave error (half/double tempo);
|
||||
- PHASE error at 30 s in and 30 s before the end — the distance between the
|
||||
detected grid's nearest beat and the reference's, in ms. Measuring at two
|
||||
ends is what separates "anchor wrong" (both off by the same amount) from
|
||||
"BPM wrong" (error grows along the track), which one number would conflate.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
os.environ.setdefault("KONDUKTOR_DATA_DIR", tempfile.mkdtemp(prefix="konduktor-bench-"))
|
||||
|
||||
import konduktor.adapters # noqa: E402,F401 — registers the drivers
|
||||
from konduktor.core import registry # noqa: E402
|
||||
|
||||
BPM_OK = 0.02 # a grid this close drifts < 1/50 beat per minute...
|
||||
PHASE_OK_MS = 10.0 # roughly where a DJ starts to hear flamming
|
||||
|
||||
|
||||
def _phase_error_ms(t: float, ref: tuple[float, float], det: tuple[float, float]) -> float:
|
||||
"""Signed distance (ms) from the reference's nearest beat at ``t`` to the
|
||||
detected grid's nearest beat, wrapped to half the reference beat."""
|
||||
r0, rb = ref
|
||||
d0, db = det
|
||||
rp, dp = 60.0 / rb, 60.0 / db
|
||||
ref_beat = r0 + round((t - r0) / rp) * rp
|
||||
det_beat = d0 + round((ref_beat - d0) / dp) * dp
|
||||
e = det_beat - ref_beat
|
||||
e = (e + rp / 2) % rp - rp / 2
|
||||
return e * 1000.0
|
||||
|
||||
|
||||
def _octave(det: float, ref: float) -> str:
|
||||
for k, name in ((2.0, "x2"), (0.5, "/2"), (1.5, "x1.5"), (2 / 3, "/1.5")):
|
||||
if abs(det - ref * k) < 0.5:
|
||||
return name
|
||||
return ""
|
||||
|
||||
|
||||
def legacy_detect(audio_path: str):
|
||||
"""The detector `core/grid_detect.py` replaced (librosa ``beat_track``), kept
|
||||
here so the two can still be compared on the same references."""
|
||||
import librosa
|
||||
import numpy as np
|
||||
from konduktor.core.grid_detect import GridResult
|
||||
|
||||
y, sr = librosa.load(audio_path, sr=22050, mono=True)
|
||||
tempo, beats = librosa.beat.beat_track(y=y, sr=sr, trim=False)
|
||||
return GridResult(float(np.ravel(tempo)[0]), float(librosa.frames_to_time(beats, sr=sr)[0]), len(y) / sr)
|
||||
|
||||
|
||||
def references(paths: list[Path]) -> list[tuple[str, Path, float, float]]:
|
||||
out = []
|
||||
for p in paths:
|
||||
a = registry.open_library(p)
|
||||
try:
|
||||
for t in a.tracks:
|
||||
cues = a.track_cues(t.id)
|
||||
if cues is None or len(cues.grid_markers) != 1:
|
||||
continue
|
||||
audio = a.audio_path(t.id)
|
||||
if audio is None or not audio.exists():
|
||||
continue
|
||||
m = cues.grid_markers[0]
|
||||
out.append((f"{t.artist or ''} - {t.title or audio.stem}".strip(" -"), audio, m.start, m.bpm))
|
||||
finally:
|
||||
close = getattr(a, "close", None)
|
||||
if close:
|
||||
close()
|
||||
# One row per audio file: the same file in two libraries would count twice.
|
||||
seen, uniq = set(), []
|
||||
for r in out:
|
||||
if r[1] not in seen:
|
||||
seen.add(r[1])
|
||||
uniq.append(r)
|
||||
return uniq
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("libraries", nargs="*", type=Path)
|
||||
ap.add_argument("--legacy", action="store_true", help="score the old librosa beat_track detector")
|
||||
ap.add_argument("--hold", choices=("bpm", "anchor"),
|
||||
help="score one half alone: hold the REFERENCE's BPM (the Analyze dialog's "
|
||||
"'Grid' tick — phase is all that is scored) or its anchor ('BPM')")
|
||||
args = ap.parse_args()
|
||||
|
||||
libs = args.libraries or [Path.home() / "Library/Pioneer/rekordbox/master.db"]
|
||||
refs = references(libs)
|
||||
if not refs:
|
||||
print("No single-marker reference grids with reachable audio.")
|
||||
return 1
|
||||
|
||||
if args.legacy:
|
||||
detect = legacy_detect
|
||||
else:
|
||||
from konduktor.core.grid_detect import detect_grid as detect
|
||||
|
||||
rows = []
|
||||
for name, audio, r0, rb in refs:
|
||||
t0 = time.perf_counter()
|
||||
try:
|
||||
hold = {"bpm": {"bpm": rb}, "anchor": {"anchor": r0}}.get(args.hold, {})
|
||||
res = detect(str(audio), **hold)
|
||||
except Exception as ex: # a failure is a data point, not a crash
|
||||
print(f" FAIL {name[:48]:48} {ex}")
|
||||
rows.append(None)
|
||||
continue
|
||||
dt = time.perf_counter() - t0
|
||||
bpm, first = res.bpm, res.anchor
|
||||
import soundfile as sf
|
||||
try:
|
||||
dur = sf.info(str(audio)).duration
|
||||
except Exception:
|
||||
dur = res.duration
|
||||
early = _phase_error_ms(min(30.0, dur / 3), (r0, rb), (first, bpm))
|
||||
late = _phase_error_ms(max(dur - 30.0, 2 * dur / 3), (r0, rb), (first, bpm))
|
||||
oct_ = _octave(bpm, rb) if abs(bpm - rb) >= 0.5 else ""
|
||||
ok = abs(bpm - rb) <= BPM_OK and abs(early) <= PHASE_OK_MS and abs(late) <= PHASE_OK_MS
|
||||
lossy = audio.suffix.lower() not in (".wav", ".aif", ".aiff", ".flac")
|
||||
rows.append((abs(bpm - rb), early, late, oct_, ok, dt, lossy))
|
||||
conf = f"{res.drift_ms:5.1f}" if res.drift_ms is not None else " -"
|
||||
print(
|
||||
f" {'ok ' if ok else 'BAD '} {name[:48]:48} ref {rb:7.3f} got {bpm:8.3f} {oct_:5}"
|
||||
f" phase {early:+7.1f} / {late:+7.1f} ms drift {conf} ms {dt:4.1f}s"
|
||||
)
|
||||
|
||||
good = [r for r in rows if r]
|
||||
n = len(rows)
|
||||
same_octave = [r for r in good if not r[3]]
|
||||
print()
|
||||
print(f"tracks {n}")
|
||||
print(f"all correct {sum(r[4] for r in good)}/{n}")
|
||||
print(f"BPM within {BPM_OK} {sum(r[0] <= BPM_OK for r in good)}/{n}")
|
||||
print(f"octave errors {sum(bool(r[3]) for r in good)}/{n}")
|
||||
if same_octave:
|
||||
import statistics as st
|
||||
print(f"median |phase| early {st.median(abs(r[1]) for r in same_octave):.1f} ms")
|
||||
print(f"median |phase| late {st.median(abs(r[2]) for r in same_octave):.1f} ms")
|
||||
print(f"phase within {PHASE_OK_MS:.0f} ms "
|
||||
f"{sum(abs(r[1]) <= PHASE_OK_MS and abs(r[2]) <= PHASE_OK_MS for r in same_octave)}/{n}")
|
||||
print(f"mean time per track {sum(r[5] for r in good) / max(1, len(good)):.2f} s")
|
||||
|
||||
# A platform's MP3/AAC time base can differ from the decoded audio's by a
|
||||
# constant (Rekordbox: ~+26 ms, the decoder delay it does not trim). That
|
||||
# is not detection error, and it would swamp it — so report the constant
|
||||
# per format, and how tightly the tracks sit around it.
|
||||
import statistics as st
|
||||
print()
|
||||
for label, want in (("lossless", False), ("lossy", True)):
|
||||
grp = [r for r in same_octave if r[6] == want and r[0] <= BPM_OK]
|
||||
if len(grp) < 2:
|
||||
continue
|
||||
offs = [(r[1] + r[2]) / 2 for r in grp]
|
||||
med = st.median(offs)
|
||||
spread = [abs(o - med) for o in offs]
|
||||
within = sum(abs(r[1] - med) <= PHASE_OK_MS and abs(r[2] - med) <= PHASE_OK_MS for r in grp)
|
||||
print(f"{label:9} n={len(grp):2} constant offset {med:+6.1f} ms "
|
||||
f"|deviation| median {st.median(spread):4.1f} max {max(spread):5.1f} ms "
|
||||
f"within {PHASE_OK_MS:.0f} ms of it: {within}/{len(grp)}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,172 @@
|
||||
"""Benchmark key detection (`core/key_detect.py`).
|
||||
|
||||
NOT part of `run_tests.sh`: it needs real audio, and the answer is a score to
|
||||
compare rather than a pass/fail.
|
||||
|
||||
python bench_key_detect.py --giantsteps DATA/gs # hand-annotated EDM
|
||||
python bench_key_detect.py ~/Music # files with a key TAG
|
||||
|
||||
GiantSteps (604 Beatport previews, keys corrected by hand) is ground truth
|
||||
and the number to quote; the model never trained on it (see
|
||||
`train_key_model.py`). A folder's key tags were written by some other
|
||||
analyser — usually Traktor, sometimes Mixed In Key or a store — so that score
|
||||
is AGREEMENT with it, not accuracy. Copies of one song (a stem file beside its
|
||||
source) count once, by title.
|
||||
|
||||
Errors are classed the MIREX way, because they are not equally wrong for a
|
||||
DJ: a FIFTH (one step round the Camelot wheel) or the RELATIVE key (same
|
||||
number, other letter) still mixes harmonically; PARALLEL (same tonic, other
|
||||
mode) and OTHER do not. MIREX's weighted score is 1 / 0.5 / 0.3 / 0.2 / 0.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import warnings
|
||||
from collections import Counter
|
||||
from concurrent.futures import ProcessPoolExecutor
|
||||
from pathlib import Path
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
|
||||
from konduktor.core import key_detect, musical_key # noqa: E402
|
||||
|
||||
WEIGHT = {"exact": 1.0, "fifth": 0.5, "relative": 0.3, "parallel": 0.2, "other": 0.0}
|
||||
AUDIO = {".mp3", ".m4a", ".mp4", ".flac", ".aif", ".aiff", ".wav", ".ogg"}
|
||||
|
||||
|
||||
def relation(det: tuple[int, str], ref: tuple[int, str]) -> str:
|
||||
"""How a detected (wheel, mode) relates to the reference."""
|
||||
(dw, dm), (rw, rm) = det, ref
|
||||
if (dw, dm) == (rw, rm):
|
||||
return "exact"
|
||||
if dw == rw:
|
||||
return "relative"
|
||||
if dm == rm and (dw - rw) % 12 in (1, 11):
|
||||
return "fifth"
|
||||
if dm != rm:
|
||||
major, minor = (dw, rw) if dm == "major" else (rw, dw)
|
||||
if (major - minor) % 12 == 3: # C major 8B vs C minor 5A
|
||||
return "parallel"
|
||||
return "other"
|
||||
|
||||
|
||||
def parse_any(text: str) -> tuple[int, str] | None:
|
||||
"""Open Key, Camelot or a named key ("Abm", "F# minor", "Gmin")."""
|
||||
w, m = musical_key.parse(text)
|
||||
return (w, m) if w else None
|
||||
|
||||
|
||||
def _tag_key(path: Path) -> tuple[str, str] | None:
|
||||
import mutagen
|
||||
|
||||
try:
|
||||
f = mutagen.File(path)
|
||||
except Exception:
|
||||
return None
|
||||
if not f or not f.tags:
|
||||
return None
|
||||
t = f.tags
|
||||
|
||||
def has(name: str) -> bool:
|
||||
try:
|
||||
return name in t
|
||||
except ValueError: # a Vorbis comment refuses an MP4-style atom name
|
||||
return False
|
||||
|
||||
key = title = None
|
||||
for name in ("TKEY", "----:com.apple.iTunes:initialkey", "initialkey", "INITIALKEY"):
|
||||
if has(name):
|
||||
v = t[name]
|
||||
v = v.text[0] if hasattr(v, "text") else v[0]
|
||||
key = v.decode() if isinstance(v, bytes) else str(v)
|
||||
break
|
||||
for name in ("TIT2", "\xa9nam", "title", "TITLE"):
|
||||
if has(name):
|
||||
v = t[name]
|
||||
title = str(v.text[0] if hasattr(v, "text") else v[0])
|
||||
break
|
||||
return (key, title or path.stem) if key else None
|
||||
|
||||
|
||||
def folder_refs(roots: list[Path]) -> list[tuple[Path, tuple[int, str], str]]:
|
||||
seen, out = set(), []
|
||||
for root in roots:
|
||||
for dp, dirs, files in os.walk(root):
|
||||
dirs[:] = sorted(d for d in dirs if not d.startswith("."))
|
||||
for name in sorted(files):
|
||||
p = Path(dp) / name
|
||||
if p.suffix.lower() not in AUDIO or name.startswith("."):
|
||||
continue
|
||||
tagged = _tag_key(p)
|
||||
if not tagged or not (ref := parse_any(tagged[0])):
|
||||
continue
|
||||
title = re.sub(r"\.stem$", "", tagged[1].strip().lower())
|
||||
if title not in seen:
|
||||
seen.add(title)
|
||||
out.append((p, ref, tagged[1]))
|
||||
return out
|
||||
|
||||
|
||||
def giantsteps_refs(gs: Path) -> list[tuple[Path, tuple[int, str], str]]:
|
||||
out = []
|
||||
for f in sorted((gs / "annotations/key").glob("*.key")):
|
||||
audio = gs / "audio" / f"{f.stem}.mp3"
|
||||
ref = parse_any(f.read_text()) # "C minor"
|
||||
if audio.exists() and ref:
|
||||
out.append((audio, ref, f.stem))
|
||||
return out
|
||||
|
||||
|
||||
def _detect(path: Path):
|
||||
warnings.filterwarnings("ignore")
|
||||
try:
|
||||
r = key_detect.detect_key(str(path))
|
||||
except Exception as ex: # an undecodable file is reported, not fatal
|
||||
return None, str(ex)
|
||||
return (r.wheel, r.mode, r.name, r.confidence) if r else None, None
|
||||
|
||||
|
||||
def run(refs, label: str, verbose: bool) -> None:
|
||||
with ProcessPoolExecutor() as ex:
|
||||
results = list(ex.map(_detect, [p for p, _, _ in refs], chunksize=2))
|
||||
rels, misses = [], []
|
||||
for (path, ref, title), (det, err) in zip(refs, results):
|
||||
if det is None:
|
||||
print(f" could not analyse {title}: {err or 'silent / too short'}")
|
||||
continue
|
||||
rel = relation(det[:2], ref)
|
||||
rels.append(rel)
|
||||
if rel != "exact":
|
||||
misses.append((title, ref, det, rel))
|
||||
n = len(rels)
|
||||
if not n:
|
||||
print(f"{label}: nothing to score")
|
||||
return
|
||||
c = Counter(rels)
|
||||
print(f"\n{label}: {n} tracks")
|
||||
for k in WEIGHT:
|
||||
print(f" {k:9s} {c[k]:4d} {100 * c[k] / n:5.1f}%")
|
||||
print(f" MIREX weighted score {sum(WEIGHT[r] for r in rels) / n:.3f}")
|
||||
print(f" harmonically mixable (exact + fifth + relative) {100 * (c['exact'] + c['fifth'] + c['relative']) / n:.1f}%")
|
||||
if verbose:
|
||||
for title, ref, det, rel in misses:
|
||||
print(f" {rel:9s} ref {ref[0]}{'A' if ref[1] == 'minor' else 'B'} "
|
||||
f"got {det[0]}{'A' if det[1] == 'minor' else 'B'} ({det[2]}, p={det[3]:.2f}) {title[:60]}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
ap.add_argument("folders", nargs="*", type=Path, help="folders of audio files carrying a key tag")
|
||||
ap.add_argument("--giantsteps", type=Path, help="a downloaded giantsteps-key-dataset clone")
|
||||
ap.add_argument("-v", "--verbose", action="store_true", help="list every miss")
|
||||
a = ap.parse_args()
|
||||
if not a.folders and not a.giantsteps:
|
||||
ap.error("give --giantsteps and/or folders")
|
||||
if a.giantsteps:
|
||||
run(giantsteps_refs(a.giantsteps), "GiantSteps key (hand-annotated)", a.verbose)
|
||||
if a.folders:
|
||||
run(folder_refs(a.folders), "Key tags (agreement with another analyser)", a.verbose)
|
||||
sys.exit(0)
|
||||
@@ -0,0 +1,133 @@
|
||||
"""Benchmark Auto Hotcues' structure events against Rekordbox's phrase analysis.
|
||||
|
||||
NOT part of `run_tests.sh`: it needs real audio and a Rekordbox library whose
|
||||
tracks were analysed with phrase analysis on (the `PSSI` tag in each `.EXT`).
|
||||
Read-only — nothing is saved.
|
||||
|
||||
python bench_structure.py # the local Rekordbox library
|
||||
python bench_structure.py -v # per-track events, detected vs reference
|
||||
|
||||
The reference is Rekordbox's own analysis, not ground truth, and it is only
|
||||
comparable on "High"-mood tracks, whose labels map onto what a DJ cues:
|
||||
Intro / Up (build) / Down (breakdown) / Chorus (drop) / Outro. "Mid" tracks are
|
||||
labelled Verse / Chorus / Bridge and are reported separately for that reason.
|
||||
Tracks whose detected BPM is a different octave from Rekordbox's are skipped:
|
||||
their bars are not the same bars.
|
||||
|
||||
Events are compared in bars from each side's own first downbeat:
|
||||
- drop_n = start of the n-th Chorus run;
|
||||
- breakdown_n = end of the n-th drop, when another drop follows;
|
||||
- build_n = the Up run right before drop_n (Rekordbox's Up usually spans the
|
||||
whole pre-drop groove, so this one is indicative at best);
|
||||
- outro = start of the Outro.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
os.environ.setdefault("KONDUKTOR_DATA_DIR", tempfile.mkdtemp(prefix="konduktor-bench-"))
|
||||
|
||||
import konduktor.adapters # noqa: E402,F401 — registers the drivers
|
||||
from konduktor.core import grid_detect, registry, structure # noqa: E402
|
||||
|
||||
DROP = {1: 5, 2: 9} # PSSI kind of a Chorus, by mood (1 = High, 2 = Mid)
|
||||
OUTRO = {1: 6, 2: 10}
|
||||
UP = {1: 2}
|
||||
|
||||
|
||||
def references(db: Path) -> list[dict]:
|
||||
from pyrekordbox.anlz import AnlzFile
|
||||
|
||||
a = registry.open_library(db)
|
||||
out = []
|
||||
try:
|
||||
st = a._store
|
||||
for t in a.tracks:
|
||||
path = a.audio_path(t.id)
|
||||
rel = getattr(st.content(t.id), "AnalysisDataPath", None)
|
||||
if not path or not path.exists() or not rel:
|
||||
continue
|
||||
base = st.path.parent / "share" / str(rel).lstrip("/\\")
|
||||
ext = base.with_suffix(".EXT")
|
||||
if not (base.is_file() and ext.is_file()):
|
||||
continue
|
||||
rec = {"path": str(path), "title": t.title or path.stem}
|
||||
for tag in AnlzFile.parse_file(str(base)).tags:
|
||||
if tag.type == "PQTZ" and len(tag.content.entries): # one-shots have none
|
||||
e = tag.content.entries
|
||||
rec["bpm"] = e[0].tempo / 100
|
||||
rec["first_down"] = next(i for i, x in enumerate(e) if x.beat == 1)
|
||||
for tag in AnlzFile.parse_file(str(ext)).tags:
|
||||
if tag.type == "PSSI":
|
||||
rec["mood"] = tag.content.mood
|
||||
rec["phrases"] = [(x.beat, x.kind) for x in tag.content.entries]
|
||||
if "phrases" in rec and "bpm" in rec:
|
||||
out.append(rec)
|
||||
finally:
|
||||
a.close()
|
||||
return out
|
||||
|
||||
|
||||
def truth(rec: dict) -> dict[str, int]:
|
||||
runs: list[tuple[int, int]] = []
|
||||
for beat, kind in rec["phrases"]:
|
||||
bar = round((beat - 1 - rec["first_down"]) / 4)
|
||||
if not runs or runs[-1][1] != kind:
|
||||
runs.append((bar, kind))
|
||||
m, ev = rec["mood"], {}
|
||||
drops = [i for i, (_, k) in enumerate(runs) if k == DROP.get(m)]
|
||||
for n, i in enumerate(drops, start=1):
|
||||
ev[f"drop_{n}"] = runs[i][0]
|
||||
if n < len(drops) and i + 1 < len(runs):
|
||||
ev[f"breakdown_{n}"] = runs[i + 1][0]
|
||||
if m in UP and i > 0 and runs[i - 1][1] == UP[m]:
|
||||
ev[f"build_{n}"] = runs[i - 1][0]
|
||||
outro = [b for b, k in runs if k == OUTRO.get(m)]
|
||||
if outro:
|
||||
ev["outro"] = outro[0]
|
||||
return ev
|
||||
|
||||
|
||||
def main() -> int:
|
||||
verbose = "-v" in sys.argv
|
||||
args = [a for a in sys.argv[1:] if not a.startswith("-")]
|
||||
db = Path(args[0]) if args else Path.home() / "Library/Pioneer/rekordbox/master.db"
|
||||
refs = references(db)
|
||||
if not refs:
|
||||
print("No tracks with Rekordbox phrase analysis and reachable audio.")
|
||||
return 1
|
||||
|
||||
for mood, label in ((1, "High"), (2, "Mid")):
|
||||
stats: dict[str, list[int]] = {}
|
||||
for rec in (r for r in refs if r["mood"] == mood):
|
||||
g = grid_detect.detect_grid(rec["path"])
|
||||
if abs(g.bpm - rec["bpm"]) >= 1:
|
||||
continue # a different octave: not the same bars
|
||||
st = structure.analyse(rec["path"], [(g.anchor, g.bpm)])
|
||||
det = {k: (v - st.bar0) // 4 for k, v in st.events.items()}
|
||||
tru = truth(rec)
|
||||
if verbose:
|
||||
print(f" {rec['title'][:28]:28} ref {tru}\n {'':28} got { {k: det[k] for k in tru if k in det} }")
|
||||
for e, bar in tru.items():
|
||||
key = e if e in ("drop_1", "drop_2", "breakdown_1", "build_1", "build_2", "outro") else e.split("_")[0] + "_n"
|
||||
s = stats.setdefault(key, [0, 0, 0])
|
||||
s[0] += 1
|
||||
if e in det:
|
||||
s[1] += det[e] == bar
|
||||
s[2] += abs(det[e] - bar) <= 4
|
||||
if not stats:
|
||||
continue
|
||||
print(f"== {label}-mood tracks")
|
||||
for k in sorted(stats):
|
||||
n, exact, near = stats[k]
|
||||
print(f" {k:12} n={n:2} exact bar {exact:2} ({exact / n:4.0%}) within 4 bars {near:2} ({near / n:4.0%})")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,156 @@
|
||||
"""How Traktor's auto-gain relates to Konduktor's loudness measures.
|
||||
|
||||
Traktor stores its gain per ENTRY as `<LOUDNESS ANALYZED_DB>` (its own
|
||||
measurement) and `PERCEIVED_DB` (the gain the deck applies; equal to
|
||||
ANALYZED after Traktor's own analysis — kit G1, 2026-10-19). If Traktor
|
||||
levels toward a fixed reference, `ANALYZED_DB = reference − loudness`, so
|
||||
`ANALYZED_DB + LUFS` is that reference, and its spread is how far Konduktor's
|
||||
measure is from Traktor's.
|
||||
|
||||
python bench_traktor_gain.py FOLDER [--nml collection.nml]
|
||||
|
||||
FOLDER's audio must be in the collection and analysed by Traktor (Gain).
|
||||
A stem file is measured as its four stems SUMMED, as Traktor measures it.
|
||||
|
||||
Result (2026-10-19, 80 MP3 + 40 commercial stem files, Traktor 4.5):
|
||||
ANALYZED_DB = -9.2 - LUFS (free slope 0.99), sd 0.80 dB, |miss| p50 0.56 /
|
||||
p90 1.35; RMS fits worse (sd 1.17); the miss follows nothing measured here
|
||||
(LRA, PLR, true peak, bass weight: |r| < 0.2) — it is Traktor's own measure.
|
||||
Fits LUFS and RMS (slope and fixed-slope), then asks whether what is left
|
||||
over follows something about the music (LRA, PLR, bass weight, format, genre).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import html
|
||||
import re
|
||||
import sys
|
||||
import unicodedata
|
||||
from concurrent.futures import ProcessPoolExecutor
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
DEFAULT_NML = Path.home() / "Documents/Native Instruments/Traktor 4.5.0/collection.nml"
|
||||
|
||||
|
||||
def _key(path: str) -> str:
|
||||
return unicodedata.normalize("NFC", path).casefold()
|
||||
|
||||
|
||||
def traktor_values(nml: Path) -> dict[str, dict]:
|
||||
"""Absolute path (normalised) -> Traktor's LOUDNESS + genre, for analysed entries."""
|
||||
out = {}
|
||||
text = nml.read_text(encoding="utf-8")
|
||||
for e in re.findall(r"<ENTRY .*?</ENTRY>", text, re.S):
|
||||
loc = re.search(r'<LOCATION DIR="([^"]*)" FILE="([^"]*)"', e)
|
||||
loud = re.search(r'<LOUDNESS PEAK_DB="([-\d.]+)" PERCEIVED_DB="([-\d.]+)" ANALYZED_DB="([-\d.]+)"', e)
|
||||
if not (loc and loud):
|
||||
continue
|
||||
path = html.unescape(loc.group(1)).replace("/:", "/") + html.unescape(loc.group(2))
|
||||
genre = re.search(r'<INFO [^>]*GENRE="([^"]*)"', e)
|
||||
out[_key(path)] = {
|
||||
"peak": float(loud.group(1)),
|
||||
"perceived": float(loud.group(2)),
|
||||
"analyzed": float(loud.group(3)),
|
||||
"genre": html.unescape(genre.group(1)) if genre else "",
|
||||
}
|
||||
return out
|
||||
|
||||
|
||||
def _measure(path: str):
|
||||
"""`loudness.measure_file` — which measures a stem file as its four stems
|
||||
summed, as Traktor does (found by this bench: against the mix stream the
|
||||
reference was -6.6, sd 1.18; against the sum -9.3, sd 0.68)."""
|
||||
from konduktor.core import loudness
|
||||
|
||||
try:
|
||||
return path, loudness.measure_file(path)
|
||||
except Exception as e: # an undecodable file is reported, not fatal
|
||||
return path, e
|
||||
|
||||
|
||||
def main() -> None:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("folder", type=Path)
|
||||
ap.add_argument("--nml", type=Path, default=DEFAULT_NML)
|
||||
args = ap.parse_args()
|
||||
|
||||
tk = traktor_values(args.nml)
|
||||
files = sorted(p for p in args.folder.rglob("*") if p.is_file() and not p.name.startswith("."))
|
||||
held = [p for p in files if _key(str(p)) in tk]
|
||||
print(f"{len(files)} files, {len(held)} analysed by Traktor")
|
||||
for p in files:
|
||||
if _key(str(p)) not in tk:
|
||||
print(f" not in the collection / not analysed: {p.name}")
|
||||
|
||||
rows = []
|
||||
with ProcessPoolExecutor(4) as pool: # a stem file holds 4 decoded streams
|
||||
for path, m in pool.map(_measure, [str(p) for p in held]):
|
||||
if m is None or isinstance(m, Exception):
|
||||
print(f" not measured: {Path(path).name}: {m}")
|
||||
continue
|
||||
t = tk[_key(path)]
|
||||
rows.append((Path(path), m, t))
|
||||
|
||||
name = np.array([r[0].name for r in rows])
|
||||
lufs = np.array([r[1].lufs for r in rows])
|
||||
rms = np.array([r[1].rms for r in rows])
|
||||
tp = np.array([r[1].true_peak for r in rows])
|
||||
lra = np.array([r[1].lra for r in rows])
|
||||
plr = np.array([r[1].plr for r in rows])
|
||||
an = np.array([r[2]["analyzed"] for r in rows])
|
||||
pc = np.array([r[2]["perceived"] for r in rows])
|
||||
pk = np.array([r[2]["peak"] for r in rows])
|
||||
fmt = np.array([r[0].suffix.lower() for r in rows])
|
||||
genre = np.array([r[2]["genre"] or "(none)" for r in rows])
|
||||
n = len(rows)
|
||||
|
||||
print(f"\n{n} tracks; LUFS {lufs.min():.1f} .. {lufs.max():.1f}, "
|
||||
f"PERCEIVED == ANALYZED on {int(np.sum(np.isclose(pc, an)))}")
|
||||
|
||||
print("\n== reference = ANALYZED_DB + measure (slope fixed at 1)")
|
||||
for label, v in (("LUFS", lufs), ("RMS", rms)):
|
||||
ref = an + v
|
||||
k, b = np.polyfit(-v, an, 1)
|
||||
free = an - (k * -v + b)
|
||||
q = np.percentile(np.abs(ref - np.median(ref)), [50, 90])
|
||||
print(f" {label:4s}: mean {ref.mean():6.2f} median {np.median(ref):6.2f} sd {ref.std():.2f} "
|
||||
f"|miss| p50 {q[0]:.2f} p90 {q[1]:.2f} (free slope {k:.3f}, sd {free.std():.2f})")
|
||||
|
||||
print("\n== PEAK_DB + true peak (Traktor's peak gain vs our true peak)")
|
||||
d = pk + tp
|
||||
print(f" mean {d.mean():+.2f} sd {d.std():.2f} min {d.min():+.2f} max {d.max():+.2f}")
|
||||
|
||||
ref = an + lufs
|
||||
resid = ref - ref.mean()
|
||||
print("\n== does the LUFS miss follow the music? (correlation with the residual)")
|
||||
bass = rms - lufs # unweighted vs K-weighted: higher = more low end
|
||||
for label, v in (("LRA", lra), ("PLR", plr), ("true peak", tp), ("bass weight (RMS-LUFS)", bass), ("LUFS", lufs)):
|
||||
r = np.corrcoef(v, resid)[0, 1]
|
||||
k = np.polyfit(v, resid, 1)[0]
|
||||
print(f" {label:24s} r = {r:+.2f} slope {k:+.3f} dB per unit")
|
||||
X = np.column_stack([bass, lra, np.ones(n)])
|
||||
coef, *_ = np.linalg.lstsq(X, resid, rcond=None)
|
||||
print(f" bass + LRA together: sd {resid.std():.2f} -> {(resid - X @ coef).std():.2f}")
|
||||
|
||||
print("\n== by format")
|
||||
for f in sorted(set(fmt)):
|
||||
s = fmt == f
|
||||
print(f" {f:5s} n={s.sum():3d} reference mean {ref[s].mean():6.2f} sd {ref[s].std():.2f}")
|
||||
print("\n== by genre (n >= 3)")
|
||||
for g in sorted(set(genre), key=lambda g: -np.sum(genre == g)):
|
||||
s = genre == g
|
||||
if s.sum() >= 3:
|
||||
print(f" {g[:24]:24s} n={s.sum():3d} reference mean {ref[s].mean():6.2f} sd {ref[s].std():.2f}")
|
||||
|
||||
print("\n== largest misses (LUFS)")
|
||||
for i in np.argsort(-np.abs(resid))[:8]:
|
||||
print(f" {resid[i]:+5.2f} LUFS {lufs[i]:6.2f} LRA {lra[i]:4.1f} bass {bass[i]:+5.2f} {genre[i][:14]:14s} {name[i][:50]}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
+17
-10
@@ -1,6 +1,7 @@
|
||||
# Build the frozen backend sidecar on Windows (PyInstaller) and stage it for
|
||||
# Tauri as binaries\konduktor-sidecar-<target-triple>.exe.
|
||||
# Output: backend\dist\konduktor-sidecar.exe + frontend\src-tauri\binaries\...
|
||||
# Build the frozen backend sidecar on Windows (a PyInstaller onedir folder) and
|
||||
# stage it for Tauri as frontend\src-tauri\binaries\konduktor-sidecar\, which
|
||||
# tauri.conf.json bundles as a resource folder (`sidecar\` in the app).
|
||||
# Output: backend\dist\konduktor-sidecar\ + frontend\src-tauri\binaries\konduktor-sidecar\
|
||||
#
|
||||
# Run from a PowerShell prompt with the backend venv's Python on PATH, e.g.:
|
||||
# cd backend
|
||||
@@ -15,13 +16,19 @@ Set-Location $Root
|
||||
$Py = Join-Path $Root ".venv\Scripts\python.exe"
|
||||
if (-not (Test-Path $Py)) { $Py = "python" }
|
||||
|
||||
& $Py -m PyInstaller --noconfirm --clean konduktor-sidecar.spec
|
||||
Write-Host "Built: $Root\dist\konduktor-sidecar.exe"
|
||||
# PyInstaller logs to stderr. Windows PowerShell 5.1 (unlike pwsh 7) turns a
|
||||
# native command's stderr into an error record, which "Stop" makes fatal on the
|
||||
# first INFO line — so relax it for this call and judge by the exit code.
|
||||
$ErrorActionPreference = "Continue"
|
||||
& $Py -m PyInstaller --noconfirm --clean konduktor-sidecar.spec 2>&1 | ForEach-Object { "$_" }
|
||||
$ErrorActionPreference = "Stop"
|
||||
if ($LASTEXITCODE -ne 0) { throw "PyInstaller failed ($LASTEXITCODE)" }
|
||||
Write-Host "Built: $Root\dist\konduktor-sidecar\"
|
||||
|
||||
# Stage for Tauri: name with the host target triple + .exe so the shell plugin
|
||||
# resolves it. (rustc must be on PATH.)
|
||||
$Triple = (& rustc -vV | Select-String '^host: ').ToString().Replace('host: ', '').Trim()
|
||||
# Stage for Tauri, replacing the whole folder so no file from an older build survives.
|
||||
$Dest = Join-Path $Root "..\frontend\src-tauri\binaries"
|
||||
New-Item -ItemType Directory -Force -Path $Dest | Out-Null
|
||||
Copy-Item "$Root\dist\konduktor-sidecar.exe" (Join-Path $Dest "konduktor-sidecar-$Triple.exe") -Force
|
||||
Write-Host "Staged: $Dest\konduktor-sidecar-$Triple.exe"
|
||||
$Staged = Join-Path $Dest "konduktor-sidecar"
|
||||
if (Test-Path $Staged) { Remove-Item -Recurse -Force $Staged }
|
||||
Copy-Item -Recurse "$Root\dist\konduktor-sidecar" $Staged
|
||||
Write-Host "Staged: $Staged\"
|
||||
+20
-15
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build the frozen backend sidecar (single-file binary) with PyInstaller and
|
||||
# stage it for Tauri as binaries/konduktor-sidecar-<target-triple>.
|
||||
# Output: backend/dist/konduktor-sidecar + frontend/src-tauri/binaries/…
|
||||
# Build the frozen backend sidecar (a onedir folder) with PyInstaller and stage
|
||||
# it for Tauri as frontend/src-tauri/binaries/konduktor-sidecar/, which
|
||||
# tauri.conf.json bundles as a resource folder (`sidecar/` in the app).
|
||||
# Output: backend/dist/konduktor-sidecar/ + frontend/src-tauri/binaries/konduktor-sidecar/
|
||||
#
|
||||
# One-time: pip install -r requirements-build.txt (into the backend venv).
|
||||
set -euo pipefail
|
||||
@@ -9,16 +10,20 @@ ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$ROOT"
|
||||
PY="${PY:-.venv/bin/python}"
|
||||
"$PY" -m PyInstaller --noconfirm --clean konduktor-sidecar.spec
|
||||
echo "Built: $ROOT/dist/konduktor-sidecar"
|
||||
echo "Built: $ROOT/dist/konduktor-sidecar/"
|
||||
|
||||
# Stage for Tauri: the sidecar must be named with the host target triple so the
|
||||
# shell plugin can resolve it in both dev and bundle. (rustc must be on PATH.)
|
||||
if command -v rustc >/dev/null 2>&1; then
|
||||
TRIPLE="$(rustc -vV | sed -n 's/host: //p')"
|
||||
DEST="$ROOT/../frontend/src-tauri/binaries"
|
||||
mkdir -p "$DEST"
|
||||
cp "$ROOT/dist/konduktor-sidecar" "$DEST/konduktor-sidecar-$TRIPLE"
|
||||
echo "Staged: $DEST/konduktor-sidecar-$TRIPLE"
|
||||
else
|
||||
echo "warning: rustc not found — skipped staging the Tauri sidecar binary" >&2
|
||||
fi
|
||||
# NOTE: do NOT re-codesign anything in this folder. PyInstaller already ad-hoc
|
||||
# signs the executable AND its collected libraries (Python, the .so/.dylib
|
||||
# files) with a matching identity. Re-signing only some of them desyncs the
|
||||
# Team IDs, so dlopen fails with "different Team IDs" and the sidecar dies on
|
||||
# launch (the app then shows "Konduktor couldn't start"). The app bundle is
|
||||
# ad-hoc signed separately via tauri.conf.json `bundle.macOS.signingIdentity`,
|
||||
# which seals this folder as a resource without re-signing it.
|
||||
|
||||
# Stage for Tauri. Replace the whole folder so no file from an older build
|
||||
# survives; `cp -R` keeps PyInstaller's symlinks as symlinks.
|
||||
DEST="$ROOT/../frontend/src-tauri/binaries"
|
||||
mkdir -p "$DEST"
|
||||
rm -rf "$DEST/konduktor-sidecar"
|
||||
cp -R "$ROOT/dist/konduktor-sidecar" "$DEST/konduktor-sidecar"
|
||||
echo "Staged: $DEST/konduktor-sidecar/"
|
||||
@@ -0,0 +1,321 @@
|
||||
"""Kit G1 — what Traktor 4.5 does with gain (dev only, like dev_stems.py).
|
||||
|
||||
Answers, by measuring in Traktor itself (see
|
||||
.claude/discussions/discuss-gain-normalization-2026-10-19.md, "Kit G1"):
|
||||
|
||||
1. Does a LEVEL change to a file make Traktor re-analyse it (LOUDNESS,
|
||||
BPM/grid, AUDIO_ID)? MP3 by lossless frame gain (same size; + an APE undo
|
||||
tag; + the mtime put back), FLAC re-written exactly, and a control whose
|
||||
mtime alone changes.
|
||||
2. Does Traktor KEEP a LOUDNESS Konduktor writes — on an entry it analysed
|
||||
(AUDIO_ID kept), and on one Konduktor added (AUDIO_ID empty)?
|
||||
3. Which LOUDNESS attribute drives the deck's auto-gain (the three are set
|
||||
to values that cannot be confused)?
|
||||
|
||||
python dev_gain_kit.py prepare # build the kit folder
|
||||
# -> in Traktor: import the folder, analyse, quit
|
||||
python dev_gain_kit.py apply # change the files + write LOUDNESS
|
||||
# -> in Traktor: load each G1 track, note the gain knob, quit
|
||||
python dev_gain_kit.py report # what Traktor changed
|
||||
|
||||
Traktor must be closed for `apply`. The collection is saved through
|
||||
TraktorStore (backup-first, byte-exact render).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
NML = Path.home() / "Documents/Native Instruments/Traktor 4.5.0/collection.nml"
|
||||
KITS = Path.home() / "Music/Konduktor Stem Test"
|
||||
KIT = KITS / "Kit G1"
|
||||
STEPS = -2 # global_gain steps of 2^(1/4): -2 = -3.01 dB
|
||||
|
||||
# name -> (source, what happens at `apply`)
|
||||
FILES = {
|
||||
"G1-A0 control touch.mp3": (KITS / "Kit 2/K2 01 All I Need.mp3", "mtime only"),
|
||||
"G1-A1 mp3 framegain.mp3": (KITS / "Kit 2/K1 01 Abyss of Love - Franky Rizardo Remix.mp3", "frame gain"),
|
||||
"G1-A2 mp3 framegain ape.mp3": (KITS / "Kit 2/K4 Ragga Bomb with Ragga Twins.mp3", "frame gain + APE undo tag"),
|
||||
"G1-A3 flac exact.flac": (KITS / "Kit 4/K4-3 flac.flac", "exact gain, re-written"),
|
||||
"G1-A4 mp3 framegain same mtime.mp3": (KITS / "Kit 4/K4-5 mp3 cbr noxing.mp3", "frame gain, mtime restored"),
|
||||
"G1-B1 loudness written.mp3": (KITS / "Kit 2/K3 01 Motorola.mp3", "LOUDNESS written, AUDIO_ID kept"),
|
||||
}
|
||||
# Added by Konduktor at `apply` (so Traktor never analysed it): AUDIO_ID empty.
|
||||
B2 = ("G1-B2 konduktor added.mp3", KITS / "Kit 4/K4-4 mp3 cbr xing.mp3")
|
||||
|
||||
# Values no real analysis would give, so the deck's knob says which one it read.
|
||||
B1_LOUDNESS = (2.5, -6.0, 6.0) # PEAK_DB, PERCEIVED_DB, ANALYZED_DB
|
||||
B2_LOUDNESS = (2.5, -4.0, 4.0)
|
||||
|
||||
|
||||
# ── MP3 frame gain (mp3gain's edit) ──────────────────────────────────────────
|
||||
|
||||
_BITRATE = {
|
||||
True: [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320],
|
||||
False: [0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160],
|
||||
}
|
||||
_RATE = {3: [44100, 48000, 32000], 2: [22050, 24000, 16000], 0: [11025, 12000, 8000]}
|
||||
|
||||
|
||||
def _get(buf: bytearray, bit: int, n: int) -> int:
|
||||
v = 0
|
||||
for i in range(n):
|
||||
v = (v << 1) | ((buf[(bit + i) >> 3] >> (7 - ((bit + i) & 7))) & 1)
|
||||
return v
|
||||
|
||||
|
||||
def _put(buf: bytearray, bit: int, n: int, v: int) -> None:
|
||||
for i in range(n):
|
||||
b = (v >> (n - 1 - i)) & 1
|
||||
byte, shift = (bit + i) >> 3, 7 - ((bit + i) & 7)
|
||||
buf[byte] = (buf[byte] & ~(1 << shift) & 0xFF) | (b << shift)
|
||||
|
||||
|
||||
def _header(buf: bytearray, pos: int):
|
||||
if pos + 4 > len(buf) or buf[pos] != 0xFF or (buf[pos + 1] & 0xE0) != 0xE0:
|
||||
return None
|
||||
ver, layer = (buf[pos + 1] >> 3) & 3, (buf[pos + 1] >> 1) & 3
|
||||
br_i, sr_i = buf[pos + 2] >> 4, (buf[pos + 2] >> 2) & 3
|
||||
if ver == 1 or layer != 1 or br_i in (0, 15) or sr_i == 3:
|
||||
return None
|
||||
mpeg1 = ver == 3
|
||||
br, sr = _BITRATE[mpeg1][br_i], _RATE[ver][sr_i]
|
||||
pad = (buf[pos + 2] >> 1) & 1
|
||||
length = (144000 if mpeg1 else 72000) * br // sr + pad
|
||||
return {
|
||||
"mpeg1": mpeg1,
|
||||
"crc": (buf[pos + 1] & 1) == 0,
|
||||
"nch": 1 if (buf[pos + 3] >> 6) == 3 else 2,
|
||||
"len": length,
|
||||
}
|
||||
|
||||
|
||||
def _gain_bits(h: dict) -> list[int]:
|
||||
"""Bit offsets (from the side info's start) of every granule's global_gain."""
|
||||
nch = h["nch"]
|
||||
if h["mpeg1"]:
|
||||
start, block, granules = 9 + (5 if nch == 1 else 3) + 4 * nch, 59, 2
|
||||
else:
|
||||
start, block, granules = 8 + (1 if nch == 1 else 2), 63, 1
|
||||
return [start + (g * nch + c) * block + 21 for g in range(granules) for c in range(nch)]
|
||||
|
||||
|
||||
def mp3_frame_gain(path: Path, steps: int) -> int:
|
||||
"""Add `steps` to every audio granule's global_gain in place; returns frames edited."""
|
||||
buf = bytearray(path.read_bytes())
|
||||
pos = 0
|
||||
if buf[:3] == b"ID3":
|
||||
size = (buf[6] << 21) | (buf[7] << 14) | (buf[8] << 7) | buf[9]
|
||||
pos = 10 + size + (10 if buf[5] & 0x10 else 0)
|
||||
frames = 0
|
||||
first = True
|
||||
while (h := _header(buf, pos)) is not None:
|
||||
side = pos + 4 + (2 if h["crc"] else 0)
|
||||
if h["crc"]:
|
||||
raise SystemExit(f"{path.name}: CRC-protected frames are not handled by the kit")
|
||||
side_len = (17 if h["nch"] == 1 else 32) if h["mpeg1"] else (9 if h["nch"] == 1 else 17)
|
||||
tag = bytes(buf[side + side_len : side + side_len + 4])
|
||||
if first and (tag in (b"Xing", b"Info") or bytes(buf[pos + 36 : pos + 40]) == b"VBRI"):
|
||||
pass # the header frame is not audio (Traktor decodes it anyway — leave it as it is)
|
||||
else:
|
||||
for off in _gain_bits(h):
|
||||
g = _get(buf, side * 8 + off, 8) + steps
|
||||
if not 0 <= g <= 255:
|
||||
raise SystemExit(f"{path.name}: global_gain would leave 0..255")
|
||||
_put(buf, side * 8 + off, 8, g)
|
||||
frames += 1
|
||||
first = False
|
||||
pos += h["len"]
|
||||
rest = bytes(buf[pos : pos + 8])
|
||||
if pos < len(buf) - 128 and not rest.startswith((b"TAG", b"APETAGEX", b"LYRICS")):
|
||||
raise SystemExit(f"{path.name}: lost frame sync at {pos} of {len(buf)}")
|
||||
path.write_bytes(buf)
|
||||
return frames
|
||||
|
||||
|
||||
def _decode(path: Path) -> np.ndarray:
|
||||
from konduktor.core import pyav
|
||||
|
||||
out = []
|
||||
with pyav.open_input(path) as c:
|
||||
for frame in c.decode(audio=0):
|
||||
a = frame.to_ndarray()
|
||||
out.append(a if a.ndim == 2 and a.shape[0] <= 2 else a.reshape(1, -1))
|
||||
return np.concatenate(out, axis=1).astype(np.float64)
|
||||
|
||||
|
||||
def _check_gain(before: np.ndarray, after: Path, db: float, what: str) -> None:
|
||||
b = before
|
||||
a = _decode(after)
|
||||
n = min(b.shape[1], a.shape[1])
|
||||
want = 10 ** (db / 20)
|
||||
err = np.max(np.abs(a[:, :n] - b[:, :n] * want)) / max(np.max(np.abs(b)), 1e-9)
|
||||
print(f" {what}: decoded = original x {want:.4f} ({db:+.2f} dB), max error {err:.1e} of peak")
|
||||
if err > 1e-3:
|
||||
raise SystemExit(" gain check FAILED")
|
||||
|
||||
|
||||
def flac_exact_gain(path: Path, db: float) -> None:
|
||||
import soundfile as sf
|
||||
from mutagen.flac import FLAC
|
||||
|
||||
info = sf.info(str(path))
|
||||
data, rate = sf.read(str(path), dtype="float64", always_2d=True)
|
||||
old = FLAC(str(path))
|
||||
tags, pictures = list(old.tags.items()) if old.tags else [], list(old.pictures)
|
||||
tmp = path.with_suffix(".tmp.flac")
|
||||
sf.write(str(tmp), data * 10 ** (db / 20), rate, subtype=info.subtype, format="FLAC")
|
||||
new = FLAC(str(tmp))
|
||||
for k, v in tags:
|
||||
new[k] = v
|
||||
for p in pictures:
|
||||
new.add_picture(p)
|
||||
new.save()
|
||||
tmp.replace(path)
|
||||
|
||||
|
||||
# ── steps ────────────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
def _traktor_running() -> bool:
|
||||
# The executable is "Traktor Pro 4" (an exact "Traktor" never matches).
|
||||
return subprocess.run(["pgrep", "-f", r"Traktor Pro 4\.app/Contents/MacOS/"], capture_output=True).returncode == 0
|
||||
|
||||
|
||||
def prepare() -> None:
|
||||
KIT.mkdir(parents=True, exist_ok=True)
|
||||
for name, (src, what) in FILES.items():
|
||||
shutil.copy2(src, KIT / name)
|
||||
print(f" {name:38s} <- {src.name} [{what} at apply]")
|
||||
print(f"\nKit at {KIT}\n"
|
||||
"Next, in Traktor 4.5:\n"
|
||||
" 1. Preferences > Mixer: note the Autogain setting, and turn ON\n"
|
||||
" 'Set Autogain when Loading Track' (or the nearest wording).\n"
|
||||
" 2. Import the Kit G1 folder; select its 6 tracks; Analyze (Async) > All.\n"
|
||||
" 3. Quit Traktor (it writes the collection on exit).\n"
|
||||
"Then: python dev_gain_kit.py apply")
|
||||
|
||||
|
||||
def _entries(nml_text: str) -> dict[str, str]:
|
||||
out = {}
|
||||
for e in re.findall(r"<ENTRY .*?</ENTRY>", nml_text, re.S):
|
||||
m = re.search(r'<LOCATION [^>]*FILE="(G1-[^"]+)"', e)
|
||||
if m:
|
||||
out[m.group(1)] = e
|
||||
return out
|
||||
|
||||
|
||||
def apply() -> None:
|
||||
if _traktor_running():
|
||||
raise SystemExit("Quit Traktor first.")
|
||||
text = NML.read_text(encoding="utf-8")
|
||||
have = _entries(text)
|
||||
missing = [n for n in FILES if n not in have]
|
||||
if missing:
|
||||
raise SystemExit(f"Not in the collection yet (import + analyse in Traktor): {missing}")
|
||||
unanalysed = [n for n in FILES if "<LOUDNESS" not in have[n] or 'AUDIO_ID=""' in have[n] or "AUDIO_ID" not in have[n]]
|
||||
if unanalysed:
|
||||
raise SystemExit(f"Not analysed by Traktor yet: {unanalysed}")
|
||||
shutil.copy2(NML, KIT / "1-after-traktor-analysed.nml")
|
||||
|
||||
print("Changing files:")
|
||||
for name, (_, what) in FILES.items():
|
||||
p = KIT / name
|
||||
st = p.stat()
|
||||
if what == "mtime only":
|
||||
os.utime(p)
|
||||
print(f" {name}: mtime touched")
|
||||
elif what.startswith("frame gain"):
|
||||
before = _decode(p)
|
||||
n = mp3_frame_gain(p, STEPS)
|
||||
print(f" {name}: {n} frames, {STEPS:+d} steps")
|
||||
_check_gain(before, p, STEPS * 20 * np.log10(2 ** 0.25), "check")
|
||||
if "APE" in what:
|
||||
from mutagen.apev2 import APEv2
|
||||
|
||||
tag = APEv2()
|
||||
tag["MP3GAIN_UNDO"] = f"{-STEPS:+04d},{-STEPS:+04d},N"
|
||||
tag.save(str(p))
|
||||
print(" + APEv2 MP3GAIN_UNDO tag")
|
||||
if "restored" in what:
|
||||
os.utime(p, ns=(st.st_atime_ns, st.st_mtime_ns))
|
||||
print(f" mtime restored, size {'same' if p.stat().st_size == st.st_size else 'CHANGED'}")
|
||||
elif what.startswith("exact"):
|
||||
before = _decode(p)
|
||||
db = STEPS * 20 * np.log10(2 ** 0.25)
|
||||
flac_exact_gain(p, db)
|
||||
print(f" {name}: {db:+.2f} dB, size {st.st_size} -> {p.stat().st_size}")
|
||||
_check_gain(before, p, db, "check")
|
||||
|
||||
from konduktor.adapters.traktor.store import TraktorStore
|
||||
from konduktor.core import folder
|
||||
from traktor_nml_utils.models.collection import Loudnesstype
|
||||
|
||||
shutil.copy2(B2[1], KIT / B2[0])
|
||||
store = TraktorStore(NML)
|
||||
store.add_entry(folder.read_track(KIT / B2[0]), KIT / B2[0])
|
||||
|
||||
def set_loudness(file: str, vals) -> None:
|
||||
for e in store._nml.collection.entry:
|
||||
if e.location is not None and e.location.file == file:
|
||||
e.loudness = Loudnesstype(peak_db=vals[0], perceived_db=vals[1], analyzed_db=vals[2])
|
||||
return
|
||||
raise SystemExit(f"entry {file} not found")
|
||||
|
||||
set_loudness("G1-B1 loudness written.mp3", B1_LOUDNESS)
|
||||
set_loudness(B2[0], B2_LOUDNESS)
|
||||
store.save()
|
||||
shutil.copy2(NML, KIT / "2-after-konduktor-apply.nml")
|
||||
print(f"\nLOUDNESS written: B1 {B1_LOUDNESS}, B2 (added, AUDIO_ID empty) {B2_LOUDNESS}\n"
|
||||
"Next, in Traktor 4.5 (do NOT run Analyze):\n"
|
||||
" 1. Load EACH G1 track into deck A in turn (B1 and B2 first).\n"
|
||||
" For each, note the GAIN knob's value (hover / the readout) and\n"
|
||||
" whether Traktor shows it analysing.\n"
|
||||
" 2. Quit Traktor.\n"
|
||||
"Then: python dev_gain_kit.py report")
|
||||
|
||||
|
||||
_FIELDS = {
|
||||
"AUDIO_ID": r'AUDIO_ID="([^"]*)"',
|
||||
"LOUDNESS": r"<LOUDNESS ([^>]*)>",
|
||||
"TEMPO": r'<TEMPO BPM="([^"]*)"',
|
||||
"GRID": r'<CUE_V2 [^>]*TYPE="4"[^>]*START="([^"]*)"',
|
||||
"MODIFIED": r'MODIFIED_DATE="([^"]*)" MODIFIED_TIME="([^"]*)"',
|
||||
"FILESIZE": r'FILESIZE="([^"]*)"',
|
||||
"LAST_PLAYED": r'LAST_PLAYED="([^"]*)"',
|
||||
}
|
||||
|
||||
|
||||
def report() -> None:
|
||||
if _traktor_running():
|
||||
raise SystemExit("Quit Traktor first (it writes the collection on exit).")
|
||||
shutil.copy2(NML, KIT / "3-after-traktor-load.nml")
|
||||
stages = [
|
||||
("analysed", _entries((KIT / "1-after-traktor-analysed.nml").read_text(encoding="utf-8"))),
|
||||
("applied", _entries((KIT / "2-after-konduktor-apply.nml").read_text(encoding="utf-8"))),
|
||||
("loaded", _entries(NML.read_text(encoding="utf-8"))),
|
||||
]
|
||||
for name in [*FILES, B2[0]]:
|
||||
print(f"\n== {name} [{FILES.get(name, (None, 'added by Konduktor'))[1]}]")
|
||||
for field, rx in _FIELDS.items():
|
||||
vals = []
|
||||
for _, ents in stages:
|
||||
e = ents.get(name)
|
||||
m = re.search(rx, e) if e else None
|
||||
vals.append(" ".join(m.groups()) if m else ("-" if e else "(no entry)"))
|
||||
flag = "" if vals[1] == vals[2] else " <-- CHANGED by Traktor"
|
||||
print(f" {field:11s} analysed: {vals[0][:60]}\n"
|
||||
f" {'':11s} applied: {vals[1][:60]}\n"
|
||||
f" {'':11s} loaded: {vals[2][:60]}{flag}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
{"prepare": prepare, "apply": apply, "report": report}[sys.argv[1] if len(sys.argv) > 1 else "prepare"]()
|
||||
@@ -0,0 +1,336 @@
|
||||
"""Kit G2 — what rekordbox 7 does with auto gain, and whether a stick carries it
|
||||
(dev only; see .claude/discussions/discuss-gain-normalization-2026-10-19.md).
|
||||
|
||||
Already measured without rekordbox open (2026-10-19, 19 local tracks):
|
||||
`djmdMixerParam.Gain{High,Low}` are the halves of a big-endian float32, LINEAR,
|
||||
= 10^((-10 - LUFS)/20) to 0.13 dB — rekordbox levels integrated BS.1770
|
||||
loudness to -10 LUFS. `Peak{High,Low}` = the linear SAMPLE peak.
|
||||
|
||||
Every SONG in the local library was added by Konduktor (2026-10-01), whose
|
||||
rekordbox add writes no MixerParam row — so the fit above is rekordbox's
|
||||
sample pack only. This kit asks rekordbox itself:
|
||||
A. A track with NO row: does loading it create one (R2, R3)?
|
||||
B. After rekordbox analyses the songs: is the gain -10 - LUFS on music too?
|
||||
C. Is a gain Konduktor writes KEPT (R1 at -20 dB)?
|
||||
D. Does a USB export carry the gain anywhere a CDJ reads (OneLibrary
|
||||
exportLibrary.db, export.pdb, the ANLZ files)? R1-R3 are exported twice
|
||||
with different gains and the two exports diffed.
|
||||
|
||||
python dev_gain_kit_g2.py prepare # records state; writes nothing
|
||||
# A -> rekordbox: Auto Gain on, load R2 + R3, quit
|
||||
python dev_gain_kit_g2.py status
|
||||
# B -> rekordbox: Analyze the 7 songs, quit
|
||||
python dev_gain_kit_g2.py status
|
||||
python dev_gain_kit_g2.py write # R1 -> -20 dB
|
||||
# C -> rekordbox: load R1, export R1-R3 to a stick, quit
|
||||
python dev_gain_kit_g2.py check1 /Volumes/STICK
|
||||
python dev_gain_kit_g2.py flip
|
||||
# D -> rekordbox: remove R1-R3 from the stick, export again, quit
|
||||
python dev_gain_kit_g2.py check2 /Volumes/STICK
|
||||
python dev_gain_kit_g2.py restore # R1-R3 back to rekordbox's own gains
|
||||
|
||||
rekordbox must be closed whenever this script runs. The local master.db is written directly (it is disposable — but `prepare`
|
||||
records every row it touches and `restore` puts them back).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import math
|
||||
import shutil
|
||||
import sqlite3
|
||||
import struct
|
||||
import sys
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
KIT = Path.home() / "Music/Konduktor Stem Test/Kit G2"
|
||||
STATE = KIT / "state.json"
|
||||
|
||||
FLIP = {"R1": -8.0, "R2": +6.0, "R3": -14.0} # export 2's gains
|
||||
|
||||
|
||||
def _halves(x: float) -> tuple[int, int]:
|
||||
bits = struct.unpack(">I", struct.pack(">f", x))[0]
|
||||
return bits >> 16, bits & 0xFFFF
|
||||
|
||||
|
||||
def _value(hi, lo) -> float | None:
|
||||
if hi is None or lo is None:
|
||||
return None
|
||||
return struct.unpack(">f", struct.pack(">I", ((hi & 0xFFFF) << 16) | (lo & 0xFFFF)))[0]
|
||||
|
||||
|
||||
def _db_str(lin: float | None) -> str:
|
||||
return "—" if lin is None else ("-inf" if lin <= 0 else f"{20 * math.log10(lin):+.2f} dB")
|
||||
|
||||
|
||||
def _db():
|
||||
from pyrekordbox import masterdb
|
||||
|
||||
from konduktor.adapters.rekordbox.store import rekordbox_probe_suppressed
|
||||
from pyrekordbox.masterdb import database as rb_database
|
||||
|
||||
if rb_database.get_rekordbox_pid():
|
||||
raise SystemExit("Quit rekordbox first.")
|
||||
return masterdb.MasterDatabase(), rekordbox_probe_suppressed
|
||||
|
||||
|
||||
def _row(db, content_id):
|
||||
from pyrekordbox.masterdb import models
|
||||
|
||||
return db.query(models.DjmdMixerParam).filter_by(ContentID=content_id).one_or_none()
|
||||
|
||||
|
||||
def _snapshot_row(r) -> dict | None:
|
||||
if r is None:
|
||||
return None
|
||||
return {c: getattr(r, c) for c in ("ID", "ContentID", "GainHigh", "GainLow", "PeakHigh", "PeakLow", "UUID")} | {
|
||||
"created_at": str(r.created_at), "updated_at": str(r.updated_at)}
|
||||
|
||||
|
||||
def _set_gain(db, content_id: str, db_gain: float) -> None:
|
||||
r = _row(db, content_id)
|
||||
r.GainHigh, r.GainLow = _halves(10 ** (db_gain / 20))
|
||||
|
||||
|
||||
SONGS = {"R1": "Faith in You - AC Slater Remix", "R2": "Low Frequency", "R3": "Never Let You Go"} # unlocked: a locked track cannot be analysed
|
||||
|
||||
|
||||
def prepare() -> None:
|
||||
"""Record the kit's songs, their LUFS and their MixerParam rows. Writes nothing:
|
||||
every song in this library was added by Konduktor and has NO MixerParam row."""
|
||||
from konduktor.core import loudness
|
||||
|
||||
db, _ = _db()
|
||||
state = {"tracks": {}, "songs": {}, "created": datetime.now().isoformat()}
|
||||
KIT.mkdir(parents=True, exist_ok=True)
|
||||
for c in db.get_content().all():
|
||||
if (c.Length or 0) < 120 or not Path(c.FolderPath or "").is_file():
|
||||
continue
|
||||
m = loudness.measure_file(c.FolderPath)
|
||||
entry = {"content_id": c.ID, "title": c.Title, "artist": c.Artist.Name if c.Artist else "",
|
||||
"path": c.FolderPath, "lufs": m.lufs if m else None, "true_peak": m.true_peak if m else None,
|
||||
"original": _snapshot_row(_row(db, c.ID))}
|
||||
state["songs"][c.Title] = entry
|
||||
for name, title in SONGS.items():
|
||||
if title == c.Title:
|
||||
state["tracks"][name] = entry
|
||||
STATE.write_text(json.dumps(state, indent=2))
|
||||
status()
|
||||
print("\nNext, in rekordbox 7 (step A — a track with NO MixerParam row):\n"
|
||||
" 1. Preferences > Controller > Mixer tab > Auto Gain: Enable.\n"
|
||||
f" 2. PERFORMANCE mode: load '{SONGS['R2']}', open the deck's GRID EDIT panel and\n"
|
||||
f" note its Auto Gain value (or that it is blank); then '{SONGS['R3']}'.\n"
|
||||
" (No Performance mode: EXPORT mode, DUAL PLAYER layout, the AUTO GAIN knob.)\n"
|
||||
" Do NOT run Analyze and do NOT turn the knob (a manual change is saved).\n"
|
||||
" 3. Quit rekordbox.\n"
|
||||
"Then: python dev_gain_kit_g2.py status")
|
||||
|
||||
|
||||
def status() -> None:
|
||||
"""Every song's MixerParam row now, against -10 - LUFS."""
|
||||
db, _ = _db()
|
||||
state = json.loads(STATE.read_text())
|
||||
print("== songs: MixerParam now (expected if rekordbox levels to -10 LUFS)")
|
||||
for title, t in state["songs"].items():
|
||||
r = _row(db, t["content_id"])
|
||||
want = f"{-10 - t['lufs']:+.2f} dB" if t["lufs"] is not None else "?"
|
||||
if r is None:
|
||||
print(f" {title[:34]:34s} no row (expect {want})")
|
||||
else:
|
||||
g, pk = _value(r.GainHigh, r.GainLow), _value(r.PeakHigh, r.PeakLow)
|
||||
print(f" {title[:34]:34s} gain {_db_str(g):>10s} peak {_db_str(pk):>10s} (expect {want}; "
|
||||
f"true peak {t['true_peak']:+.2f}; updated {r.updated_at})")
|
||||
|
||||
|
||||
def write() -> None:
|
||||
"""Step C: R1's gain set to -20 dB (it must have a row: run after rekordbox analysed it)."""
|
||||
db, suppressed = _db()
|
||||
state = json.loads(STATE.read_text())
|
||||
for name, t in state["tracks"].items():
|
||||
t["before_write"] = _snapshot_row(_row(db, t["content_id"]))
|
||||
if state["tracks"]["R1"]["before_write"] is None:
|
||||
raise SystemExit("R1 has no MixerParam row yet — analyse it in rekordbox first.")
|
||||
_set_gain(db, state["tracks"]["R1"]["content_id"], -20.0)
|
||||
with suppressed():
|
||||
db.commit(autoinc=True)
|
||||
STATE.write_text(json.dumps(state, indent=2))
|
||||
print(f"R1 '{SONGS['R1']}' gain written -20.0 dB.\n"
|
||||
"Next, in rekordbox 7 (step C):\n"
|
||||
" 1. Load R1 and read GRID EDIT > Auto Gain (or the DUAL PLAYER AUTO GAIN\n"
|
||||
" knob): -20 dB = kept, ~+4.5 dB = recomputed. Do NOT run Analyze.\n"
|
||||
f" 2. Export R1, R2, R3 ('{SONGS['R1']}', '{SONGS['R2']}', '{SONGS['R3']}') to a USB stick.\n"
|
||||
" 3. Quit rekordbox.\n"
|
||||
"Then: python dev_gain_kit_g2.py check1 /Volumes/<STICK>")
|
||||
|
||||
|
||||
def _rows_now(db, state) -> dict:
|
||||
return {name: _snapshot_row(_row(db, t["content_id"])) for name, t in state["tracks"].items()}
|
||||
|
||||
|
||||
def _snapshot_stick(stick: Path, dest: Path) -> None:
|
||||
rb = stick / "PIONEER/rekordbox"
|
||||
if not rb.is_dir():
|
||||
raise SystemExit(f"No PIONEER/rekordbox on {stick}")
|
||||
if dest.exists():
|
||||
shutil.rmtree(dest)
|
||||
shutil.copytree(rb, dest / "rekordbox", ignore=shutil.ignore_patterns("*-shm", "*-wal"))
|
||||
shutil.copytree(stick / "PIONEER/USBANLZ", dest / "USBANLZ")
|
||||
|
||||
|
||||
def _report_rows(label: str, rows: dict, state: dict) -> None:
|
||||
print(f"\n== master.db MixerParam {label}")
|
||||
for name, r in rows.items():
|
||||
t = state["tracks"][name]
|
||||
orig = t.get("before_write") or t["original"] or {}
|
||||
if r is None:
|
||||
print(f" {name}: no row")
|
||||
continue
|
||||
g, pk = _value(r["GainHigh"], r["GainLow"]), _value(r["PeakHigh"], r["PeakLow"])
|
||||
same_id = "same row" if r["ID"] == orig.get("ID") else "NEW row"
|
||||
print(f" {name}: gain {_db_str(g)}, peak {_db_str(pk)} ({same_id}, updated {r['updated_at']})")
|
||||
|
||||
|
||||
def check1(stick: str) -> None:
|
||||
db, _ = _db()
|
||||
state = json.loads(STATE.read_text())
|
||||
rows = _rows_now(db, state)
|
||||
state["after_load"] = rows
|
||||
STATE.write_text(json.dumps(state, indent=2))
|
||||
_report_rows("after rekordbox loaded + exported (R1 written -20 dB)", rows, state)
|
||||
_snapshot_stick(Path(stick), KIT / "stick-1")
|
||||
print(f"\nStick snapshot: {KIT / 'stick-1'}\nThen: python dev_gain_kit_g2.py flip")
|
||||
|
||||
|
||||
def flip() -> None:
|
||||
db, suppressed = _db()
|
||||
state = json.loads(STATE.read_text())
|
||||
for name, g in FLIP.items():
|
||||
_set_gain(db, state["tracks"][name]["content_id"], g)
|
||||
with suppressed():
|
||||
db.commit(autoinc=True)
|
||||
print("Gains for export 2: " + ", ".join(f"{n} {g:+.1f} dB" for n, g in FLIP.items()) +
|
||||
"\n"
|
||||
"Next, in rekordbox 7:\n"
|
||||
" 1. In the stick's browser, remove R1, R2, R3 from the device.\n"
|
||||
" 2. Export R1, R2, R3 to the stick again.\n"
|
||||
" 3. Quit rekordbox.\n"
|
||||
"Then: python dev_gain_kit_g2.py check2 /Volumes/<STICK>")
|
||||
|
||||
|
||||
def _onelibrary_rows(snap: Path, titles: list[str]) -> dict:
|
||||
import sqlcipher3.dbapi2 as sqlcipher
|
||||
from pyrekordbox.onelibrary.database import BLOB
|
||||
from pyrekordbox.utils import deobfuscate
|
||||
|
||||
db = snap / "rekordbox/exportLibrary.db"
|
||||
if not db.is_file():
|
||||
return {}
|
||||
con = sqlcipher.connect(str(db))
|
||||
con.execute(f"PRAGMA key='{deobfuscate(BLOB)}'")
|
||||
cols = [r[1] for r in con.execute("PRAGMA table_info(content)")]
|
||||
out = {}
|
||||
for row in con.execute("SELECT * FROM content"):
|
||||
d = dict(zip(cols, row))
|
||||
if d.get("title") in titles:
|
||||
out[d["title"]] = d
|
||||
con.close()
|
||||
return out
|
||||
|
||||
|
||||
def _pdb_rows(snap: Path, titles: list[str]) -> dict:
|
||||
from konduktor.adapters.rekordbox import pdb
|
||||
|
||||
f = snap / "rekordbox/export.pdb"
|
||||
if not f.is_file():
|
||||
return {}
|
||||
buf = f.read_bytes()
|
||||
out = {}
|
||||
for row in pdb.table_rows(buf, pdb.TRACKS):
|
||||
fields, strings = pdb.track_fields(row)
|
||||
if strings.get("title") in titles:
|
||||
out[strings["title"]] = (row[: pdb.track_extent(row)], fields, strings)
|
||||
return out
|
||||
|
||||
|
||||
def _anlz(snap: Path, rel: str | None) -> dict:
|
||||
from konduktor.adapters.rekordbox import anlz_file
|
||||
|
||||
out = {}
|
||||
if not rel:
|
||||
return out
|
||||
base = snap / "USBANLZ" / Path(rel.lstrip("/")).relative_to("PIONEER/USBANLZ")
|
||||
for ext in (".DAT", ".EXT", ".2EX"):
|
||||
p = base.with_suffix(ext)
|
||||
if p.is_file():
|
||||
tags, seen = {}, {}
|
||||
for t in anlz_file.parse_file(p).tags: # PCOB / PCO2 come twice (hot, memory)
|
||||
seen[t.type] = seen.get(t.type, 0) + 1
|
||||
tags[f"{t.type}#{seen[t.type]}"] = t.data
|
||||
out[ext] = tags
|
||||
return out
|
||||
|
||||
|
||||
def check2(stick: str) -> None:
|
||||
db, _ = _db()
|
||||
state = json.loads(STATE.read_text())
|
||||
rows = _rows_now(db, state)
|
||||
_report_rows("before export 2 (flip), as rekordbox left it", rows, state)
|
||||
_snapshot_stick(Path(stick), KIT / "stick-2")
|
||||
titles = [t["title"] for t in state["tracks"].values()]
|
||||
s1, s2 = KIT / "stick-1", KIT / "stick-2"
|
||||
|
||||
print("\n== OneLibrary content rows: columns that differ between export 1 and 2")
|
||||
a, b = _onelibrary_rows(s1, titles), _onelibrary_rows(s2, titles)
|
||||
ids = {"content_id", "analysisDataFilePath", "image_id", "path", "dateAdded"}
|
||||
for title in titles:
|
||||
if title not in a or title not in b:
|
||||
print(f" {title}: missing in an export ({title in a}, {title in b})")
|
||||
continue
|
||||
diff = {k: (a[title][k], b[title][k]) for k in a[title] if a[title][k] != b[title].get(k)}
|
||||
print(f" {title[:40]}: {diff or 'identical'}")
|
||||
|
||||
print("\n== export.pdb track rows: fields / bytes that differ")
|
||||
a, b = _pdb_rows(s1, titles), _pdb_rows(s2, titles)
|
||||
for title in titles:
|
||||
if title not in a or title not in b:
|
||||
print(f" {title}: missing in a pdb ({title in a}, {title in b})")
|
||||
continue
|
||||
fa, fb = a[title][1], b[title][1]
|
||||
diff = {k: (fa[k], fb[k]) for k in fa if fa[k] != fb.get(k)}
|
||||
sdiff = {k: (a[title][2][k], b[title][2][k]) for k in a[title][2] if a[title][2][k] != b[title][2].get(k)}
|
||||
print(f" {title[:40]}: fields {diff or 'identical'}; strings {sdiff or 'identical'}")
|
||||
|
||||
print("\n== ANLZ tags that differ")
|
||||
oa, ob = _onelibrary_rows(s1, titles), _onelibrary_rows(s2, titles)
|
||||
for title in titles:
|
||||
ta = _anlz(s1, (oa.get(title) or {}).get("analysisDataFilePath"))
|
||||
tb = _anlz(s2, (ob.get(title) or {}).get("analysisDataFilePath"))
|
||||
changed = [f"{ext}:{k}" for ext in ta for k in ta[ext] if ta[ext][k] != tb.get(ext, {}).get(k)]
|
||||
missing = [f"{ext}:{k}" for ext in tb for k in tb[ext] if k not in ta.get(ext, {})]
|
||||
print(f" {title[:40]}: changed {changed or 'none'}; new {missing or 'none'}")
|
||||
print("\nThen: python dev_gain_kit_g2.py restore")
|
||||
|
||||
|
||||
def restore() -> None:
|
||||
"""R1 and R3 back to the gain rekordbox computed (their rows before `write`)."""
|
||||
db, suppressed = _db()
|
||||
state = json.loads(STATE.read_text())
|
||||
for name, t in state["tracks"].items():
|
||||
o, r = t.get("before_write"), _row(db, t["content_id"])
|
||||
if o and r is not None:
|
||||
r.GainHigh, r.GainLow, r.PeakHigh, r.PeakLow = o["GainHigh"], o["GainLow"], o["PeakHigh"], o["PeakLow"]
|
||||
with suppressed():
|
||||
db.commit(autoinc=True)
|
||||
print("R1-R3 gains restored to rekordbox's own values.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
cmd = sys.argv[1] if len(sys.argv) > 1 else "prepare"
|
||||
fn = {"prepare": prepare, "status": status, "write": write, "check1": check1, "flip": flip,
|
||||
"check2": check2, "restore": restore}[cmd]
|
||||
fn(*sys.argv[2:])
|
||||
@@ -0,0 +1,129 @@
|
||||
"""DEV ONLY — convert audio files to stem files with an UNFROZEN engine.
|
||||
|
||||
Not shipped, not in run_tests.sh. It exists so real stem files can be made (and
|
||||
checked in Traktor) before the frozen engine and its download exist: the stem
|
||||
writer (`core/stem_file.py`) runs here in the backend venv, and the separation
|
||||
runs in any Python that has torch + demucs, through the engine's own one-shot
|
||||
CLI — the same raw-f32 exchange the batch will use.
|
||||
|
||||
python dev_stems.py --engine-python ~/demucs-venv/bin/python \\
|
||||
--weights ~/.cache/huggingface/hub/models--adefossez--HTDemucs-ft/snapshots/<rev> \\
|
||||
[--out-dir DIR] [--device auto] FILE...
|
||||
|
||||
Each FILE becomes `<name>.stem.m4a` beside it (or in --out-dir); an existing
|
||||
target is skipped, never overwritten.
|
||||
|
||||
With `--collection NML` it also does what the batch will do at its end: park
|
||||
each original (`.<name>.konduktor-parked`, beside it), repoint the collection
|
||||
entry that names it at the stem file (`apply_stem_swaps`), and SAVE — after
|
||||
copying the collection into its `backups/` folder. Traktor must be closed.
|
||||
`--keep-audio-id` keeps Traktor's analysis fingerprint on the swapped entries
|
||||
(the milestone-2 check compares kept vs cleared).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
|
||||
warnings.filterwarnings("ignore")
|
||||
|
||||
import numpy as np # noqa: E402
|
||||
|
||||
from konduktor.core import stem_file as sf # noqa: E402
|
||||
|
||||
ENGINE_DIR = Path(__file__).resolve().parents[1] / "engine"
|
||||
|
||||
|
||||
def engine_separator(python: str, weights: str, device: str):
|
||||
def separate(pcm: np.ndarray) -> list[np.ndarray]:
|
||||
with tempfile.TemporaryDirectory(prefix="konduktor-dev-stems-") as d:
|
||||
mix = Path(d) / "mix.f32"
|
||||
np.ascontiguousarray(pcm, dtype=np.float32).tofile(mix)
|
||||
cmd = [python, "-m", "konduktor_engine", "separate", "--input", str(mix),
|
||||
"--samples", str(pcm.shape[1]), "--output-dir", str(Path(d) / "out"),
|
||||
"--weights", weights, "--device", device]
|
||||
proc = subprocess.Popen(cmd, cwd=ENGINE_DIR, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.DEVNULL, text=True)
|
||||
last = None
|
||||
for line in proc.stdout:
|
||||
msg = json.loads(line)
|
||||
if msg["event"] == "progress":
|
||||
print(f"\r separating {msg['fraction'] * 100:5.1f} %", end="", flush=True)
|
||||
last = msg
|
||||
proc.wait()
|
||||
print()
|
||||
if not last or last["event"] != "done":
|
||||
raise sf.StemFileError(f"engine failed: {last}")
|
||||
return [np.fromfile(Path(d) / "out" / f"{name}.f32", dtype=np.float32).reshape(2, -1)
|
||||
for name in sf.DEMUCS_ORDER]
|
||||
return separate
|
||||
|
||||
|
||||
def main() -> int:
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--engine-python", required=True)
|
||||
ap.add_argument("--weights", required=True)
|
||||
ap.add_argument("--out-dir")
|
||||
ap.add_argument("--device", default="auto")
|
||||
ap.add_argument("--collection")
|
||||
ap.add_argument("--keep-audio-id", action="store_true")
|
||||
ap.add_argument("files", nargs="+")
|
||||
args = ap.parse_args()
|
||||
separate = engine_separator(args.engine_python, args.weights, args.device)
|
||||
adapter = None
|
||||
swaps = []
|
||||
if args.collection:
|
||||
if subprocess.run(["pgrep", "-x", "Traktor"], capture_output=True).returncode == 0:
|
||||
print("Traktor is running — close it first (it rewrites the collection on exit).")
|
||||
return 1
|
||||
from konduktor.adapters.traktor.adapter import TraktorAdapter
|
||||
adapter = TraktorAdapter(Path(args.collection))
|
||||
adapter.store._KEEP_AUDIO_ID_ON_STEM = args.keep_audio_id
|
||||
by_path = {str(adapter.audio_path(t.id)): t.id for t in adapter.tracks}
|
||||
for f in (Path(x).expanduser().absolute() for x in args.files):
|
||||
target = (Path(args.out_dir) if args.out_dir else f.parent) / sf.stem_target_name(f.name)
|
||||
if target.exists():
|
||||
print(f"skip (exists): {target}")
|
||||
continue
|
||||
partial = target.with_name(target.name + ".konduktor-partial")
|
||||
t0 = time.time()
|
||||
print(f"{f.name}")
|
||||
try:
|
||||
written = sf.build(f, partial, separate)
|
||||
except Exception:
|
||||
partial.unlink(missing_ok=True)
|
||||
raise
|
||||
os.replace(partial, target)
|
||||
print(f" -> {target.name} {written.duration:.0f} s, {written.bit_rate // 1000} kbps x5, "
|
||||
f"{written.size / 1e6:.1f} MB, {time.time() - t0:.0f} s")
|
||||
if adapter is not None:
|
||||
from konduktor.core.adapter import StemSwap
|
||||
tid = by_path.get(str(f))
|
||||
if tid is None:
|
||||
print(f" (not in the collection: {f})")
|
||||
continue
|
||||
parked = f.with_name(f".{f.name}.konduktor-parked")
|
||||
os.replace(f, parked)
|
||||
swaps.append(StemSwap(tid, target, "repoint", parked, written.bit_rate,
|
||||
written.duration, written.size))
|
||||
if adapter is not None and swaps:
|
||||
import shutil
|
||||
nml = Path(args.collection)
|
||||
backups = nml.parent / "backups"
|
||||
backups.mkdir(exist_ok=True)
|
||||
shutil.copy2(nml, backups / f"{nml.name}.{time.strftime('%Y%m%d-%H%M%S')}.dev-stems.bak")
|
||||
res = adapter.apply_stem_swaps(swaps)
|
||||
adapter.save()
|
||||
print(f"swapped {len(res.renamed)} entries; clamped: {res.clamped or 'none'}; saved {nml}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,32 @@
|
||||
# Goober: a rekordbox-written stick, before and after rekordbox edited it
|
||||
|
||||
The stick Ben keeps for measuring the Pioneer formats, as rekordbox 7 left it:
|
||||
11 tracks, 2 playlists, **both** libraries (`exportLibrary.db` and the legacy
|
||||
`export.pdb` + `exportExt.pdb`). `test_onelibrary_anlz.py`,
|
||||
`test_onelibrary_pdb.py` and `test_onelibrary_tracks.py` run against copies of it.
|
||||
|
||||
## What is here
|
||||
|
||||
- `PIONEER/rekordbox/` holds the three databases, **untouched**: bytes rekordbox
|
||||
wrote (snapshot `s0`, 2026-10-01).
|
||||
- `PIONEER/USBANLZ/` holds every track's `.DAT` and `.EXT`, trimmed by dropping
|
||||
whole tags: only `PPTH`, `PQTZ`, `PCOB`, `PCO2` and `PQT2` are kept, byte for
|
||||
byte. The waveforms are gone, and so are the `.2EX` files.
|
||||
- `after/` holds the same tags after **rekordbox 7 itself** edited the stick
|
||||
(snapshot `s1`, one edit per track):
|
||||
- `black-bloc-recoloured.EXT`: pad C recoloured to `0x2D` `#FF0045`.
|
||||
- `wtf-87bpm.DAT` / `.EXT`: "Result – WTF" changed from 174 to 87 BPM.
|
||||
- `demo2-pad-e-added.EXT`: a hot cue added on pad E of "Demo Track 2".
|
||||
|
||||
There is no audio. The adapter resolves paths and never needs the files, so the
|
||||
time base falls back to rekordbox's MP3 default, the same offset for reading and
|
||||
writing.
|
||||
|
||||
## Why
|
||||
|
||||
Konduktor's edits are pinned against what rekordbox wrote for the SAME edit, not
|
||||
against Konduktor's own reader. A recolour and a grid edit must reproduce
|
||||
rekordbox's bytes exactly (colour bytes, the blanked `PQT2`, loop beats cleared).
|
||||
The pdb tests prove that an in-place edit of a rekordbox-written `export.pdb`
|
||||
leaves everything else as rekordbox wrote it. The full diff of the measurement is
|
||||
in `.claude/discussions/discuss-onelibrary-editing-2026-10-01.md`.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,38 @@
|
||||
# Memory-cue edits rekordbox 7 made on a stick
|
||||
|
||||
Analysis files of six tracks on a OneLibrary test stick written by
|
||||
rekordbox, before and after **rekordbox 7 itself** edited their MEMORY cues
|
||||
(kit M2, 2026-10-16; the stick was backed up first and restored afterwards).
|
||||
`test_onelibrary_anlz.py` replays each edit with Konduktor's helpers on
|
||||
`before/` and compares the memory lists with `after/` byte for byte.
|
||||
|
||||
Only `PPTH`, `PQTZ`, `PCOB`, `PCO2` and `PQT2` are kept, byte for byte — the
|
||||
waveforms were dropped, as in `onelibrary-goober/`. There is no database and
|
||||
no audio: `exportLibrary.db` and both pdbs had NO row change for any of these
|
||||
edits (memory cues on a stick live only in the analysis files).
|
||||
|
||||
| File | Track | Edit (one per track) |
|
||||
|---|---|---|
|
||||
| `black-bloc` | Justin Hawkes – Black Bloc (VIP) | memory cue ADDED at 2:11.206 |
|
||||
| `formula` | RL Grime & Juelz – Formula (IMANU Remix) | 4-beat memory LOOP added at 1:20.378 |
|
||||
| `lift-it` | Tian – Lift It (Hexa Remix) | 8 memory cues added (2 → 10, the cap) |
|
||||
| `wtf` | Result – WTF (Phace Remix) | the memory loop at 1:53 recoloured Blue |
|
||||
| `sell-my-soul` | Bensley, Justin Hawkes & Kumarion – Sell My Soul | comment "Loopy" on the memory loop at 1:18 |
|
||||
| `doomed` | Nemean – Doomed | the memory loop at 2:01 DELETED |
|
||||
|
||||
What they show (the full write-up is in
|
||||
`.claude/discussions/discuss-memory-cues-2026-10-16.md`, kit M2):
|
||||
- `.DAT` `PCOB` memory list: a new entry is PREPENDED; every entry has status 0
|
||||
and bytes 24–27 = previous / next index in the list (`ffff` at the ends), so
|
||||
any add or delete relinks the whole list; the header i32 at offset 20 is
|
||||
count − 1.
|
||||
- `.EXT` `PCO2` memory list: a new entry is APPENDED in rekordbox's compact
|
||||
44-byte form; the others stay byte-identical. The `.EXT`'s `PCOB` memory list
|
||||
stays empty.
|
||||
- When rekordbox rewrites a `.DAT` (any memory add or delete), it ALSO
|
||||
re-sorts the untouched hot-cue `PCOB` into ascending pad order (an export
|
||||
writes it highest pad first); the entries themselves are unchanged.
|
||||
Konduktor changes only the list it edits, so the test compares that tag's
|
||||
entries regardless of order.
|
||||
- Colour: `PCP2` byte 28, 1-based (Blue = 7), 0 = none. Comment: UTF-16BE + NUL
|
||||
at byte 44, `len_comment` at 40. Neither touches the `.DAT`.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
placeholder
|
||||
@@ -0,0 +1 @@
|
||||
placeholder
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,71 @@
|
||||
# OneLibrary fixture drive
|
||||
|
||||
A real OneLibrary USB export, trimmed to the size of a test fixture. This is the
|
||||
drive `test_onelibrary_adapter.py` runs against, so the suite needs no USB stick
|
||||
plugged in and gives the same answer on every machine.
|
||||
|
||||
Produced by rekordbox 7.2.18 exporting a two-track playlist to an exFAT stick.
|
||||
**Nothing in the database was written or edited by Konduktor** — it is the bytes
|
||||
rekordbox itself wrote, which is the whole point of a fixture whose job is to
|
||||
prove we read the real format correctly.
|
||||
|
||||
## What was changed
|
||||
|
||||
Only the analysis files, and only by deleting whole tags:
|
||||
|
||||
| File | Original | Here |
|
||||
|---|---|---|
|
||||
| `ANLZ0000.DAT` | 4,972 B | 2,812 B |
|
||||
| `ANLZ0000.EXT` | 85,602 B | 732 B |
|
||||
|
||||
`PPTH`, `PQTZ`, `PCOB` and `PCO2` — the path, the beatgrid and the two cue lists,
|
||||
i.e. everything the adapter reads — are kept **byte for byte**. The waveform tags
|
||||
(`PWAV`, `PWV2`–`PWV5`) are dropped, which is where ~99% of the `.EXT` went, and
|
||||
the `.2EX` files are omitted entirely.
|
||||
|
||||
The trim is byte-level tag surgery, rewriting only the `PMAI` header's file
|
||||
length: `pyrekordbox` cannot rebuild a file containing cue tags, so re-serialising
|
||||
was not an option.
|
||||
|
||||
The two `.mp3` files are **placeholders**, not audio. The adapter resolves paths
|
||||
and never opens them; carrying 12 MB of demo tracks in the repo to prove that
|
||||
would be silly.
|
||||
|
||||
## What is in it
|
||||
|
||||
- 2 tracks, one of which (`Demo Track 1`) carries a **flexible multi-tempo grid**
|
||||
(128.00 BPM to 60 s, then 90.00 BPM) — the awkward case, deliberately.
|
||||
- 4 hot cues plus a looped memory cue on that track, including one on pad **D**,
|
||||
which is the cue that lives only in the `.EXT` and that a reader looking at the
|
||||
`.DAT` alone would lose.
|
||||
- 1 playlist, `demos`, holding both tracks in order.
|
||||
|
||||
`Demo Track 1`'s title still reads `[KONDUKTOR WROTE THIS]` because the grid and
|
||||
title were written into `master.db` by Konduktor before the export. That is
|
||||
incidental to the fixture, but it does record that the whole chain — Konduktor →
|
||||
`master.db` → rekordbox's OneLibrary export → this file — preserved them.
|
||||
|
||||
## schema.sql
|
||||
|
||||
The complete `CREATE TABLE` set for a OneLibrary database, all 22 tables,
|
||||
extracted from Traktor Pro 4.5's binary, which embeds the DDL it uses to create
|
||||
one. AlphaTheta publishes no specification, so this is the closest thing to one:
|
||||
a second vendor's independent implementation of the same schema. It was verified
|
||||
by building an empty database from it and having `pyrekordbox`'s ORM — a third
|
||||
implementation — open and write to it.
|
||||
|
||||
Not loaded by the tests; kept as documentation, and as the starting point if
|
||||
Konduktor ever needs to create a drive from nothing.
|
||||
|
||||
## rekordbox-edited/
|
||||
|
||||
Analysis files from a SECOND stick (Goober), after rekordbox 7 itself edited it
|
||||
(2026-10-01): a hot cue added on pad E of `demo-track-2`, and a memory cue added on
|
||||
the start of `nemean`'s memory loop. Trimmed the same way as above, by dropping
|
||||
whole tags: only `PPTH`, `PCOB` and `PCO2` are kept, byte for byte.
|
||||
|
||||
They exist for one property: rekordbox writes **compact** cue entries when it
|
||||
edits (48 bytes for that hot cue, 44 with no colour for the memory cue; an export
|
||||
writes 88). pyrekordbox's parser raises on the 44-byte form, which once made the
|
||||
reader drop the whole `.EXT`, losing pads D-H and every colour. See
|
||||
`adapters/rekordbox/anlz_file.py`.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,208 @@
|
||||
CREATE TABLE IF NOT EXISTS "content" (
|
||||
"content_id" integer primary key not null,
|
||||
"title" varchar,
|
||||
"titleForSearch" varchar,
|
||||
"subtitle" varchar,
|
||||
"bpmx100" int,
|
||||
"length" int,
|
||||
"trackNo" int,
|
||||
"discNo" int,
|
||||
"artist_id_artist" int,
|
||||
"artist_id_remixer" int,
|
||||
"artist_id_originalArtist" int,
|
||||
"artist_id_composer" int,
|
||||
"artist_id_lyricist" int,
|
||||
"album_id" int,
|
||||
"genre_id" int,
|
||||
"label_id" int,
|
||||
"key_id" int,
|
||||
"color_id" int,
|
||||
"image_id" int,
|
||||
"djComment" varchar,
|
||||
"rating" int,
|
||||
"releaseYear" int,
|
||||
"releaseDate" varchar,
|
||||
"dateAdded" varchar,
|
||||
"dateCreated" varchar,
|
||||
"path" varchar,
|
||||
"fileName" varchar,
|
||||
"fileSize" int,
|
||||
"fileType" int,
|
||||
"bitrate" int,
|
||||
"bitDepth" int,
|
||||
"samplingRate" int,
|
||||
"isrc" varchar,
|
||||
"djPlayCount" int,
|
||||
"isHotCueAutoLoadOn" int,
|
||||
"isKuvoDeliverStatusOn" int,
|
||||
"kuvoDeliveryComment" varchar,
|
||||
"masterDbId" int not null,
|
||||
"masterContentId" int not null,
|
||||
"analysisDataFilePath" varchar,
|
||||
"analysedBits" int,
|
||||
"contentLink" int,
|
||||
"hasModified" int,
|
||||
"cueUpdateCount" int,
|
||||
"analysisDataUpdateCount" int,
|
||||
"informationUpdateCount" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "genre" (
|
||||
"genre_id" integer primary key not null,
|
||||
"name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "artist" (
|
||||
"artist_id" integer primary key not null,
|
||||
"name" varchar,
|
||||
"nameForSearch" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "album" (
|
||||
"album_id" integer primary key not null,
|
||||
"name" varchar not null,
|
||||
"artist_id" int,
|
||||
"image_id" int,
|
||||
"isComplation" int,
|
||||
"nameForSearch" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "label" (
|
||||
"label_id" integer primary key not null,
|
||||
"name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "key" (
|
||||
"key_id" integer primary key not null,
|
||||
"name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "color" (
|
||||
"color_id" integer primary key not null,
|
||||
"name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "playlist" (
|
||||
"playlist_id" integer primary key not null,
|
||||
"sequenceNo" int,
|
||||
"name" varchar,
|
||||
"image_id" int,
|
||||
"attribute" int,
|
||||
"playlist_id_parent" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "playlist_content" (
|
||||
"playlist_id" int not null,
|
||||
"content_id" int not null,
|
||||
"sequenceNo" int not null
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "history" (
|
||||
"history_id" integer primary key not null,
|
||||
"sequenceNo" int,
|
||||
"name" varchar,
|
||||
"attribute" int,
|
||||
"history_id_parent" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "history_content" (
|
||||
"history_id" int,
|
||||
"content_id" int,
|
||||
"sequenceNo" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "image" (
|
||||
"image_id" integer primary key not null,
|
||||
"path" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "menuItem" (
|
||||
"menuItem_id" integer primary key not null,
|
||||
"kind" int,
|
||||
"name" varchar
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "category" (
|
||||
"category_id" integer primary key not null,
|
||||
"menuItem_id" int,
|
||||
"sequenceNo" int,
|
||||
"isVisible" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "sort" (
|
||||
"sort_id" integer primary key not null,
|
||||
"menuItem_id" int,
|
||||
"sequenceNo" int,
|
||||
"isVisible" int,
|
||||
"isSelectedAsSubColumn" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "property" (
|
||||
"deviceName" varchar,
|
||||
"dbVersion" varchar,
|
||||
"numberOfContents" int,
|
||||
"createdDate" varchar,
|
||||
"backGroundColorType" int,
|
||||
"myTagMasterDBID" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "hotCueBankList" (
|
||||
"hotCueBankList_id" integer primary key not null,
|
||||
"sequenceNo" int,
|
||||
"name" varchar,
|
||||
"image_id" int,
|
||||
"attribute" int,
|
||||
"hotCueBankList_id_parent" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "hotCueBankList_cue" (
|
||||
"hotCueBankList_id" int not null,
|
||||
"cue_id" int not null,
|
||||
"sequenceNo" int not null
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "cue" (
|
||||
"cue_id" integer primary key not null,
|
||||
"content_id" int not null,
|
||||
"kind" int not null,
|
||||
"colorTableIndex" int,
|
||||
"cueComment" varchar,
|
||||
"isActiveLoop" int not null,
|
||||
"beatLoopNumerator" int,
|
||||
"beatLoopDenominator" int,
|
||||
"inUsec" int not null,
|
||||
"outUsec" int,
|
||||
"in150FramePerSec" int not null,
|
||||
"out150FramePerSec" int,
|
||||
"inMpegFrameNumber" int,
|
||||
"outMpegFrameNumber" int,
|
||||
"inMpegAbs" int,
|
||||
"outMpegAbs" int,
|
||||
"inDecodingStartFramePosition" int,
|
||||
"outDecodingStartFramePosition" int,
|
||||
"inFileOffsetInBlock" int,
|
||||
"outFileOffsetInBlock" int,
|
||||
"inNumberOfSampleInBlock" int,
|
||||
"outNumberOfSampleInBlock" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "recommendedLike" (
|
||||
"content_id_1" int not null,
|
||||
"content_id_2" int not null,
|
||||
"rating" int,
|
||||
"createdDate" datetime
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "myTag" (
|
||||
"myTag_id" integer primary key not null,
|
||||
"sequenceNo" int,
|
||||
"name" varchar,
|
||||
"attribute" int,
|
||||
"myTag_id_parent" int
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS "myTag_content" (
|
||||
"myTag_id" int not null,
|
||||
"content_id" int not null
|
||||
);
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
-- rekordbox's own scaffolding rows for a OneLibrary drive: the browse menu
|
||||
-- items, the categories and sort columns a player offers, and the colour
|
||||
-- palette. Extracted verbatim from fixtures/onelibrary/PIONEER/rekordbox/
|
||||
-- exportLibrary.db (a real rekordbox 7.2.18 export). No user data, no
|
||||
-- machine identity. rekordbox writes these on every export, so a drive without
|
||||
-- them is not a shape any player has been tested against.
|
||||
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (1, 128, 'GENRE');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (2, 129, 'ARTIST');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (3, 130, 'ALBUM');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (4, 131, 'TRACK');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (5, 133, 'BPM');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (6, 134, 'RATING');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (7, 135, 'YEAR');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (8, 136, 'REMIXER');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (9, 137, 'LABEL');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (10, 138, 'ORIGINAL ARTIST');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (11, 139, 'KEY');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (12, 141, 'CUE');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (13, 142, 'COLOR');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (14, 146, 'TIME');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (15, 147, 'BITRATE');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (16, 148, 'FILE NAME');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (17, 132, 'PLAYLIST');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (18, 152, 'HOT CUE BANK');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (19, 149, 'HISTORY');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (20, 145, 'SEARCH');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (21, 150, 'COMMENTS');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (22, 140, 'DATE ADDED');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (23, 151, 'DJ PLAY COUNT');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (24, 144, 'FOLDER');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (25, 161, 'DEFAULT');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (26, 162, 'ALPHABET');
|
||||
INSERT INTO "menuItem" ("menuItem_id", "kind", "name") VALUES (27, 170, 'MATCHING');
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (1, 1, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (2, 2, 1, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (3, 3, 2, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (4, 4, 3, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (5, 17, 5, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (6, 5, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (7, 6, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (8, 7, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (9, 8, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (10, 9, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (11, 10, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (12, 11, 4, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (15, 13, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (17, 24, 9, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (18, 20, 7, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (19, 14, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (20, 15, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (21, 16, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (22, 19, 6, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (23, 18, 0, 0);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (26, 27, 8, 1);
|
||||
INSERT INTO "category" ("category_id", "menuItem_id", "sequenceNo", "isVisible") VALUES (27, 22, 10, 1);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (0, 25, 1, 1, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (1, 26, 2, 1, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (2, 2, 3, 1, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (3, 3, 4, 1, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (4, 5, 5, 1, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (5, 6, 6, 1, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (6, 1, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (7, 21, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (8, 14, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (9, 8, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (10, 9, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (11, 10, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (12, 11, 7, 1, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (13, 15, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (15, 13, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (16, 23, 0, 0, 0);
|
||||
INSERT INTO "sort" ("sort_id", "menuItem_id", "sequenceNo", "isVisible", "isSelectedAsSubColumn") VALUES (17, 22, 0, 0, 0);
|
||||
INSERT INTO "color" ("color_id", "name") VALUES (1, 'Pink');
|
||||
INSERT INTO "color" ("color_id", "name") VALUES (2, 'Red');
|
||||
INSERT INTO "color" ("color_id", "name") VALUES (3, 'Orange');
|
||||
INSERT INTO "color" ("color_id", "name") VALUES (4, 'Yellow');
|
||||
INSERT INTO "color" ("color_id", "name") VALUES (5, 'Green');
|
||||
INSERT INTO "color" ("color_id", "name") VALUES (6, 'Aqua');
|
||||
INSERT INTO "color" ("color_id", "name") VALUES (7, 'Blue');
|
||||
INSERT INTO "color" ("color_id", "name") VALUES (8, 'Purple');
|
||||
@@ -0,0 +1,20 @@
|
||||
# `master.db` schema
|
||||
|
||||
`schema.sql` is the DDL of a real Rekordbox 7 library — 47 tables and 288
|
||||
indexes — used by the Rekordbox **exporter** to create a database from nothing.
|
||||
|
||||
**It contains no user data.** Table and index definitions only, extracted with
|
||||
`SELECT sql FROM sqlite_master`.
|
||||
|
||||
## Why this, and not pyrekordbox's models
|
||||
|
||||
`Base.metadata.create_all()` looked like the obvious way to build the schema, and
|
||||
it is wrong in two ways that matter:
|
||||
|
||||
- it models **37 tables**, not 47;
|
||||
- it marks columns **NOT NULL that Rekordbox leaves nullable**. `agentRegistry
|
||||
.id_1` is the one that caught it: a real library has NULL there, and a database
|
||||
built from the ORM refuses the row Rekordbox itself writes.
|
||||
|
||||
So the DDL is the authority and the models are not. Regenerate with the snippet
|
||||
in the export handoff if a future Rekordbox version changes the schema.
|
||||
@@ -0,0 +1,20 @@
|
||||
# Empty rekordbox device library (`export.pdb`, `exportExt.pdb`)
|
||||
|
||||
The legacy "Device Library" a Pioneer USB stick carries — the one Rekordbox
|
||||
lists as **Device Library** and older players (CDJ-2000NXS2, many XDJs) read —
|
||||
exactly as **Rekordbox 7.2.18 wrote it for an empty stick**: it creates both
|
||||
files the first time it mounts a drive that has none.
|
||||
|
||||
They are the starting point of the "Rekordbox Export" target
|
||||
(`adapters/rekordbox/device_export.py`), for the same reason `seed.sql` exists:
|
||||
the format has fixed tables that are the same on every stick and cannot be
|
||||
derived — the colour list (table 6), the browse columns (16), two menu tables
|
||||
(17, 18) and a history header (19) in `export.pdb`; rekordbox's default MyTag
|
||||
names in `exportExt.pdb`. Every data table (tracks, artists, albums, genres,
|
||||
labels, keys, playlists, artwork) holds only its header page, with a blank page
|
||||
reserved after it for its first rows — the allocation rule the writer follows.
|
||||
|
||||
**No user data**: the only strings are colour names, column names, the default
|
||||
MyTag names, the creation date (`2026-09-27`, rewritten on every export) and the
|
||||
database version `1000`. Pages 13-14 and 33-38 are byte-identical to the same
|
||||
pages of a real rekordbox device export of eight tracks.
|
||||
Executable
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"note": "Rows from a real rekordbox 7.2.18 device export (export.pdb), for byte-level tests. Only the Loopmasters demo tracks and generic key names; see README.md. The track row's u3/u4 (the exporting computer's rekordbox masterDbId) are zeroed.",
|
||||
"track_row_demo_track_2": "2400200000070c0044ac000000000000f6304e0011a8a6040000000000000000000000000000000001000000000000004001000000000000e02e000000000000000000000100000002000000000000000000100080002900000001000300880089008a008c008e00910092009500980099009a00a500a600a700a800d400df00fd000a010b011c0103030531053107313103074f4e074f4e030317323031382d30352d3235030303592f50494f4e4545522f555342414e4c5a2f503035332f30303031443231462f414e4c5a303030302e44415417323032362d30392d31373d547261636b73206279207777772e6c6f6f706d6173746572732e636f6d1b44656d6f20547261636b2032032344656d6f20547261636b20322e6d7033692f436f6e74656e74732f4c6f6f706d6173746572732f556e6b6e6f776e416c62756d2f44656d6f20547261636b20322e6d7033",
|
||||
"track_row_demo_track_2_fields": {
|
||||
"subtype": 36,
|
||||
"index_shift": 32,
|
||||
"bitmask": 788224,
|
||||
"sample_rate": 44100,
|
||||
"composer_id": 0,
|
||||
"file_size": 5124342,
|
||||
"u2": 78030865,
|
||||
"u3": 0,
|
||||
"u4": 0,
|
||||
"artwork_id": 0,
|
||||
"key_id": 0,
|
||||
"original_artist_id": 0,
|
||||
"label_id": 1,
|
||||
"remixer_id": 0,
|
||||
"bitrate": 320,
|
||||
"track_number": 0,
|
||||
"tempo": 12000,
|
||||
"genre_id": 0,
|
||||
"album_id": 0,
|
||||
"artist_id": 1,
|
||||
"id": 2,
|
||||
"disc_number": 0,
|
||||
"play_count": 0,
|
||||
"year": 0,
|
||||
"sample_depth": 16,
|
||||
"duration": 128,
|
||||
"u5": 41,
|
||||
"color_id": 0,
|
||||
"rating": 0,
|
||||
"u6": 1,
|
||||
"u7": 3,
|
||||
"isrc": "",
|
||||
"texter": "",
|
||||
"unknown_string_2": "1",
|
||||
"unknown_string_3": "1",
|
||||
"unknown_string_4": "11",
|
||||
"message": "",
|
||||
"kuvo_public": "ON",
|
||||
"autoload_hotcues": "ON",
|
||||
"unknown_string_5": "",
|
||||
"unknown_string_6": "",
|
||||
"date_added": "2018-05-25",
|
||||
"release_date": "",
|
||||
"mix_name": "",
|
||||
"unknown_string_7": "",
|
||||
"analyze_path": "/PIONEER/USBANLZ/P053/0001D21F/ANLZ0000.DAT",
|
||||
"analyze_date": "2026-09-17",
|
||||
"comment": "Tracks by www.loopmasters.com",
|
||||
"title": "Demo Track 2",
|
||||
"unknown_string_8": "",
|
||||
"filename": "Demo Track 2.mp3",
|
||||
"file_path": "/Contents/Loopmasters/UnknownAlbum/Demo Track 2.mp3"
|
||||
},
|
||||
"artist_row_loopmasters": "6000000001000000030a194c6f6f706d617374657273000000000000",
|
||||
"playlist_row_demos": "00000000000000000100000001000000000000000d64656d6f730000",
|
||||
"keys_page_index": 12,
|
||||
"keys_page": "000000000c0000000500000034000000140000000000000002400024b80f1800010001000000000001000000010000000941626d020000000200000007456d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000Line truncated
|
||||
}
|
||||
@@ -0,0 +1,344 @@
|
||||
-- master.db schema, extracted from a real Rekordbox 7 library.
|
||||
--
|
||||
-- NOT generated from pyrekordbox's SQLAlchemy models: `create_all()` marks
|
||||
-- columns NOT NULL that Rekordbox itself leaves nullable (agentRegistry.id_1
|
||||
-- is the one that caught this), so a database built from the ORM rejects rows
|
||||
-- Rekordbox writes every day. The DDL is the authority; the models are not.
|
||||
--
|
||||
-- Contains no user data — table and index definitions only.
|
||||
|
||||
CREATE TABLE `agentNotification` (`ID` BIGINT PRIMARY KEY, `graphic_area` TINYINT(1) DEFAULT 0, `text_area` TINYINT(1) DEFAULT 0, `os_notification` TINYINT(1) DEFAULT 0, `start_datetime` DATETIME DEFAULT NULL, `end_datetime` DATETIME DEFAULT NULL, `display_datetime` DATETIME DEFAULT NULL, `interval` INTEGER DEFAULT 0, `category` VARCHAR(255) DEFAULT NULL, `category_color` VARCHAR(255) DEFAULT NULL, `title` TEXT DEFAULT NULL, `description` TEXT DEFAULT NULL, `url` VARCHAR(255) DEFAULT NULL, `image` VARCHAR(255) DEFAULT NULL, `image_path` VARCHAR(255) DEFAULT NULL, `read_status` INTEGER DEFAULT 0, `last_displayed_datetime` DATETIME DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `agentNotificationLog` (`ID` INTEGER PRIMARY KEY AUTOINCREMENT, `gigya_uid` VARCHAR(255) DEFAULT NULL, `event_date` INTEGER DEFAULT NULL, `reported_datetime` DATETIME DEFAULT NULL, `kind` INTEGER DEFAULT NULL, `value` INTEGER DEFAULT NULL, `notification_id` BIGINT DEFAULT NULL, `link` VARCHAR(255) DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `agentRegistry` (`registry_id` VARCHAR(255) PRIMARY KEY, `id_1` VARCHAR(255) DEFAULT NULL, `id_2` VARCHAR(255) DEFAULT NULL, `int_1` BIGINT DEFAULT NULL, `int_2` BIGINT DEFAULT NULL, `str_1` VARCHAR(255) DEFAULT NULL, `str_2` VARCHAR(255) DEFAULT NULL, `date_1` DATETIME DEFAULT NULL, `date_2` DATETIME DEFAULT NULL, `text_1` TEXT DEFAULT NULL, `text_2` TEXT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `cloudAgentRegistry` (`ID` VARCHAR(255) PRIMARY KEY, `int_1` BIGINT DEFAULT NULL, `int_2` BIGINT DEFAULT NULL, `str_1` VARCHAR(255) DEFAULT NULL, `str_2` VARCHAR(255) DEFAULT NULL, `date_1` DATETIME DEFAULT NULL, `date_2` DATETIME DEFAULT NULL, `text_1` TEXT DEFAULT NULL, `text_2` TEXT DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `contentActiveCensor` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID` VARCHAR(255) DEFAULT NULL, `ActiveCensors` TEXT DEFAULT NULL, `rb_activecensor_count` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `contentCue` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID` VARCHAR(255) DEFAULT NULL, `Cues` TEXT DEFAULT NULL, `rb_cue_count` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `contentFile` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID` VARCHAR(255) DEFAULT NULL, `Path` VARCHAR(255) DEFAULT NULL, `Hash` VARCHAR(255) DEFAULT NULL, `Size` INTEGER DEFAULT NULL, `rb_local_path` VARCHAR(255) DEFAULT NULL, `rb_insync_hash` VARCHAR(255) DEFAULT NULL, `rb_insync_local_usn` BIGINT DEFAULT NULL, `rb_file_hash_dirty` INTEGER DEFAULT 0, `rb_local_file_status` INTEGER DEFAULT 0, `rb_in_progress` TINYINT(1) DEFAULT 0, `rb_process_type` INTEGER DEFAULT 0, `rb_temp_path` VARCHAR(255) DEFAULT NULL, `rb_priority` INTEGER DEFAULT 50, `rb_file_size_dirty` INTEGER DEFAULT 0, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdActiveCensor` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID` VARCHAR(255) DEFAULT NULL, `InMsec` INTEGER DEFAULT NULL, `OutMsec` INTEGER DEFAULT NULL, `Info` INTEGER DEFAULT NULL, `ParameterList` TEXT DEFAULT NULL, `ContentUUID` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdAlbum` (`ID` VARCHAR(255) PRIMARY KEY, `Name` VARCHAR(255) DEFAULT NULL, `AlbumArtistID` VARCHAR(255) DEFAULT NULL, `ImagePath` VARCHAR(255) DEFAULT NULL, `Compilation` INTEGER DEFAULT NULL, `SearchStr` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdArtist` (`ID` VARCHAR(255) PRIMARY KEY, `Name` VARCHAR(255) DEFAULT NULL, `SearchStr` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdCategory` (`ID` VARCHAR(255) PRIMARY KEY, `MenuItemID` VARCHAR(255) DEFAULT NULL, `Seq` INTEGER DEFAULT NULL, `Disable` INTEGER DEFAULT NULL, `InfoOrder` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdCloudExportPlaylist` (`ID` VARCHAR(255) PRIMARY KEY, `Seq` INTEGER DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `ImagePath` VARCHAR(255) DEFAULT NULL, `Attribute` INTEGER DEFAULT NULL, `ParentID` VARCHAR(255) DEFAULT NULL, `SmartList` TEXT DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdCloudExportSongPlaylist` (`ID` VARCHAR(255) PRIMARY KEY, `CloudExportPlaylistID` VARCHAR(255) DEFAULT NULL, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdCloudFilterPlaylist` (`ID` VARCHAR(255) PRIMARY KEY, `PlaylistUUID` VARCHAR(255) DEFAULT NULL, `Seq` INTEGER DEFAULT 0, `ParentID` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdCloudProperty` (`ID` VARCHAR(255) PRIMARY KEY, `Reserved1` TEXT DEFAULT NULL, `Reserved2` TEXT DEFAULT NULL, `Reserved3` TEXT DEFAULT NULL, `Reserved4` TEXT DEFAULT NULL, `Reserved5` TEXT DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdColor` (`ID` VARCHAR(255) PRIMARY KEY, `ColorCode` INTEGER DEFAULT NULL, `SortKey` INTEGER DEFAULT NULL, `Commnt` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdContent` (`ID` VARCHAR(255) PRIMARY KEY, `FolderPath` VARCHAR(255) DEFAULT NULL, `FileNameL` VARCHAR(255) DEFAULT NULL, `FileNameS` VARCHAR(255) DEFAULT NULL, `Title` VARCHAR(255) DEFAULT NULL, `ArtistID` VARCHAR(255) DEFAULT NULL, `AlbumID` VARCHAR(255) DEFAULT NULL, `GenreID` VARCHAR(255) DEFAULT NULL, `BPM` INTEGER DEFAULT NULL, `Length` INTEGER DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `BitRate` INTEGER DEFAULT NULL, `BitDepth` INTEGER DEFAULT NULL, `Commnt` TEXT DEFAULT NULL, `FileType` INTEGER DEFAULT NULL, `Rating` INTEGER DEFAULT NULL, `ReleaseYear` INTEGER DEFAULT NULL, `RemixerID` VARCHAR(255) DEFAULT NULL, `LabelID` VARCHAR(255) DEFAULT NULL, `OrgArtistID` VARCHAR(255) DEFAULT NULL, `KeyID` VARCHAR(255) DEFAULT NULL, `StockDate` VARCHAR(255) DEFAULT NULL, `ColorID` VARCHAR(255) DEFAULT NULL, `DJPlayCount` INTEGER DEFAULT NULL, `ImagePath` VARCHAR(255) DEFAULT NULL, `MasterDBID` VARCHAR(255) DEFAULT NULL, `MasterSongID` VARCHAR(255) DEFAULT NULL, `AnalysisDataPath` VARCHAR(255) DEFAULT NULL, `SearchStr` VARCHAR(255) DEFAULT NULL, `FileSize` INTEGER DEFAULT NULL, `DiscNo` INTEGER DEFAULT NULL, `ComposerID` VARCHAR(255) DEFAULT NULL, `Subtitle` VARCHAR(255) DEFAULT NULL, `SampleRate` INTEGER DEFAULT NULL, `DisableQuantize` INTEGER DEFAULT NULL, `Analysed` INTEGER DEFAULT NULL, `ReleaseDate` VARCHAR(255) DEFAULT NULL, `DateCreated` VARCHAR(255) DEFAULT NULL, `ContentLink` INTEGER DEFAULT NULL, `Tag` VARCHAR(255) DEFAULT NULL, `ModifiedByRBM` VARCHAR(255) DEFAULT NULL, `HotCueAutoLoad` VARCHAR(255) DEFAULT NULL, `DeliveryControl` VARCHAR(255) DEFAULT NULL, `DeliveryComment` VARCHAR(255) DEFAULT NULL, `CueUpdated` VARCHAR(255) DEFAULT NULL, `AnalysisUpdated` VARCHAR(255) DEFAULT NULL, `TrackInfoUpdated` VARCHAR(255) DEFAULT NULL, `Lyricist` VARCHAR(255) DEFAULT NULL, `ISRC` VARCHAR(255) DEFAULT NULL, `SamplerTrackInfo` INTEGER DEFAULT NULL, `SamplerPlayOffset` INTEGER DEFAULT NULL, `SamplerGain` FLOAT DEFAULT NULL, `VideoAssociate` VARCHAR(255) DEFAULT NULL, `LyricStatus` INTEGER DEFAULT NULL, `ServiceID` INTEGER DEFAULT NULL, `OrgFolderPath` VARCHAR(255) DEFAULT NULL, `Reserved1` TEXT DEFAULT NULL, `Reserved2` TEXT DEFAULT NULL, `Reserved3` TEXT DEFAULT NULL, `Reserved4` TEXT DEFAULT NULL, `ExtInfo` TEXT DEFAULT NULL, `rb_file_id` VARCHAR(255) DEFAULT NULL, `DeviceID` VARCHAR(255) DEFAULT NULL, `rb_LocalFolderPath` VARCHAR(255) DEFAULT NULL, `SrcID` VARCHAR(255) DEFAULT NULL, `SrcTitle` VARCHAR(255) DEFAULT NULL, `SrcArtistName` VARCHAR(255) DEFAULT NULL, `SrcAlbumName` VARCHAR(255) DEFAULT NULL, `SrcLength` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdCue` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID` VARCHAR(255) DEFAULT NULL, `InMsec` INTEGER DEFAULT NULL, `InFrame` INTEGER DEFAULT NULL, `InMpegFrame` INTEGER DEFAULT NULL, `InMpegAbs` INTEGER DEFAULT NULL, `OutMsec` INTEGER DEFAULT NULL, `OutFrame` INTEGER DEFAULT NULL, `OutMpegFrame` INTEGER DEFAULT NULL, `OutMpegAbs` INTEGER DEFAULT NULL, `Kind` INTEGER DEFAULT NULL, `Color` INTEGER DEFAULT NULL, `ColorTableIndex` INTEGER DEFAULT NULL, `ActiveLoop` INTEGER DEFAULT NULL, `Comment` VARCHAR(255) DEFAULT NULL, `BeatLoopSize` INTEGER DEFAULT NULL, `CueMicrosec` INTEGER DEFAULT NULL, `InPointSeekInfo` VARCHAR(255) DEFAULT NULL, `OutPointSeekInfo` VARCHAR(255) DEFAULT NULL, `ContentUUID` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdDevice` (`ID` VARCHAR(255) PRIMARY KEY, `MasterDBID` VARCHAR(255) DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdGenre` (`ID` VARCHAR(255) PRIMARY KEY, `Name` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdHistory` (`ID` VARCHAR(255) PRIMARY KEY, `Seq` INTEGER DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `Attribute` INTEGER DEFAULT NULL, `ParentID` VARCHAR(255) DEFAULT NULL, `DateCreated` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdHotCueBanklist` (`ID` VARCHAR(255) PRIMARY KEY, `Seq` INTEGER DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `ImagePath` VARCHAR(255) DEFAULT NULL, `Attribute` INTEGER DEFAULT NULL, `ParentID` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdKey` (`ID` VARCHAR(255) PRIMARY KEY, `ScaleName` VARCHAR(255) DEFAULT NULL, `Seq` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdLabel` (`ID` VARCHAR(255) PRIMARY KEY, `Name` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdMenuItems` (`ID` VARCHAR(255) PRIMARY KEY, `Class` INTEGER DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdMixerParam` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID` VARCHAR(255) DEFAULT NULL, `GainHigh` INTEGER DEFAULT NULL, `GainLow` INTEGER DEFAULT NULL, `PeakHigh` INTEGER DEFAULT NULL, `PeakLow` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdMyTag` (`ID` VARCHAR(255) PRIMARY KEY, `Seq` INTEGER DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `Attribute` INTEGER DEFAULT NULL, `ParentID` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdPlaylist` (`ID` VARCHAR(255) PRIMARY KEY, `Seq` INTEGER DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `ImagePath` VARCHAR(255) DEFAULT NULL, `Attribute` INTEGER DEFAULT NULL, `ParentID` VARCHAR(255) DEFAULT NULL, `SmartList` TEXT DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdProperty` (`DBID` VARCHAR(255) PRIMARY KEY, `DBVersion` VARCHAR(255) DEFAULT NULL, `BaseDBDrive` VARCHAR(255) DEFAULT NULL, `CurrentDBDrive` VARCHAR(255) DEFAULT NULL, `DeviceID` VARCHAR(255) DEFAULT NULL, `Reserved1` TEXT DEFAULT NULL, `Reserved2` TEXT DEFAULT NULL, `Reserved3` TEXT DEFAULT NULL, `Reserved4` TEXT DEFAULT NULL, `Reserved5` TEXT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdRecommendLike` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID1` VARCHAR(255) DEFAULT NULL, `ContentID2` VARCHAR(255) DEFAULT NULL, `LikeRate` INTEGER DEFAULT NULL, `DataCreatedH` INTEGER DEFAULT NULL, `DataCreatedL` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdRelatedTracks` (`ID` VARCHAR(255) PRIMARY KEY, `Seq` INTEGER DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `Attribute` INTEGER DEFAULT NULL, `ParentID` VARCHAR(255) DEFAULT NULL, `Criteria` TEXT DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSampler` (`ID` VARCHAR(255) PRIMARY KEY, `Seq` INTEGER DEFAULT NULL, `Name` VARCHAR(255) DEFAULT NULL, `Attribute` INTEGER DEFAULT NULL, `ParentID` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSharedPlaylist` (`ID` VARCHAR(255) PRIMARY KEY, `data_selection` TINYINT DEFAULT 0, `edited_at` DATETIME DEFAULT NULL, `int_1` INTEGER DEFAULT NULL, `int_2` INTEGER DEFAULT NULL, `str_1` VARCHAR(255) DEFAULT NULL, `str_2` VARCHAR(255) DEFAULT NULL, `text_1` TEXT DEFAULT NULL, `text_2` TEXT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSharedPlaylistUser` (`ID` VARCHAR(255) NOT NULL, `member_type` TINYINT DEFAULT 0, `member_id` VARCHAR(255) NOT NULL, `status` TINYINT DEFAULT 0, `invitation_expires_at` DATETIME DEFAULT NULL, `invited_at` DATETIME DEFAULT NULL, `joined_at` DATETIME DEFAULT NULL, `int_1` INTEGER DEFAULT NULL, `int_2` INTEGER DEFAULT NULL, `str_1` VARCHAR(255) DEFAULT NULL, `str_2` VARCHAR(255) DEFAULT NULL, `text_1` TEXT DEFAULT NULL, `text_2` TEXT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL, PRIMARY KEY (`ID`, `member_id`));
|
||||
CREATE TABLE `djmdSongHistory` (`ID` VARCHAR(255) PRIMARY KEY, `HistoryID` VARCHAR(255) DEFAULT NULL, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSongHotCueBanklist` (`ID` VARCHAR(255) PRIMARY KEY, `HotCueBanklistID` VARCHAR(255) DEFAULT NULL, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `CueID` VARCHAR(255) DEFAULT NULL, `InMsec` INTEGER DEFAULT NULL, `InFrame` INTEGER DEFAULT NULL, `InMpegFrame` INTEGER DEFAULT NULL, `InMpegAbs` INTEGER DEFAULT NULL, `OutMsec` INTEGER DEFAULT NULL, `OutFrame` INTEGER DEFAULT NULL, `OutMpegFrame` INTEGER DEFAULT NULL, `OutMpegAbs` INTEGER DEFAULT NULL, `Color` INTEGER DEFAULT NULL, `ColorTableIndex` INTEGER DEFAULT NULL, `ActiveLoop` INTEGER DEFAULT NULL, `Comment` VARCHAR(255) DEFAULT NULL, `BeatLoopSize` INTEGER DEFAULT NULL, `CueMicrosec` INTEGER DEFAULT NULL, `InPointSeekInfo` VARCHAR(255) DEFAULT NULL, `OutPointSeekInfo` VARCHAR(255) DEFAULT NULL, `HotCueBanklistUUID` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSongMyTag` (`ID` VARCHAR(255) PRIMARY KEY, `MyTagID` VARCHAR(255) DEFAULT NULL, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSongPlaylist` (`ID` VARCHAR(255) PRIMARY KEY, `PlaylistID` VARCHAR(255) DEFAULT NULL, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSongRelatedTracks` (`ID` VARCHAR(255) PRIMARY KEY, `RelatedTracksID` VARCHAR(255) DEFAULT NULL, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSongRequestList` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSongSampler` (`ID` VARCHAR(255) PRIMARY KEY, `SamplerID` VARCHAR(255) DEFAULT NULL, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSongTagList` (`ID` VARCHAR(255) PRIMARY KEY, `ContentID` VARCHAR(255) DEFAULT NULL, `TrackNo` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `djmdSort` (`ID` VARCHAR(255) PRIMARY KEY, `MenuItemID` VARCHAR(255) DEFAULT NULL, `Seq` INTEGER DEFAULT NULL, `Disable` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `hotCueBanklistCue` (`ID` VARCHAR(255) PRIMARY KEY, `HotCueBanklistID` VARCHAR(255) DEFAULT NULL, `Cues` TEXT DEFAULT NULL, `rb_cue_count` INTEGER DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `imageFile` (`ID` VARCHAR(255) PRIMARY KEY, `TableName` VARCHAR(255) DEFAULT NULL, `TargetUUID` VARCHAR(255) DEFAULT NULL, `TargetID` VARCHAR(255) DEFAULT NULL, `Path` VARCHAR(255) DEFAULT NULL, `Hash` VARCHAR(255) DEFAULT NULL, `Size` INTEGER DEFAULT NULL, `rb_local_path` VARCHAR(255) DEFAULT NULL, `rb_insync_hash` VARCHAR(255) DEFAULT NULL, `rb_insync_local_usn` BIGINT DEFAULT NULL, `rb_file_hash_dirty` INTEGER DEFAULT 0, `rb_local_file_status` INTEGER DEFAULT 0, `rb_in_progress` TINYINT(1) DEFAULT 0, `rb_process_type` INTEGER DEFAULT 0, `rb_temp_path` VARCHAR(255) DEFAULT NULL, `rb_priority` INTEGER DEFAULT 50, `rb_file_size_dirty` INTEGER DEFAULT 0, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `settingFile` (`ID` VARCHAR(255) PRIMARY KEY, `Path` VARCHAR(255) DEFAULT NULL, `Hash` VARCHAR(255) DEFAULT NULL, `Size` INTEGER DEFAULT NULL, `rb_local_path` VARCHAR(255) DEFAULT NULL, `rb_insync_hash` VARCHAR(255) DEFAULT NULL, `rb_insync_local_usn` BIGINT DEFAULT NULL, `rb_file_hash_dirty` INTEGER DEFAULT 0, `rb_file_size_dirty` INTEGER DEFAULT 0, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE TABLE `uuidIDMap` (`ID` VARCHAR(255) PRIMARY KEY, `TableName` VARCHAR(255) DEFAULT NULL, `TargetUUID` VARCHAR(255) DEFAULT NULL, `CurrentID` VARCHAR(255) DEFAULT NULL, `UUID` VARCHAR(255) DEFAULT NULL, `rb_data_status` INTEGER DEFAULT 0, `rb_local_data_status` INTEGER DEFAULT 0, `rb_local_deleted` TINYINT(1) DEFAULT 0, `rb_local_synced` TINYINT(1) DEFAULT 0, `usn` BIGINT DEFAULT NULL, `rb_local_usn` BIGINT DEFAULT NULL, `created_at` DATETIME NOT NULL, `updated_at` DATETIME NOT NULL);
|
||||
CREATE INDEX `agent_notification_log_gigya_uid_event_date_kind_notification_id` ON `agentNotificationLog` (`gigya_uid`, `event_date`, `kind`, `notification_id`);
|
||||
CREATE INDEX `agent_notification_log_reported_datetime_event_date` ON `agentNotificationLog` (`reported_datetime`, `event_date`);
|
||||
CREATE INDEX `agent_notification_start_datetime_end_datetime` ON `agentNotification` (`start_datetime`, `end_datetime`);
|
||||
CREATE INDEX `agent_registry_id_1_id_2` ON `agentRegistry` (`id_1`, `id_2`);
|
||||
CREATE INDEX `cloud_agent_registry__u_u_i_d` ON `cloudAgentRegistry` (`UUID`);
|
||||
CREATE INDEX `cloud_agent_registry_rb_data_status` ON `cloudAgentRegistry` (`rb_data_status`);
|
||||
CREATE INDEX `cloud_agent_registry_rb_local_data_status` ON `cloudAgentRegistry` (`rb_local_data_status`);
|
||||
CREATE INDEX `cloud_agent_registry_rb_local_deleted` ON `cloudAgentRegistry` (`rb_local_deleted`);
|
||||
CREATE INDEX `cloud_agent_registry_rb_local_usn__i_d` ON `cloudAgentRegistry` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `content_active_censor__content_i_d` ON `contentActiveCensor` (`ContentID`);
|
||||
CREATE INDEX `content_active_censor__u_u_i_d` ON `contentActiveCensor` (`UUID`);
|
||||
CREATE INDEX `content_active_censor_rb_data_status` ON `contentActiveCensor` (`rb_data_status`);
|
||||
CREATE INDEX `content_active_censor_rb_local_data_status` ON `contentActiveCensor` (`rb_local_data_status`);
|
||||
CREATE INDEX `content_active_censor_rb_local_deleted` ON `contentActiveCensor` (`rb_local_deleted`);
|
||||
CREATE INDEX `content_active_censor_rb_local_usn__i_d` ON `contentActiveCensor` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `content_cue__content_i_d` ON `contentCue` (`ContentID`);
|
||||
CREATE INDEX `content_cue__u_u_i_d` ON `contentCue` (`UUID`);
|
||||
CREATE INDEX `content_cue_rb_cue_count` ON `contentCue` (`rb_cue_count`);
|
||||
CREATE INDEX `content_cue_rb_data_status` ON `contentCue` (`rb_data_status`);
|
||||
CREATE INDEX `content_cue_rb_local_data_status` ON `contentCue` (`rb_local_data_status`);
|
||||
CREATE INDEX `content_cue_rb_local_deleted` ON `contentCue` (`rb_local_deleted`);
|
||||
CREATE INDEX `content_cue_rb_local_usn__i_d` ON `contentCue` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `content_file__content_i_d` ON `contentFile` (`ContentID`);
|
||||
CREATE INDEX `content_file__u_u_i_d` ON `contentFile` (`UUID`);
|
||||
CREATE INDEX `content_file_rb_data_status` ON `contentFile` (`rb_data_status`);
|
||||
CREATE INDEX `content_file_rb_file_hash_dirty` ON `contentFile` (`rb_file_hash_dirty`);
|
||||
CREATE INDEX `content_file_rb_file_size_dirty` ON `contentFile` (`rb_file_size_dirty`);
|
||||
CREATE INDEX `content_file_rb_local_data_status` ON `contentFile` (`rb_local_data_status`);
|
||||
CREATE INDEX `content_file_rb_local_deleted` ON `contentFile` (`rb_local_deleted`);
|
||||
CREATE INDEX `content_file_rb_local_deleted_rb_in_progress_rb_local_file_status_rb_process_type_rb_priority` ON `contentFile` (`rb_local_deleted`, `rb_in_progress`, `rb_local_file_status`, `rb_process_type`, `rb_priority`);
|
||||
CREATE INDEX `content_file_rb_local_usn__i_d` ON `contentFile` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_active_censor__content_i_d` ON `djmdActiveCensor` (`ContentID`);
|
||||
CREATE INDEX `djmd_active_censor__content_u_u_i_d` ON `djmdActiveCensor` (`ContentUUID`);
|
||||
CREATE INDEX `djmd_active_censor__u_u_i_d` ON `djmdActiveCensor` (`UUID`);
|
||||
CREATE INDEX `djmd_active_censor_rb_data_status` ON `djmdActiveCensor` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_active_censor_rb_local_data_status` ON `djmdActiveCensor` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_active_censor_rb_local_deleted` ON `djmdActiveCensor` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_active_censor_rb_local_usn__i_d` ON `djmdActiveCensor` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_album__album_artist_i_d` ON `djmdAlbum` (`AlbumArtistID`);
|
||||
CREATE INDEX `djmd_album__name` ON `djmdAlbum` (`Name`);
|
||||
CREATE INDEX `djmd_album__u_u_i_d` ON `djmdAlbum` (`UUID`);
|
||||
CREATE INDEX `djmd_album_rb_data_status` ON `djmdAlbum` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_album_rb_local_data_status` ON `djmdAlbum` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_album_rb_local_deleted` ON `djmdAlbum` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_album_rb_local_usn__i_d` ON `djmdAlbum` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_artist__name` ON `djmdArtist` (`Name`);
|
||||
CREATE INDEX `djmd_artist__u_u_i_d` ON `djmdArtist` (`UUID`);
|
||||
CREATE INDEX `djmd_artist_rb_data_status` ON `djmdArtist` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_artist_rb_local_data_status` ON `djmdArtist` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_artist_rb_local_deleted` ON `djmdArtist` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_artist_rb_local_usn__i_d` ON `djmdArtist` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_category__u_u_i_d` ON `djmdCategory` (`UUID`);
|
||||
CREATE INDEX `djmd_category_rb_data_status` ON `djmdCategory` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_category_rb_local_data_status` ON `djmdCategory` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_category_rb_local_deleted` ON `djmdCategory` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_category_rb_local_usn__i_d` ON `djmdCategory` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist__attribute` ON `djmdCloudExportPlaylist` (`Attribute`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist__name` ON `djmdCloudExportPlaylist` (`Name`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist__parent_i_d` ON `djmdCloudExportPlaylist` (`ParentID`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist__seq` ON `djmdCloudExportPlaylist` (`Seq`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist__u_u_i_d` ON `djmdCloudExportPlaylist` (`UUID`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist_rb_data_status` ON `djmdCloudExportPlaylist` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist_rb_local_data_status` ON `djmdCloudExportPlaylist` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist_rb_local_deleted` ON `djmdCloudExportPlaylist` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_cloud_export_playlist_rb_local_usn__i_d` ON `djmdCloudExportPlaylist` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_cloud_export_song_playlist__cloud_export_playlist_i_d__i_d` ON `djmdCloudExportSongPlaylist` (`CloudExportPlaylistID`, `ID`);
|
||||
CREATE INDEX `djmd_cloud_export_song_playlist__content_i_d_rb_local_deleted` ON `djmdCloudExportSongPlaylist` (`ContentID`, `rb_local_deleted`);
|
||||
CREATE INDEX `djmd_cloud_export_song_playlist__u_u_i_d` ON `djmdCloudExportSongPlaylist` (`UUID`);
|
||||
CREATE INDEX `djmd_cloud_export_song_playlist_rb_data_status` ON `djmdCloudExportSongPlaylist` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_cloud_export_song_playlist_rb_local_data_status` ON `djmdCloudExportSongPlaylist` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_cloud_export_song_playlist_rb_local_deleted` ON `djmdCloudExportSongPlaylist` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_cloud_export_song_playlist_rb_local_usn__i_d` ON `djmdCloudExportSongPlaylist` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_cloud_filter_playlist__u_u_i_d` ON `djmdCloudFilterPlaylist` (`UUID`);
|
||||
CREATE INDEX `djmd_cloud_filter_playlist_rb_data_status` ON `djmdCloudFilterPlaylist` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_cloud_filter_playlist_rb_local_data_status` ON `djmdCloudFilterPlaylist` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_cloud_filter_playlist_rb_local_deleted` ON `djmdCloudFilterPlaylist` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_cloud_filter_playlist_rb_local_usn__i_d` ON `djmdCloudFilterPlaylist` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_cloud_property__u_u_i_d` ON `djmdCloudProperty` (`UUID`);
|
||||
CREATE INDEX `djmd_cloud_property_rb_data_status` ON `djmdCloudProperty` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_cloud_property_rb_local_data_status` ON `djmdCloudProperty` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_cloud_property_rb_local_deleted` ON `djmdCloudProperty` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_cloud_property_rb_local_usn__i_d` ON `djmdCloudProperty` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_color__u_u_i_d` ON `djmdColor` (`UUID`);
|
||||
CREATE INDEX `djmd_color_rb_data_status` ON `djmdColor` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_color_rb_local_data_status` ON `djmdColor` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_color_rb_local_deleted` ON `djmdColor` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_color_rb_local_usn__i_d` ON `djmdColor` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_content__album_i_d` ON `djmdContent` (`AlbumID`);
|
||||
CREATE INDEX `djmd_content__artist_i_d` ON `djmdContent` (`ArtistID`);
|
||||
CREATE INDEX `djmd_content__composer_i_d` ON `djmdContent` (`ComposerID`);
|
||||
CREATE INDEX `djmd_content__genre_i_d` ON `djmdContent` (`GenreID`);
|
||||
CREATE INDEX `djmd_content__key_i_d` ON `djmdContent` (`KeyID`);
|
||||
CREATE INDEX `djmd_content__label_i_d` ON `djmdContent` (`LabelID`);
|
||||
CREATE INDEX `djmd_content__master_d_b_i_d__master_song_i_d` ON `djmdContent` (`MasterDBID`, `MasterSongID`);
|
||||
CREATE INDEX `djmd_content__org_artist_i_d` ON `djmdContent` (`OrgArtistID`);
|
||||
CREATE INDEX `djmd_content__remixer_i_d` ON `djmdContent` (`RemixerID`);
|
||||
CREATE INDEX `djmd_content__u_u_i_d` ON `djmdContent` (`UUID`);
|
||||
CREATE INDEX `djmd_content_rb_data_status` ON `djmdContent` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_content_rb_local_data_status` ON `djmdContent` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_content_rb_local_deleted` ON `djmdContent` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_content_rb_local_deleted__bit_depth` ON `djmdContent` (`rb_local_deleted`, `BitDepth`);
|
||||
CREATE INDEX `djmd_content_rb_local_deleted__bit_rate` ON `djmdContent` (`rb_local_deleted`, `BitRate`);
|
||||
CREATE INDEX `djmd_content_rb_local_deleted__file_type` ON `djmdContent` (`rb_local_deleted`, `FileType`);
|
||||
CREATE INDEX `djmd_content_rb_local_deleted__service_i_d` ON `djmdContent` (`rb_local_deleted`, `ServiceID`);
|
||||
CREATE INDEX `djmd_content_rb_local_usn__i_d` ON `djmdContent` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_cue__content_i_d_rb_local_deleted` ON `djmdCue` (`ContentID`, `rb_local_deleted`);
|
||||
CREATE INDEX `djmd_cue__content_u_u_i_d` ON `djmdCue` (`ContentUUID`);
|
||||
CREATE INDEX `djmd_cue__u_u_i_d` ON `djmdCue` (`UUID`);
|
||||
CREATE INDEX `djmd_cue_rb_data_status` ON `djmdCue` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_cue_rb_local_data_status` ON `djmdCue` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_cue_rb_local_deleted` ON `djmdCue` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_cue_rb_local_usn__i_d` ON `djmdCue` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_device__u_u_i_d` ON `djmdDevice` (`UUID`);
|
||||
CREATE INDEX `djmd_device_rb_data_status` ON `djmdDevice` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_device_rb_local_data_status` ON `djmdDevice` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_device_rb_local_deleted` ON `djmdDevice` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_device_rb_local_usn__i_d` ON `djmdDevice` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_genre__name` ON `djmdGenre` (`Name`);
|
||||
CREATE INDEX `djmd_genre__u_u_i_d` ON `djmdGenre` (`UUID`);
|
||||
CREATE INDEX `djmd_genre_rb_data_status` ON `djmdGenre` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_genre_rb_local_data_status` ON `djmdGenre` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_genre_rb_local_deleted` ON `djmdGenre` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_genre_rb_local_usn__i_d` ON `djmdGenre` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_history__name` ON `djmdHistory` (`Name`);
|
||||
CREATE INDEX `djmd_history__parent_i_d` ON `djmdHistory` (`ParentID`);
|
||||
CREATE INDEX `djmd_history__u_u_i_d` ON `djmdHistory` (`UUID`);
|
||||
CREATE INDEX `djmd_history_rb_data_status` ON `djmdHistory` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_history_rb_local_data_status` ON `djmdHistory` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_history_rb_local_deleted` ON `djmdHistory` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_history_rb_local_usn__i_d` ON `djmdHistory` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_hot_cue_banklist__name` ON `djmdHotCueBanklist` (`Name`);
|
||||
CREATE INDEX `djmd_hot_cue_banklist__parent_i_d` ON `djmdHotCueBanklist` (`ParentID`);
|
||||
CREATE INDEX `djmd_hot_cue_banklist__u_u_i_d` ON `djmdHotCueBanklist` (`UUID`);
|
||||
CREATE INDEX `djmd_hot_cue_banklist_rb_data_status` ON `djmdHotCueBanklist` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_hot_cue_banklist_rb_local_data_status` ON `djmdHotCueBanklist` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_hot_cue_banklist_rb_local_deleted` ON `djmdHotCueBanklist` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_hot_cue_banklist_rb_local_usn__i_d` ON `djmdHotCueBanklist` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_key__scale_name` ON `djmdKey` (`ScaleName`);
|
||||
CREATE INDEX `djmd_key__u_u_i_d` ON `djmdKey` (`UUID`);
|
||||
CREATE INDEX `djmd_key_rb_data_status` ON `djmdKey` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_key_rb_local_data_status` ON `djmdKey` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_key_rb_local_deleted` ON `djmdKey` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_key_rb_local_usn__i_d` ON `djmdKey` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_label__name` ON `djmdLabel` (`Name`);
|
||||
CREATE INDEX `djmd_label__u_u_i_d` ON `djmdLabel` (`UUID`);
|
||||
CREATE INDEX `djmd_label_rb_data_status` ON `djmdLabel` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_label_rb_local_data_status` ON `djmdLabel` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_label_rb_local_deleted` ON `djmdLabel` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_label_rb_local_usn__i_d` ON `djmdLabel` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_menu_items__u_u_i_d` ON `djmdMenuItems` (`UUID`);
|
||||
CREATE INDEX `djmd_menu_items_rb_data_status` ON `djmdMenuItems` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_menu_items_rb_local_data_status` ON `djmdMenuItems` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_menu_items_rb_local_deleted` ON `djmdMenuItems` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_menu_items_rb_local_usn__i_d` ON `djmdMenuItems` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_mixer_param__content_i_d_rb_local_deleted` ON `djmdMixerParam` (`ContentID`, `rb_local_deleted`);
|
||||
CREATE INDEX `djmd_mixer_param__u_u_i_d` ON `djmdMixerParam` (`UUID`);
|
||||
CREATE INDEX `djmd_mixer_param_rb_data_status` ON `djmdMixerParam` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_mixer_param_rb_local_data_status` ON `djmdMixerParam` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_mixer_param_rb_local_deleted` ON `djmdMixerParam` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_mixer_param_rb_local_usn__i_d` ON `djmdMixerParam` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_my_tag__parent_i_d` ON `djmdMyTag` (`ParentID`);
|
||||
CREATE INDEX `djmd_my_tag__seq` ON `djmdMyTag` (`Seq`);
|
||||
CREATE INDEX `djmd_my_tag__u_u_i_d` ON `djmdMyTag` (`UUID`);
|
||||
CREATE INDEX `djmd_my_tag_rb_data_status` ON `djmdMyTag` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_my_tag_rb_local_data_status` ON `djmdMyTag` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_my_tag_rb_local_deleted` ON `djmdMyTag` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_my_tag_rb_local_usn__i_d` ON `djmdMyTag` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_playlist__attribute` ON `djmdPlaylist` (`Attribute`);
|
||||
CREATE INDEX `djmd_playlist__name` ON `djmdPlaylist` (`Name`);
|
||||
CREATE INDEX `djmd_playlist__parent_i_d` ON `djmdPlaylist` (`ParentID`);
|
||||
CREATE INDEX `djmd_playlist__seq` ON `djmdPlaylist` (`Seq`);
|
||||
CREATE INDEX `djmd_playlist__u_u_i_d` ON `djmdPlaylist` (`UUID`);
|
||||
CREATE INDEX `djmd_playlist_rb_data_status` ON `djmdPlaylist` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_playlist_rb_local_data_status` ON `djmdPlaylist` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_playlist_rb_local_deleted` ON `djmdPlaylist` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_playlist_rb_local_usn__i_d` ON `djmdPlaylist` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_recommend_like__content_i_d1__content_i_d2` ON `djmdRecommendLike` (`ContentID1`, `ContentID2`);
|
||||
CREATE INDEX `djmd_recommend_like__content_i_d2` ON `djmdRecommendLike` (`ContentID2`);
|
||||
CREATE INDEX `djmd_recommend_like__u_u_i_d` ON `djmdRecommendLike` (`UUID`);
|
||||
CREATE INDEX `djmd_recommend_like_rb_data_status` ON `djmdRecommendLike` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_recommend_like_rb_local_data_status` ON `djmdRecommendLike` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_recommend_like_rb_local_deleted` ON `djmdRecommendLike` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_recommend_like_rb_local_usn__i_d` ON `djmdRecommendLike` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_related_tracks__name` ON `djmdRelatedTracks` (`Name`);
|
||||
CREATE INDEX `djmd_related_tracks__parent_i_d` ON `djmdRelatedTracks` (`ParentID`);
|
||||
CREATE INDEX `djmd_related_tracks__seq` ON `djmdRelatedTracks` (`Seq`);
|
||||
CREATE INDEX `djmd_related_tracks__u_u_i_d` ON `djmdRelatedTracks` (`UUID`);
|
||||
CREATE INDEX `djmd_related_tracks_rb_data_status` ON `djmdRelatedTracks` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_related_tracks_rb_local_data_status` ON `djmdRelatedTracks` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_related_tracks_rb_local_deleted` ON `djmdRelatedTracks` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_related_tracks_rb_local_usn__i_d` ON `djmdRelatedTracks` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_sampler__name` ON `djmdSampler` (`Name`);
|
||||
CREATE INDEX `djmd_sampler__parent_i_d` ON `djmdSampler` (`ParentID`);
|
||||
CREATE INDEX `djmd_sampler__seq` ON `djmdSampler` (`Seq`);
|
||||
CREATE INDEX `djmd_sampler__u_u_i_d` ON `djmdSampler` (`UUID`);
|
||||
CREATE INDEX `djmd_sampler_rb_data_status` ON `djmdSampler` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_sampler_rb_local_data_status` ON `djmdSampler` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_sampler_rb_local_deleted` ON `djmdSampler` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_sampler_rb_local_usn__i_d` ON `djmdSampler` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_song_history__content_i_d_rb_local_deleted` ON `djmdSongHistory` (`ContentID`, `rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_history__history_i_d` ON `djmdSongHistory` (`HistoryID`);
|
||||
CREATE INDEX `djmd_song_history__u_u_i_d` ON `djmdSongHistory` (`UUID`);
|
||||
CREATE INDEX `djmd_song_history_rb_data_status` ON `djmdSongHistory` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_song_history_rb_local_data_status` ON `djmdSongHistory` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_song_history_rb_local_deleted` ON `djmdSongHistory` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_history_rb_local_usn__i_d` ON `djmdSongHistory` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_song_hot_cue_banklist__content_i_d` ON `djmdSongHotCueBanklist` (`ContentID`);
|
||||
CREATE INDEX `djmd_song_hot_cue_banklist__hot_cue_banklist_i_d` ON `djmdSongHotCueBanklist` (`HotCueBanklistID`);
|
||||
CREATE INDEX `djmd_song_hot_cue_banklist__hot_cue_banklist_u_u_i_d` ON `djmdSongHotCueBanklist` (`HotCueBanklistUUID`);
|
||||
CREATE INDEX `djmd_song_hot_cue_banklist__u_u_i_d` ON `djmdSongHotCueBanklist` (`UUID`);
|
||||
CREATE INDEX `djmd_song_hot_cue_banklist_rb_data_status` ON `djmdSongHotCueBanklist` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_song_hot_cue_banklist_rb_local_data_status` ON `djmdSongHotCueBanklist` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_song_hot_cue_banklist_rb_local_deleted` ON `djmdSongHotCueBanklist` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_hot_cue_banklist_rb_local_usn__i_d` ON `djmdSongHotCueBanklist` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_song_my_tag__content_i_d_rb_local_deleted` ON `djmdSongMyTag` (`ContentID`, `rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_my_tag__my_tag_i_d_rb_local_deleted__i_d` ON `djmdSongMyTag` (`MyTagID`, `rb_local_deleted`, `ID`);
|
||||
CREATE INDEX `djmd_song_my_tag__u_u_i_d` ON `djmdSongMyTag` (`UUID`);
|
||||
CREATE INDEX `djmd_song_my_tag_rb_data_status` ON `djmdSongMyTag` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_song_my_tag_rb_local_data_status` ON `djmdSongMyTag` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_song_my_tag_rb_local_deleted` ON `djmdSongMyTag` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_my_tag_rb_local_usn__i_d` ON `djmdSongMyTag` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_song_playlist__content_i_d_rb_local_deleted` ON `djmdSongPlaylist` (`ContentID`, `rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_playlist__playlist_i_d__i_d` ON `djmdSongPlaylist` (`PlaylistID`, `ID`);
|
||||
CREATE INDEX `djmd_song_playlist__u_u_i_d` ON `djmdSongPlaylist` (`UUID`);
|
||||
CREATE INDEX `djmd_song_playlist_rb_data_status` ON `djmdSongPlaylist` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_song_playlist_rb_local_data_status` ON `djmdSongPlaylist` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_song_playlist_rb_local_deleted` ON `djmdSongPlaylist` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_playlist_rb_local_usn__i_d` ON `djmdSongPlaylist` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_song_related_tracks__content_i_d` ON `djmdSongRelatedTracks` (`ContentID`);
|
||||
CREATE INDEX `djmd_song_related_tracks__related_tracks_i_d` ON `djmdSongRelatedTracks` (`RelatedTracksID`);
|
||||
CREATE INDEX `djmd_song_related_tracks__u_u_i_d` ON `djmdSongRelatedTracks` (`UUID`);
|
||||
CREATE INDEX `djmd_song_related_tracks_rb_data_status` ON `djmdSongRelatedTracks` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_song_related_tracks_rb_local_data_status` ON `djmdSongRelatedTracks` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_song_related_tracks_rb_local_deleted` ON `djmdSongRelatedTracks` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_related_tracks_rb_local_usn__i_d` ON `djmdSongRelatedTracks` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_song_request_list__content_i_d` ON `djmdSongRequestList` (`ContentID`);
|
||||
CREATE INDEX `djmd_song_request_list__u_u_i_d` ON `djmdSongRequestList` (`UUID`);
|
||||
CREATE INDEX `djmd_song_request_list_rb_data_status` ON `djmdSongRequestList` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_song_request_list_rb_local_data_status` ON `djmdSongRequestList` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_song_request_list_rb_local_deleted` ON `djmdSongRequestList` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_request_list_rb_local_usn__i_d` ON `djmdSongRequestList` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_song_sampler__content_i_d` ON `djmdSongSampler` (`ContentID`);
|
||||
CREATE INDEX `djmd_song_sampler__sampler_i_d` ON `djmdSongSampler` (`SamplerID`);
|
||||
CREATE INDEX `djmd_song_sampler__u_u_i_d` ON `djmdSongSampler` (`UUID`);
|
||||
CREATE INDEX `djmd_song_sampler_rb_data_status` ON `djmdSongSampler` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_song_sampler_rb_local_data_status` ON `djmdSongSampler` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_song_sampler_rb_local_deleted` ON `djmdSongSampler` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_sampler_rb_local_usn__i_d` ON `djmdSongSampler` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_song_tag_list__content_i_d` ON `djmdSongTagList` (`ContentID`);
|
||||
CREATE INDEX `djmd_song_tag_list__u_u_i_d` ON `djmdSongTagList` (`UUID`);
|
||||
CREATE INDEX `djmd_song_tag_list_rb_data_status` ON `djmdSongTagList` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_song_tag_list_rb_local_data_status` ON `djmdSongTagList` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_song_tag_list_rb_local_deleted` ON `djmdSongTagList` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_song_tag_list_rb_local_usn__i_d` ON `djmdSongTagList` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `djmd_sort__u_u_i_d` ON `djmdSort` (`UUID`);
|
||||
CREATE INDEX `djmd_sort_rb_data_status` ON `djmdSort` (`rb_data_status`);
|
||||
CREATE INDEX `djmd_sort_rb_local_data_status` ON `djmdSort` (`rb_local_data_status`);
|
||||
CREATE INDEX `djmd_sort_rb_local_deleted` ON `djmdSort` (`rb_local_deleted`);
|
||||
CREATE INDEX `djmd_sort_rb_local_usn__i_d` ON `djmdSort` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `hot_cue_banklist_cue__hot_cue_banklist_i_d` ON `hotCueBanklistCue` (`HotCueBanklistID`);
|
||||
CREATE INDEX `hot_cue_banklist_cue__u_u_i_d` ON `hotCueBanklistCue` (`UUID`);
|
||||
CREATE INDEX `hot_cue_banklist_cue_rb_cue_count` ON `hotCueBanklistCue` (`rb_cue_count`);
|
||||
CREATE INDEX `hot_cue_banklist_cue_rb_data_status` ON `hotCueBanklistCue` (`rb_data_status`);
|
||||
CREATE INDEX `hot_cue_banklist_cue_rb_local_data_status` ON `hotCueBanklistCue` (`rb_local_data_status`);
|
||||
CREATE INDEX `hot_cue_banklist_cue_rb_local_deleted` ON `hotCueBanklistCue` (`rb_local_deleted`);
|
||||
CREATE INDEX `hot_cue_banklist_cue_rb_local_usn__i_d` ON `hotCueBanklistCue` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `image_file__table_name__target_i_d` ON `imageFile` (`TableName`, `TargetID`);
|
||||
CREATE INDEX `image_file__table_name__target_u_u_i_d__i_d` ON `imageFile` (`TableName`, `TargetUUID`, `ID`);
|
||||
CREATE INDEX `image_file__u_u_i_d` ON `imageFile` (`UUID`);
|
||||
CREATE INDEX `image_file_rb_data_status` ON `imageFile` (`rb_data_status`);
|
||||
CREATE INDEX `image_file_rb_file_hash_dirty` ON `imageFile` (`rb_file_hash_dirty`);
|
||||
CREATE INDEX `image_file_rb_file_size_dirty` ON `imageFile` (`rb_file_size_dirty`);
|
||||
CREATE INDEX `image_file_rb_local_data_status` ON `imageFile` (`rb_local_data_status`);
|
||||
CREATE INDEX `image_file_rb_local_deleted` ON `imageFile` (`rb_local_deleted`);
|
||||
CREATE INDEX `image_file_rb_local_deleted_rb_in_progress_rb_local_file_status_rb_process_type_rb_priority` ON `imageFile` (`rb_local_deleted`, `rb_in_progress`, `rb_local_file_status`, `rb_process_type`, `rb_priority`);
|
||||
CREATE INDEX `image_file_rb_local_usn__i_d` ON `imageFile` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `setting_file__u_u_i_d` ON `settingFile` (`UUID`);
|
||||
CREATE INDEX `setting_file_rb_data_status` ON `settingFile` (`rb_data_status`);
|
||||
CREATE INDEX `setting_file_rb_file_hash_dirty` ON `settingFile` (`rb_file_hash_dirty`);
|
||||
CREATE INDEX `setting_file_rb_file_size_dirty` ON `settingFile` (`rb_file_size_dirty`);
|
||||
CREATE INDEX `setting_file_rb_local_data_status` ON `settingFile` (`rb_local_data_status`);
|
||||
CREATE INDEX `setting_file_rb_local_deleted` ON `settingFile` (`rb_local_deleted`);
|
||||
CREATE INDEX `setting_file_rb_local_usn__i_d` ON `settingFile` (`rb_local_usn`, `ID`);
|
||||
CREATE INDEX `uuid_i_d_map__u_u_i_d` ON `uuidIDMap` (`UUID`);
|
||||
CREATE INDEX `uuid_i_d_map_rb_data_status` ON `uuidIDMap` (`rb_data_status`);
|
||||
CREATE INDEX `uuid_i_d_map_rb_local_data_status` ON `uuidIDMap` (`rb_local_data_status`);
|
||||
CREATE INDEX `uuid_i_d_map_rb_local_deleted` ON `uuidIDMap` (`rb_local_deleted`);
|
||||
CREATE INDEX `uuid_i_d_map_rb_local_usn__i_d` ON `uuidIDMap` (`rb_local_usn`, `ID`);
|
||||
@@ -0,0 +1,88 @@
|
||||
-- Rekordbox's own scaffolding rows, needed before any track can be added:
|
||||
-- `add_content` looks up djmdMenuItems('TRACK') and fails on an empty table.
|
||||
--
|
||||
-- Static UI data only — menu items, colours, categories, sort options.
|
||||
-- djmdDevice and djmdProperty are DELIBERATELY absent: they carry the
|
||||
-- machine's name and UUIDs, so the exporter generates those fresh instead.
|
||||
|
||||
-- djmdMenuItems: 27 rows
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('1', -128, 'GENRE', '1', 0, 0, 0, 0, NULL, 10, '2026-09-17 20:53:21.658 +00:00', '2026-09-17 20:53:21.658 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('2', -127, 'ARTIST', '2', 0, 0, 0, 0, NULL, 11, '2026-09-17 20:53:21.658 +00:00', '2026-09-17 20:53:21.658 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('3', -126, 'ALBUM', '3', 0, 0, 0, 0, NULL, 12, '2026-09-17 20:53:21.658 +00:00', '2026-09-17 20:53:21.658 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('4', -125, 'TRACK', '4', 0, 0, 0, 0, NULL, 13, '2026-09-17 20:53:21.658 +00:00', '2026-09-17 20:53:21.658 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('5', -123, 'BPM', '5', 0, 0, 0, 0, NULL, 14, '2026-09-17 20:53:21.658 +00:00', '2026-09-17 20:53:21.658 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('6', -122, 'RATING', '6', 0, 0, 0, 0, NULL, 15, '2026-09-17 20:53:21.659 +00:00', '2026-09-17 20:53:21.659 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('7', -121, 'YEAR', '7', 0, 0, 0, 0, NULL, 16, '2026-09-17 20:53:21.659 +00:00', '2026-09-17 20:53:21.659 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('8', -120, 'REMIXER', '8', 0, 0, 0, 0, NULL, 17, '2026-09-17 20:53:21.659 +00:00', '2026-09-17 20:53:21.659 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('9', -119, 'LABEL', '9', 0, 0, 0, 0, NULL, 18, '2026-09-17 20:53:21.659 +00:00', '2026-09-17 20:53:21.659 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('10', -118, 'ORIGINAL ARTIST', '10', 0, 0, 0, 0, NULL, 19, '2026-09-17 20:53:21.659 +00:00', '2026-09-17 20:53:21.659 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('11', -117, 'KEY', '11', 0, 0, 0, 0, NULL, 20, '2026-09-17 20:53:21.659 +00:00', '2026-09-17 20:53:21.659 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('12', -115, 'CUE', '12', 0, 0, 0, 0, NULL, 21, '2026-09-17 20:53:21.659 +00:00', '2026-09-17 20:53:21.659 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('13', -114, 'COLOR', '13', 0, 0, 0, 0, NULL, 22, '2026-09-17 20:53:21.659 +00:00', '2026-09-17 20:53:21.659 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('14', -110, 'TIME', '14', 0, 0, 0, 0, NULL, 23, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('15', -109, 'BITRATE', '15', 0, 0, 0, 0, NULL, 24, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('16', -108, 'FILE NAME', '16', 0, 0, 0, 0, NULL, 25, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('17', -124, 'PLAYLIST', '17', 0, 0, 0, 0, NULL, 26, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('18', -104, 'HOT CUE BANK', '18', 0, 0, 0, 0, NULL, 27, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('19', -107, 'HISTORY', '19', 0, 0, 0, 0, NULL, 28, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('20', -111, 'SEARCH', '20', 0, 0, 0, 0, NULL, 29, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('21', -106, 'COMMENTS', '21', 0, 0, 0, 0, NULL, 30, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('22', -116, 'DATE ADDED', '22', 0, 0, 0, 0, NULL, 31, '2026-09-17 20:53:21.660 +00:00', '2026-09-17 20:53:21.660 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('23', -105, 'DJ PLAY COUNT', '23', 0, 0, 0, 0, NULL, 32, '2026-09-17 20:53:21.661 +00:00', '2026-09-17 20:53:21.661 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('24', -112, 'FOLDER', '24', 0, 0, 0, 0, NULL, 33, '2026-09-17 20:53:21.661 +00:00', '2026-09-17 20:53:21.661 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('25', -95, 'DEFAULT', '25', 0, 0, 0, 0, NULL, 34, '2026-09-17 20:53:21.661 +00:00', '2026-09-17 20:53:21.661 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('26', -94, 'ALPHABET', '26', 0, 0, 0, 0, NULL, 35, '2026-09-17 20:53:21.661 +00:00', '2026-09-17 20:53:21.661 +00:00');
|
||||
INSERT INTO "djmdMenuItems" ("ID", "Class", "Name", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('27', -86, 'MATCHING', '27', 0, 0, 0, 0, NULL, 36, '2026-09-17 20:53:21.661 +00:00', '2026-09-17 20:53:21.661 +00:00');
|
||||
|
||||
-- djmdColor: 8 rows
|
||||
INSERT INTO "djmdColor" ("ID", "ColorCode", "SortKey", "Commnt", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('1', NULL, 1, 'Pink', '1', 0, 0, 0, 0, NULL, 2, '2026-09-17 20:53:21.657 +00:00', '2026-09-17 20:53:21.657 +00:00');
|
||||
INSERT INTO "djmdColor" ("ID", "ColorCode", "SortKey", "Commnt", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('2', NULL, 2, 'Red', '2', 0, 0, 0, 0, NULL, 3, '2026-09-17 20:53:21.657 +00:00', '2026-09-17 20:53:21.657 +00:00');
|
||||
INSERT INTO "djmdColor" ("ID", "ColorCode", "SortKey", "Commnt", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('3', NULL, 3, 'Orange', '3', 0, 0, 0, 0, NULL, 4, '2026-09-17 20:53:21.657 +00:00', '2026-09-17 20:53:21.657 +00:00');
|
||||
INSERT INTO "djmdColor" ("ID", "ColorCode", "SortKey", "Commnt", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('4', NULL, 4, 'Yellow', '4', 0, 0, 0, 0, NULL, 5, '2026-09-17 20:53:21.657 +00:00', '2026-09-17 20:53:21.657 +00:00');
|
||||
INSERT INTO "djmdColor" ("ID", "ColorCode", "SortKey", "Commnt", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('5', NULL, 5, 'Green', '5', 0, 0, 0, 0, NULL, 6, '2026-09-17 20:53:21.657 +00:00', '2026-09-17 20:53:21.657 +00:00');
|
||||
INSERT INTO "djmdColor" ("ID", "ColorCode", "SortKey", "Commnt", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('6', NULL, 6, 'Aqua', '6', 0, 0, 0, 0, NULL, 7, '2026-09-17 20:53:21.657 +00:00', '2026-09-17 20:53:21.657 +00:00');
|
||||
INSERT INTO "djmdColor" ("ID", "ColorCode", "SortKey", "Commnt", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('7', NULL, 7, 'Blue', '7', 0, 0, 0, 0, NULL, 8, '2026-09-17 20:53:21.658 +00:00', '2026-09-17 20:53:21.658 +00:00');
|
||||
INSERT INTO "djmdColor" ("ID", "ColorCode", "SortKey", "Commnt", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('8', NULL, 8, 'Purple', '8', 0, 0, 0, 0, NULL, 9, '2026-09-17 20:53:21.658 +00:00', '2026-09-17 20:53:21.658 +00:00');
|
||||
|
||||
-- djmdCategory: 22 rows
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('1', '1', 0, 1, 99, '1', 0, 0, 0, 0, NULL, 37, '2026-09-17 20:53:25.758 +00:00', '2026-09-17 20:53:25.758 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('2', '2', 1, 0, 2, '2', 0, 0, 0, 0, NULL, 38, '2026-09-17 20:53:25.769 +00:00', '2026-09-17 20:53:25.769 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('3', '3', 2, 0, 3, '3', 0, 0, 0, 0, NULL, 39, '2026-09-17 20:53:25.774 +00:00', '2026-09-17 20:53:25.774 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('4', '4', 3, 0, 1, '4', 0, 0, 0, 0, NULL, 40, '2026-09-17 20:53:25.780 +00:00', '2026-09-17 20:53:25.780 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('5', '17', 5, 0, 99, '5', 0, 0, 0, 0, NULL, 41, '2026-09-17 20:53:25.786 +00:00', '2026-09-17 20:53:25.786 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('6', '5', 0, 1, 5, '6', 0, 0, 0, 0, NULL, 42, '2026-09-17 20:53:25.793 +00:00', '2026-09-17 20:53:25.793 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('7', '6', 0, 1, 99, '7', 0, 0, 0, 0, NULL, 43, '2026-09-17 20:53:25.799 +00:00', '2026-09-17 20:53:25.799 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('8', '7', 0, 1, 99, '8', 0, 0, 0, 0, NULL, 44, '2026-09-17 20:53:25.804 +00:00', '2026-09-17 20:53:25.804 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('9', '8', 0, 1, 99, '9', 0, 0, 0, 0, NULL, 45, '2026-09-17 20:53:25.811 +00:00', '2026-09-17 20:53:25.811 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('10', '9', 0, 1, 99, '10', 0, 0, 0, 0, NULL, 46, '2026-09-17 20:53:25.817 +00:00', '2026-09-17 20:53:25.817 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('11', '10', 0, 1, 99, '11', 0, 0, 0, 0, NULL, 47, '2026-09-17 20:53:25.823 +00:00', '2026-09-17 20:53:25.823 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('12', '11', 4, 0, 99, '12', 0, 0, 0, 0, NULL, 48, '2026-09-17 20:53:25.829 +00:00', '2026-09-17 20:53:25.829 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('15', '13', 0, 1, 99, '15', 0, 0, 0, 0, NULL, 49, '2026-09-17 20:53:25.836 +00:00', '2026-09-17 20:53:25.836 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('17', '24', 9, 0, 99, '17', 0, 0, 0, 0, NULL, 50, '2026-09-17 20:53:25.842 +00:00', '2026-09-17 20:53:25.842 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('18', '20', 7, 0, 99, '18', 0, 0, 0, 0, NULL, 51, '2026-09-17 20:53:25.848 +00:00', '2026-09-17 20:53:25.848 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('19', '14', 0, 1, 4, '19', 0, 0, 0, 0, NULL, 52, '2026-09-17 20:53:25.854 +00:00', '2026-09-17 20:53:25.854 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('20', '15', 0, 1, 6, '20', 0, 0, 0, 0, NULL, 53, '2026-09-17 20:53:25.860 +00:00', '2026-09-17 20:53:25.860 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('21', '16', 0, 1, 99, '21', 0, 0, 0, 0, NULL, 54, '2026-09-17 20:53:25.865 +00:00', '2026-09-17 20:53:25.865 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('22', '19', 6, 0, 99, '22', 0, 0, 0, 0, NULL, 55, '2026-09-17 20:53:25.870 +00:00', '2026-09-17 20:53:25.870 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('23', '18', 0, 1, 99, '23', 0, 0, 0, 0, NULL, 56, '2026-09-17 20:53:25.875 +00:00', '2026-09-17 20:53:25.875 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('26', '27', 8, 2, 99, '26', 0, 0, 0, 0, NULL, 57, '2026-09-17 20:53:25.881 +00:00', '2026-09-17 20:53:25.881 +00:00');
|
||||
INSERT INTO "djmdCategory" ("ID", "MenuItemID", "Seq", "Disable", "InfoOrder", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('27', '22', 10, 0, 99, '27', 0, 0, 0, 0, NULL, 58, '2026-09-17 20:53:25.886 +00:00', '2026-09-17 20:53:25.886 +00:00');
|
||||
|
||||
-- djmdSort: 17 rows
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('0', '25', 1, 0, '0', 0, 0, 0, 0, NULL, 59, '2026-09-17 20:53:25.893 +00:00', '2026-09-17 20:53:25.893 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('1', '26', 2, 0, '1', 0, 0, 0, 0, NULL, 60, '2026-09-17 20:53:25.900 +00:00', '2026-09-17 20:53:25.900 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('2', '2', 3, 0, '2', 0, 0, 0, 0, NULL, 61, '2026-09-17 20:53:25.907 +00:00', '2026-09-17 20:53:25.907 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('3', '3', 4, 0, '3', 0, 0, 0, 0, NULL, 62, '2026-09-17 20:53:25.913 +00:00', '2026-09-17 20:53:25.913 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('4', '5', 5, 0, '4', 0, 0, 0, 0, NULL, 63, '2026-09-17 20:53:25.920 +00:00', '2026-09-17 20:53:25.920 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('5', '6', 6, 0, '5', 0, 0, 0, 0, NULL, 64, '2026-09-17 20:53:25.925 +00:00', '2026-09-17 20:53:25.925 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('6', '1', 0, 1, '6', 0, 0, 0, 0, NULL, 65, '2026-09-17 20:53:25.931 +00:00', '2026-09-17 20:53:25.931 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('7', '21', 0, 1, '7', 0, 0, 0, 0, NULL, 66, '2026-09-17 20:53:25.937 +00:00', '2026-09-17 20:53:25.937 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('8', '14', 0, 1, '8', 0, 0, 0, 0, NULL, 67, '2026-09-17 20:53:25.943 +00:00', '2026-09-17 20:53:25.943 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('9', '8', 0, 1, '9', 0, 0, 0, 0, NULL, 68, '2026-09-17 20:53:25.950 +00:00', '2026-09-17 20:53:25.950 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('10', '9', 0, 1, '10', 0, 0, 0, 0, NULL, 69, '2026-09-17 20:53:25.957 +00:00', '2026-09-17 20:53:25.957 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('11', '10', 0, 1, '11', 0, 0, 0, 0, NULL, 70, '2026-09-17 20:53:25.963 +00:00', '2026-09-17 20:53:25.963 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('12', '11', 7, 0, '12', 0, 0, 0, 0, NULL, 71, '2026-09-17 20:53:25.971 +00:00', '2026-09-17 20:53:25.971 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('13', '15', 0, 1, '13', 0, 0, 0, 0, NULL, 72, '2026-09-17 20:53:25.978 +00:00', '2026-09-17 20:53:25.978 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('15', '13', 0, 1, '15', 0, 0, 0, 0, NULL, 73, '2026-09-17 20:53:25.985 +00:00', '2026-09-17 20:53:25.985 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('16', '23', 0, 1, '16', 0, 0, 0, 0, NULL, 74, '2026-09-17 20:53:25.992 +00:00', '2026-09-17 20:53:25.992 +00:00');
|
||||
INSERT INTO "djmdSort" ("ID", "MenuItemID", "Seq", "Disable", "UUID", "rb_data_status", "rb_local_data_status", "rb_local_deleted", "rb_local_synced", "usn", "rb_local_usn", "created_at", "updated_at") VALUES ('17', '22', 0, 1, '17', 0, 0, 0, 0, NULL, 75, '2026-09-17 20:53:25.998 +00:00', '2026-09-17 20:53:25.998 +00:00');
|
||||
@@ -1,6 +1,14 @@
|
||||
# PyInstaller spec for the Konduktor backend sidecar (Step 1 of the standalone
|
||||
# build). Produces a single-file binary that serves the FastAPI API on a free
|
||||
# loopback port. Build with: pyinstaller konduktor-sidecar.spec (or build_sidecar.sh)
|
||||
# build). Produces a ONEDIR build — dist/konduktor-sidecar/ holding the
|
||||
# executable plus `_internal/` — that serves the FastAPI API on a free loopback
|
||||
# port. Build with: pyinstaller konduktor-sidecar.spec (or build_sidecar.sh)
|
||||
#
|
||||
# Onedir, NOT onefile: a onefile binary unpacks ~300 MB (1,000+ files, ~390
|
||||
# native libraries) into a NEW temp folder on every launch, and macOS checks
|
||||
# every library it has not seen before (XProtect / syspolicyd) as it is
|
||||
# dlopen()ed, keyed per file — so every launch paid ~10 s before the window
|
||||
# appeared (measured 2026-10-12: the same libraries took 95 s fresh, 1 s once
|
||||
# seen). Installed as a folder inside the app, they are checked once.
|
||||
#
|
||||
# The tricky bits this handles:
|
||||
# - uvicorn imports its loop/protocol backends dynamically → collect_submodules
|
||||
@@ -8,18 +16,21 @@
|
||||
# - traktor-nml-utils parses/serializes via xsdata, which discovers plugins at
|
||||
# runtime → collect_submodules('xsdata')
|
||||
# - python-multipart is imported as `multipart` by starlette → hidden import
|
||||
from PyInstaller.utils.hooks import collect_submodules, collect_all
|
||||
# - dulwich (version-history backups) imports git backends dynamically →
|
||||
# collect_submodules('dulwich')
|
||||
from PyInstaller.utils.hooks import collect_all, collect_submodules, copy_metadata
|
||||
|
||||
hiddenimports = []
|
||||
datas = []
|
||||
binaries = []
|
||||
|
||||
# Dynamically-imported subpackages.
|
||||
for pkg in ("uvicorn", "xsdata"):
|
||||
for pkg in ("uvicorn", "xsdata", "dulwich"):
|
||||
hiddenimports += collect_submodules(pkg)
|
||||
|
||||
# Native standard extras — grab modules + shared libs + any data.
|
||||
for pkg in ("uvloop", "httptools", "websockets"):
|
||||
# Native standard extras — grab modules + shared libs + any data. PyAV (`av`)
|
||||
# carries FFmpeg's shared libraries, which the export's waveform analysis needs.
|
||||
for pkg in ("uvloop", "httptools", "websockets", "av"):
|
||||
d, b, h = collect_all(pkg)
|
||||
datas += d
|
||||
binaries += b
|
||||
@@ -28,11 +39,38 @@ for pkg in ("uvloop", "httptools", "websockets"):
|
||||
# Imported by name, not statically discoverable.
|
||||
hiddenimports += ["multipart", "anyio"]
|
||||
|
||||
# A remote library's password lives in the OS keychain through `keyring`, which
|
||||
# finds its backends (macOS Keychain, Windows Credential Manager) by entry point
|
||||
# — so both the modules AND the package metadata that names them must ship.
|
||||
hiddenimports += collect_submodules("keyring")
|
||||
datas += copy_metadata("keyring")
|
||||
|
||||
# Bundle the canonical version file so konduktor.__version__ can read it at
|
||||
# runtime from sys._MEIPASS (frontend/package.json is the single source of the
|
||||
# app version — see konduktor/__init__.py). Path is relative to this spec.
|
||||
datas += [("../frontend/package.json", ".")]
|
||||
|
||||
# The Rekordbox and OneLibrary exporters build their databases from the real
|
||||
# DDL + scaffolding rows under fixtures/, found at `parents[3] / "fixtures"` —
|
||||
# i.e. the bundle root. Without these a packaged app cannot export to either.
|
||||
datas += [
|
||||
("fixtures/rekordbox/schema.sql", "fixtures/rekordbox"),
|
||||
("fixtures/rekordbox/seed.sql", "fixtures/rekordbox"),
|
||||
("fixtures/onelibrary/schema.sql", "fixtures/onelibrary"),
|
||||
("fixtures/onelibrary/seed.sql", "fixtures/onelibrary"),
|
||||
# The "Rekordbox Export" target starts from rekordbox's own empty device library.
|
||||
("fixtures/rekordbox/device/export.pdb", "fixtures/rekordbox/device"),
|
||||
("fixtures/rekordbox/device/exportExt.pdb", "fixtures/rekordbox/device"),
|
||||
]
|
||||
# Which stem engine this build needs, and the pinned weights (read at import by
|
||||
# konduktor/stems/engine_manager.py).
|
||||
datas += [
|
||||
("konduktor/stems/engine.json", "konduktor/stems"),
|
||||
("konduktor/stems/weights.json", "konduktor/stems"),
|
||||
]
|
||||
# The key-detection network's weights (konduktor/core/key_detect.py).
|
||||
datas += [("konduktor/core/key_model.npz", "konduktor/core")]
|
||||
|
||||
a = Analysis(
|
||||
["sidecar.py"],
|
||||
pathex=[],
|
||||
@@ -52,9 +90,8 @@ pyz = PYZ(a.pure)
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
[],
|
||||
exclude_binaries=True,
|
||||
name="konduktor-sidecar",
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
@@ -67,3 +104,12 @@ exe = EXE(
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
|
||||
coll = COLLECT(
|
||||
exe,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
strip=False,
|
||||
upx=False,
|
||||
name="konduktor-sidecar",
|
||||
)
|
||||
@@ -0,0 +1,13 @@
|
||||
"""Per-platform adapters. Each owns a native library model and translates the
|
||||
generic commands onto it; nothing outside an adapter package sees a native type.
|
||||
|
||||
Importing this package registers every adapter. Order matters only for the
|
||||
registry's ``can_open()`` probe, and the probes are mutually exclusive: Traktor
|
||||
requires an NML header, Rekordbox an encrypted database with its own schema, and
|
||||
OneLibrary a drive laid out around ``PIONEER/rekordbox/exportLibrary.db``. The
|
||||
two encrypted databases cannot be confused for one another — they use different
|
||||
SQLCipher keys, so each driver's decrypt fails outright on the other's file.
|
||||
"""
|
||||
from . import onelibrary # noqa: F401 — registers the OneLibrary driver
|
||||
from . import rekordbox # noqa: F401 — registers the Rekordbox driver
|
||||
from . import traktor # noqa: F401 — registers the Traktor driver
|
||||
@@ -0,0 +1,16 @@
|
||||
"""The OneLibrary adapter: the cross-vendor USB export format.
|
||||
|
||||
Importing this package registers the platform for READING (a plugged-in drive)
|
||||
and as an export TARGET (writing a fresh drive). Two registries, because opening
|
||||
a library and creating one from nothing are different capabilities.
|
||||
"""
|
||||
from ...core import export as core_export
|
||||
from ...core import registry
|
||||
from .driver import OneLibraryDriver
|
||||
from .export import OneLibraryExporter
|
||||
|
||||
ONELIBRARY = OneLibraryDriver()
|
||||
registry.register(ONELIBRARY)
|
||||
|
||||
ONELIBRARY_EXPORTER = OneLibraryExporter()
|
||||
core_export.register(ONELIBRARY_EXPORTER)
|
||||
@@ -0,0 +1,615 @@
|
||||
"""The OneLibrary adapter: owns the drive's database and the generic projection.
|
||||
|
||||
Mirrors `adapters.rekordbox.adapter`. It holds:
|
||||
|
||||
* a ``OneLibraryStore`` — the retained NATIVE model (the open drive),
|
||||
* a ``TrackIndex`` — the generic READ projection built from it.
|
||||
|
||||
**Editable when opened as THE library**, with parity with the Rekordbox adapter
|
||||
as the goal (decisions: `.claude/discussions/discuss-onelibrary-editing-2026-10-01.md`).
|
||||
Opened `read_only` — as the sidebar's Devices do, beside the loaded library — it
|
||||
reports `writable=False` with cause `browsing`, and every command is refused.
|
||||
|
||||
What a write must look like was MEASURED by diffing a stick before and after
|
||||
rekordbox 7 edited it, rather than guessed: the update counters a drive carries
|
||||
do NOT move, and the `cue` table stays empty. Landing in steps — track metadata,
|
||||
playlists, hot cues and the beatgrid so far; adding and removing tracks next —
|
||||
and every command not written yet is refused, with its capability flag False so
|
||||
the UI never offers it.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from ...core.adapter import InvalidCommand, Unsupported, local_audio_facts
|
||||
from ...core.capabilities import Capabilities
|
||||
from ...core.model import GridMarker, HotcueChip, PlaylistNode, Track, TrackCues
|
||||
from ...core.pathmap import PathMapping, common_dir_prefix
|
||||
from ...core.query import TrackIndex
|
||||
from ..rekordbox import memory_palette, palette
|
||||
from ..rekordbox.cue_types import WRITABLE_CUE_TYPES
|
||||
from ...exporter import MANIFEST_NAME
|
||||
from . import capabilities as caps
|
||||
from . import projection
|
||||
from .store import OneLibraryStore
|
||||
|
||||
# `playlist.attribute`, from pyrekordbox's own enum. A drive carries no smart
|
||||
# playlists — rekordbox resolves them to static lists on export, because a CDJ
|
||||
# cannot evaluate rules — but the value is handled rather than assumed absent.
|
||||
ATTRIBUTE_PLAYLIST = 0
|
||||
ATTRIBUTE_FOLDER = 1
|
||||
ATTRIBUTE_SMART = 4
|
||||
|
||||
|
||||
class OneLibraryAdapter:
|
||||
platform = "onelibrary"
|
||||
|
||||
def __init__(self, path: Path, *, read_only: bool = False):
|
||||
self.path = Path(path)
|
||||
self.read_only = read_only
|
||||
self._store = OneLibraryStore(self.path, read_only=read_only)
|
||||
self._index = TrackIndex()
|
||||
self._rebuild()
|
||||
|
||||
# ---- projection maintenance -----------------------------------------
|
||||
def _rebuild(self) -> None:
|
||||
from ...core.stem_file import is_stem_file
|
||||
|
||||
tracks = []
|
||||
for row in self._store.iter_content():
|
||||
path = self._drive_path(row)
|
||||
tracks.append(projection.to_track(
|
||||
row, path, stem=bool(path) and is_stem_file(path)))
|
||||
self._index.rebuild(tracks)
|
||||
|
||||
def _drive_path(self, row) -> str | None:
|
||||
# Through the store: an added track plays from its incoming copy until
|
||||
# Save puts it in place.
|
||||
resolved = self._store.resolve_audio(getattr(row, "path", None))
|
||||
return str(resolved) if resolved is not None else None
|
||||
|
||||
def close(self) -> None:
|
||||
"""Release the database and its file handle.
|
||||
|
||||
More than housekeeping here: the library is on a removable drive, and a
|
||||
held handle is what stops it ejecting.
|
||||
"""
|
||||
self._store.close()
|
||||
|
||||
def reload(self) -> None:
|
||||
"""Re-read the drive, DISCARDING unsaved edits."""
|
||||
self._store.discard()
|
||||
self._rebuild()
|
||||
|
||||
def _refresh(self, track_id: str) -> None:
|
||||
"""Re-project one track after a command, so the UI cannot go stale."""
|
||||
from ...core.stem_file import is_stem_file
|
||||
|
||||
row = self._store.content(track_id)
|
||||
path = self._drive_path(row)
|
||||
self._index.replace(projection.to_track(row, path, stem=bool(path) and is_stem_file(path)))
|
||||
|
||||
# ---- identity --------------------------------------------------------
|
||||
def capabilities(self) -> Capabilities:
|
||||
return caps.capabilities_for(
|
||||
device_name=self._store.device_name,
|
||||
version=self._store.db_version,
|
||||
read_only=self.read_only,
|
||||
editable_fields=sorted(OneLibraryStore.EDITABLE_FIELDS),
|
||||
# A drive an export set wrote carries the export's manifest at its root.
|
||||
managed_by_export=(self._store.layout.root / MANIFEST_NAME).is_file(),
|
||||
)
|
||||
|
||||
# ---- read ------------------------------------------------------------
|
||||
@property
|
||||
def tracks(self) -> list[Track]:
|
||||
return self._index.tracks
|
||||
|
||||
@property
|
||||
def by_key(self) -> dict[str, Track]:
|
||||
return self._index.by_key
|
||||
|
||||
def track(self, track_id: str) -> Track | None:
|
||||
return self._index.get(track_id)
|
||||
|
||||
def query_tracks(self, **kw):
|
||||
return self._index.query_tracks(**kw)
|
||||
|
||||
def facets(self):
|
||||
return self._index.facets()
|
||||
|
||||
def stats(self, playlist_count: int):
|
||||
return self._index.stats(playlist_count)
|
||||
|
||||
def playlist_count(self) -> int:
|
||||
return self._store.count_playlists()
|
||||
|
||||
def track_cues(self, track_id: str) -> TrackCues | None:
|
||||
"""A track's cues and beatgrid — and where the approximate counts get fixed.
|
||||
|
||||
`projection.to_track` cannot afford the track's analysis files at open
|
||||
(~23 ms each for the `.EXT`), so it reports no cues and a guessed marker
|
||||
count. This is the moment the real numbers exist, so the projected track
|
||||
is corrected here rather than being left disagreeing with the deck.
|
||||
"""
|
||||
if self._index.get(track_id) is None:
|
||||
return None
|
||||
cues = self._store.cues(track_id)
|
||||
grid = self._store.anlz_grid(track_id)
|
||||
from . import beatgrid
|
||||
|
||||
markers = beatgrid.markers_from_beats(*grid) if grid is not None else []
|
||||
result = projection.to_track_cues(cues, markers)
|
||||
|
||||
track = self._index.get(track_id)
|
||||
if track is not None:
|
||||
track.grid_marker_count = len(result.grid_markers)
|
||||
track.cue_count = len(result.cues)
|
||||
track.hotcues = sorted(
|
||||
(
|
||||
HotcueChip(slot=c.slot, type=c.type, color=c.color)
|
||||
for c in result.cues
|
||||
if c.role == "hotcue" and c.slot is not None
|
||||
),
|
||||
key=lambda chip: chip.slot,
|
||||
)
|
||||
track.hotcue_count = len(track.hotcues)
|
||||
return result
|
||||
|
||||
# ---- playlists -------------------------------------------------------
|
||||
def playlist_tree(self) -> list[PlaylistNode]:
|
||||
"""The drive's playlist tree: a flat table with `playlist_id_parent` links.
|
||||
|
||||
A root node's parent is 0, not NULL — so "no parent" is a value here
|
||||
rather than an absence, and treating 0 as a real id would orphan every
|
||||
top-level playlist.
|
||||
"""
|
||||
rows = sorted(self._store.playlists(),
|
||||
key=lambda r: (int(getattr(r, "sequenceNo", 0) or 0), int(r.playlist_id)))
|
||||
writable = not self.read_only
|
||||
nodes: dict[str, PlaylistNode] = {}
|
||||
parents: dict[str, str] = {}
|
||||
|
||||
for r in rows:
|
||||
attribute = int(getattr(r, "attribute", 0) or 0)
|
||||
if attribute == ATTRIBUTE_FOLDER:
|
||||
kind = "folder"
|
||||
elif attribute == ATTRIBUTE_SMART:
|
||||
kind = "smart"
|
||||
else:
|
||||
kind = "playlist"
|
||||
node_id = str(getattr(r, "playlist_id", ""))
|
||||
nodes[node_id] = PlaylistNode(
|
||||
id=node_id,
|
||||
name=getattr(r, "name", "") or "",
|
||||
kind=kind,
|
||||
count=(0 if kind == "folder" else len(self._store.playlist_song_ids(node_id))),
|
||||
children=[],
|
||||
selectable=kind == "playlist",
|
||||
# Opened read-only, every flag is False and
|
||||
# `capabilities.writable` tells the UI why, once.
|
||||
can_add_tracks=writable and kind == "playlist",
|
||||
can_reorder=writable and kind == "playlist",
|
||||
can_rename=writable,
|
||||
can_delete=writable,
|
||||
can_contain_children=kind == "folder",
|
||||
can_move=writable,
|
||||
)
|
||||
parent = str(getattr(r, "playlist_id_parent", 0) or 0)
|
||||
parents[node_id] = "root" if parent in ("0", "", "None") else parent
|
||||
|
||||
roots: list[PlaylistNode] = []
|
||||
for node_id, node in nodes.items():
|
||||
parent = nodes.get(parents.get(node_id, "root"))
|
||||
if parent is None:
|
||||
roots.append(node)
|
||||
else:
|
||||
parent.children.append(node)
|
||||
return roots
|
||||
|
||||
def playlist_entries(self, node_id: str) -> list[str] | None:
|
||||
ids = self._store.playlist_song_ids(node_id)
|
||||
return ids if ids or self._is_playlist(node_id) else None
|
||||
|
||||
def playlist_tracks(self, node_id: str) -> list[Track] | None:
|
||||
keys = self.playlist_entries(node_id)
|
||||
if keys is None:
|
||||
return None
|
||||
return [t for k in keys if (t := self._index.get(k)) is not None]
|
||||
|
||||
def _is_playlist(self, node_id: str) -> bool:
|
||||
return any(str(getattr(r, "playlist_id", "")) == str(node_id) for r in self._store.playlists())
|
||||
|
||||
# ---- audio / paths ----------------------------------------------------
|
||||
def audio_path(self, track_id: str):
|
||||
return self._store.audio_path(track_id)
|
||||
|
||||
def audio_facts(self, track_ids: list[str]):
|
||||
return local_audio_facts(self, track_ids)
|
||||
|
||||
def set_path_mapping(self, mapping: PathMapping) -> None:
|
||||
"""Ignored: a drive's paths are relative to wherever it is mounted.
|
||||
|
||||
Path remapping exists because a desktop library stores absolute paths
|
||||
that go stale when music moves. A OneLibrary drive stores everything
|
||||
relative to its own root, so it is self-contained by construction and
|
||||
there is nothing for a mapping to fix.
|
||||
"""
|
||||
return None
|
||||
|
||||
def unresolved_path_groups(self) -> list:
|
||||
"""None, ever: a drive's paths are relative to its own mount point."""
|
||||
return []
|
||||
|
||||
def set_session_mappings(self, mappings: list[PathMapping]) -> None:
|
||||
return None
|
||||
|
||||
def path_prefix_suggestions(self) -> dict:
|
||||
paths = self._store.all_audio_paths()
|
||||
primary = common_dir_prefix(paths)
|
||||
return {
|
||||
"primary": primary,
|
||||
"groups": [{"prefix": primary, "count": len(paths)}] if primary else [],
|
||||
}
|
||||
|
||||
def remap_preview(self, mapping: PathMapping) -> dict:
|
||||
paths = [Path(p) for p in self._store.all_audio_paths()]
|
||||
return {"total": len(paths), "matched": 0, "existing": 0, "samples": []}
|
||||
|
||||
def remap_locations(self, mapping: PathMapping) -> dict[str, str]:
|
||||
raise Unsupported(self._readonly_reason("Rewriting stored paths"))
|
||||
|
||||
# ---- save -------------------------------------------------------------
|
||||
@property
|
||||
def dirty(self) -> bool:
|
||||
return self._store.dirty
|
||||
|
||||
def save(self):
|
||||
self._require_writable("Saving")
|
||||
outcome = self._store.save()
|
||||
# Save MOVES files (an added track's audio leaves its incoming copy), so
|
||||
# the projection is rebuilt from what is now on the drive.
|
||||
self._rebuild()
|
||||
return outcome
|
||||
|
||||
def snapshot(self) -> bytes:
|
||||
raise Unsupported("OneLibrary drives are not versioned by Konduktor")
|
||||
|
||||
# ---- commands -----------------------------------------------------------
|
||||
def _readonly_reason(self, what: str) -> str:
|
||||
if self.read_only:
|
||||
return (f"{what} is not possible while the drive is open for browsing. "
|
||||
"Open it for editing to change it.")
|
||||
return f"{what} is not supported yet for OneLibrary drives."
|
||||
|
||||
def _refuse(self, what: str):
|
||||
raise Unsupported(self._readonly_reason(what))
|
||||
|
||||
def _require_writable(self, what: str) -> None:
|
||||
"""Every write passes through here, so a command added later cannot
|
||||
forget that a browsing drive is read-only."""
|
||||
if self.read_only:
|
||||
self._refuse(what)
|
||||
|
||||
# ---- audio placement (`tracks.places_audio`) ----------------------------
|
||||
def audio_home(self) -> Path:
|
||||
return self._store.audio_home()
|
||||
|
||||
def place_audio(self, source: Path, track) -> Path | None:
|
||||
self._require_writable("Adding tracks")
|
||||
return self._store.place_audio(source, track)
|
||||
|
||||
def add_tracks(self, items: list, *, checkpoint=None) -> list[str]:
|
||||
"""Add tracks, each arriving ready to prep — as the Rekordbox adapter does.
|
||||
|
||||
A drive keeps the beatgrid, cues and waveforms in per-track analysis
|
||||
files, and rekordbox shows neither grid nor cues without them, so every
|
||||
file is decoded ONCE here and its `.DAT`/`.EXT`/`.2EX` built by the
|
||||
OneLibrary exporter's own writer — the files rekordbox 7 was verified
|
||||
to read. A file with no grid of its own gets Konduktor's.
|
||||
|
||||
Two phases, as in Rekordbox: FIRST the slow, cancellable part (decoding,
|
||||
grid detection, building the analysis and artwork bytes) before the
|
||||
library is touched; THEN the rows, with hot cues replayed through the
|
||||
ordinary `set_cue` so they keep its conventions. Memory cues — and a hot
|
||||
cue with no free pad — cross as memory cues, written with the files.
|
||||
`audio_path` is where `place_audio` said to copy it (or the file itself,
|
||||
already on the stick); Save moves copies into place.
|
||||
"""
|
||||
from ...core import audio_tags, grid_detect, key_detect, waveform
|
||||
from ...core.export import ExportTrack
|
||||
from ..rekordbox import artwork, timebase
|
||||
from .export import OneLibraryExporter
|
||||
|
||||
self._require_writable("Adding tracks")
|
||||
exporter = OneLibraryExporter()
|
||||
prepared = []
|
||||
total = len(items)
|
||||
for n, item in enumerate(items, start=1):
|
||||
audio = Path(item.audio_path)
|
||||
if checkpoint is not None:
|
||||
checkpoint(f"Analysing {item.track.title or audio.name} ({n}/{total})", step=n, of=total)
|
||||
if not audio.is_file():
|
||||
raise InvalidCommand(f"No audio file at {audio}")
|
||||
try:
|
||||
rel = self._store.drive_relative(self._store.final_of(audio))
|
||||
except ValueError:
|
||||
raise InvalidCommand(f"{audio} is not on this drive") from None
|
||||
samples = waveform.decode(audio)
|
||||
measured = waveform.analyse_samples(samples, lead=timebase.offset(audio))
|
||||
markers = list(item.cues.grid_markers) if item.cues else []
|
||||
if not markers and samples is not None:
|
||||
try:
|
||||
found = grid_detect.detect_grid(str(audio), y=samples, sr=waveform.SR)
|
||||
markers = [GridMarker(start=found.anchor, bpm=found.bpm)]
|
||||
except ValueError:
|
||||
pass # no pulse to fit (a one-shot, silence): no grid
|
||||
hot, memory, taken = [], [], set()
|
||||
for cue in sorted((item.cues.cues if item.cues else []), key=lambda c: c.start):
|
||||
if (cue.role == "hotcue" and cue.slot is not None
|
||||
and 0 <= cue.slot < caps.HOTCUE_SLOTS and cue.slot not in taken):
|
||||
hot.append(cue)
|
||||
taken.add(cue.slot)
|
||||
else:
|
||||
memory.append(cue.model_copy(update={"role": "memory", "slot": None}))
|
||||
# A file with no key of its own gets one, as it gets a grid.
|
||||
track = key_detect.with_detected_key(item.track, samples, waveform.SR)
|
||||
export_track = ExportTrack(track=track, destination=audio,
|
||||
cues=TrackCues(grid_markers=markers, cues=memory))
|
||||
# Decoded once above; the writer must not decode it again.
|
||||
export_track.waveform = lambda *, lead=0.0, m=measured: m
|
||||
art = item.art or audio_tags.read_cover(audio)
|
||||
jpegs = artwork.pioneer_jpegs(art[0]) if art else None
|
||||
length = track.length or (int(measured.duration) if measured else None)
|
||||
prepared.append((item, track, audio, rel, exporter.anlz_files(export_track, rel), jpegs,
|
||||
markers, hot, length))
|
||||
|
||||
added: list[str] = []
|
||||
for item, track, audio, rel, anlz, jpegs, markers, hot, length in prepared:
|
||||
track_id = self._store.add_track(
|
||||
audio, track, rel=rel, anlz_rel=self._store._anlz_rel(rel), anlz=anlz,
|
||||
jpegs=jpegs, bpm=markers[0].bpm if markers else track.bpm, length=length)
|
||||
for cue in hot:
|
||||
self._store.set_cue(track_id, slot=cue.slot, start_sec=cue.start,
|
||||
cue_type="loop" if cue.length else "cue",
|
||||
length_sec=cue.length or 0.0, name=cue.name)
|
||||
code, _rgb = palette.code_for(cue.color)
|
||||
if cue.color and code:
|
||||
self._store.set_cue_color(track_id, cue.slot, code)
|
||||
added.append(track_id)
|
||||
self._rebuild()
|
||||
return added
|
||||
|
||||
def remove_tracks(self, track_ids: list[str]) -> int:
|
||||
"""Remove tracks — and, on a stick, their audio and analysis files at Save
|
||||
(decision 3: a stick's audio belongs to its library)."""
|
||||
self._require_writable("Removing tracks")
|
||||
n = self._store.remove_tracks(track_ids)
|
||||
if n:
|
||||
self._rebuild()
|
||||
return n
|
||||
|
||||
def apply_stem_swaps(self, swaps, *, add_to_playlist=None):
|
||||
self._refuse("Converting tracks to stems")
|
||||
|
||||
def set_track_metadata(self, track_id: str, fields: dict) -> Track | None:
|
||||
self._require_writable("Editing track metadata")
|
||||
self._store.set_track_metadata(track_id, fields)
|
||||
self._refresh(track_id)
|
||||
return self._index.get(track_id)
|
||||
|
||||
def set_key(self, track_id: str, wheel: int, mode: str) -> Track | None:
|
||||
self._require_writable("Setting the key")
|
||||
self._store.set_key(track_id, wheel, mode)
|
||||
self._refresh(track_id)
|
||||
return self._index.get(track_id)
|
||||
|
||||
def set_track_color(self, track_id: str, color: str | None) -> Track | None:
|
||||
self._require_writable("Setting the track colour")
|
||||
self._store.set_track_color(track_id, color)
|
||||
self._refresh(track_id)
|
||||
return self._index.get(track_id)
|
||||
|
||||
def analysis_lead(self, audio: Path) -> float:
|
||||
"""rekordbox's clock against the decoded audio (as for the Rekordbox
|
||||
adapter): what a regenerated waveform is measured at."""
|
||||
from ..rekordbox import timebase
|
||||
|
||||
return timebase.offset(Path(audio))
|
||||
|
||||
def audio_changed(self, track_id: str, change) -> Track | None:
|
||||
self._require_writable("Changing a track's level")
|
||||
self._store.audio_changed(track_id, change)
|
||||
self._refresh(track_id)
|
||||
return self._index.get(track_id)
|
||||
|
||||
def set_auto_gain(self, track_id: str, loudness) -> Track | None:
|
||||
# Measured (kit G2): no stick format carries an auto gain — not the
|
||||
# database, not export.pdb, not the analysis files. `tracks.auto_gain`
|
||||
# is False, so nothing offers it.
|
||||
raise Unsupported("A OneLibrary drive has no auto gain: level a stick by normalising its audio")
|
||||
|
||||
def set_cover_art(self, track_id: str, data: bytes, mime: str) -> None:
|
||||
self._refuse("Editing cover art")
|
||||
|
||||
def cover_art(self, track_id: str) -> tuple[bytes, str] | None:
|
||||
return self._store.cover_art(track_id)
|
||||
|
||||
def create_playlist(self, name: str, parent_id: str | None = None) -> str:
|
||||
self._require_writable("Creating playlists")
|
||||
return self._store.create_playlist(name, parent_id)
|
||||
|
||||
def create_folder(self, name: str, parent_id: str | None = None) -> str:
|
||||
self._require_writable("Creating playlist folders")
|
||||
return self._store.create_folder(name, parent_id)
|
||||
|
||||
def rename_playlist(self, node_id: str, name: str) -> None:
|
||||
self._require_writable("Renaming playlists")
|
||||
self._store.rename_playlist(node_id, name)
|
||||
|
||||
def delete_playlist(self, node_id: str) -> None:
|
||||
self._require_writable("Deleting playlists")
|
||||
self._store.delete_playlist(node_id)
|
||||
|
||||
def move_playlist(self, node_id: str, parent_id: str | None, index: int) -> str:
|
||||
self._require_writable("Moving playlists")
|
||||
return self._store.move_playlist(node_id, parent_id, index)
|
||||
|
||||
def set_playlist_entries(self, node_id: str, track_ids: list[str]) -> int:
|
||||
self._require_writable("Editing playlists")
|
||||
return self._store.set_playlist_entries(node_id, track_ids)
|
||||
|
||||
def _refresh_cues(self, track_id: str) -> TrackCues:
|
||||
"""Re-project a track AND return its fresh cues — every cue/grid command
|
||||
ends here, so a route can never serve a stale projection."""
|
||||
self._refresh(track_id)
|
||||
return self.track_cues(track_id) or TrackCues()
|
||||
|
||||
def _check_cue_type(self, cue_type: str) -> None:
|
||||
if cue_type not in WRITABLE_CUE_TYPES:
|
||||
raise Unsupported(f"OneLibrary has no cue type {cue_type!r}")
|
||||
|
||||
def set_cue(
|
||||
self,
|
||||
track_id: str,
|
||||
*,
|
||||
slot: int,
|
||||
start_sec: float,
|
||||
cue_type: str,
|
||||
length_sec: float = 0.0,
|
||||
role: str = "hotcue",
|
||||
name: str | None = None,
|
||||
) -> TrackCues:
|
||||
self._require_writable("Editing cues")
|
||||
if role != "hotcue":
|
||||
# A memory cue has no slot to set; it has its own commands.
|
||||
raise InvalidCommand("Memory cues are added with add_memory_cue, not set_cue")
|
||||
self._check_cue_type(cue_type)
|
||||
self._store.set_cue(track_id, slot=slot, start_sec=start_sec, cue_type=cue_type,
|
||||
length_sec=length_sec, name=name)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def set_cue_type(self, track_id: str, slot: int, cue_type: str) -> TrackCues:
|
||||
self._require_writable("Editing cues")
|
||||
self._check_cue_type(cue_type)
|
||||
self._store.set_cue_type(track_id, slot, cue_type)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def set_cue_color(self, track_id: str, slot: int, color: str | None) -> TrackCues:
|
||||
self._require_writable("Editing cues")
|
||||
code = None
|
||||
if color is not None:
|
||||
code = palette.swatch_code(color)
|
||||
if code is None:
|
||||
raise InvalidCommand(f"{color!r} is not one of rekordbox's hot cue colours")
|
||||
self._store.set_cue_color(track_id, slot, code)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def delete_cue(self, track_id: str, slot: int) -> TrackCues:
|
||||
self._require_writable("Deleting cues")
|
||||
self._store.delete_cue(track_id, slot)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def place_cues(self, track_id: str, cues: list, *, overwrite: bool = False) -> TrackCues:
|
||||
self._require_writable("Placing cues")
|
||||
for cue in cues:
|
||||
self._check_cue_type(getattr(cue, "type", "cue"))
|
||||
self._store.place_cues(track_id, cues, overwrite=overwrite)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
# ---- commands: memory cues --------------------------------------------
|
||||
@staticmethod
|
||||
def _memory_byte(color: str | None) -> int:
|
||||
if color is None:
|
||||
return 0
|
||||
code = memory_palette.code_for(color)
|
||||
if code is None:
|
||||
raise InvalidCommand(f"{color!r} is not one of rekordbox's memory cue colours")
|
||||
return memory_palette.anlz_byte(code)
|
||||
|
||||
def add_memory_cue(
|
||||
self,
|
||||
track_id: str,
|
||||
*,
|
||||
start_sec: float,
|
||||
cue_type: str,
|
||||
length_sec: float = 0.0,
|
||||
name: str | None = None,
|
||||
color: str | None = None,
|
||||
) -> TrackCues:
|
||||
self._require_writable("Editing cues")
|
||||
self._check_cue_type(cue_type)
|
||||
self._store.add_memory_cue(track_id, start_sec=start_sec, cue_type=cue_type,
|
||||
length_sec=length_sec, name=name,
|
||||
color_id=self._memory_byte(color))
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def rename_memory_cue(self, track_id: str, cue_id: str, name: str | None) -> TrackCues:
|
||||
self._require_writable("Editing cues")
|
||||
self._store.rename_memory_cue(track_id, cue_id, name)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def set_memory_cue_type(self, track_id: str, cue_id: str, cue_type: str) -> TrackCues:
|
||||
# rekordbox has one point type, so there is nothing to choose; a memory
|
||||
# cue is a cue or a loop by its length.
|
||||
raise Unsupported("rekordbox memory cues have no type to change")
|
||||
|
||||
def set_memory_cue_color(self, track_id: str, cue_id: str, color: str | None) -> TrackCues:
|
||||
self._require_writable("Editing cues")
|
||||
self._store.set_memory_cue_color(track_id, cue_id, self._memory_byte(color))
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def delete_memory_cue(self, track_id: str, cue_id: str) -> TrackCues:
|
||||
self._require_writable("Deleting cues")
|
||||
self._store.delete_memory_cue(track_id, cue_id)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
# ---- commands: beatgrid -----------------------------------------------
|
||||
@staticmethod
|
||||
def _markers_from(markers: list) -> list:
|
||||
"""Accept either GridMarkers or the (start, bpm) tuples routes send."""
|
||||
return [m if isinstance(m, GridMarker) else GridMarker(start=float(m[0]), bpm=float(m[1]))
|
||||
for m in markers]
|
||||
|
||||
def add_grid_marker(self, track_id: str, start_sec: float, bpm: float | None = None) -> TrackCues:
|
||||
self._require_writable("Editing the beatgrid")
|
||||
self._store.add_grid_marker(track_id, start_sec, bpm)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def move_grid_marker(self, track_id: str, index: int, start_sec: float) -> TrackCues:
|
||||
self._require_writable("Editing the beatgrid")
|
||||
self._store.move_grid_marker(track_id, index, start_sec)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def set_grid_marker_bpm(self, track_id: str, index: int, bpm: float) -> TrackCues:
|
||||
self._require_writable("Editing the beatgrid")
|
||||
self._store.set_grid_marker_bpm(track_id, index, bpm)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def delete_grid_marker(self, track_id: str, index: int) -> TrackCues:
|
||||
self._require_writable("Editing the beatgrid")
|
||||
self._store.delete_grid_marker(track_id, index)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def replace_grid(self, track_id: str, markers: list) -> TrackCues:
|
||||
self._require_writable("Editing the beatgrid")
|
||||
self._store.replace_grid(track_id, self._markers_from(markers))
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def set_analysed_grid(self, track_id: str, markers: list) -> TrackCues:
|
||||
"""An analysis result, as rekordbox's analyser would write it: nothing is
|
||||
paired with a marker (the companion cue is Traktor's), so a replace."""
|
||||
return self.replace_grid(track_id, markers)
|
||||
|
||||
def delete_grid(self, track_id: str) -> TrackCues:
|
||||
self._require_writable("Deleting the beatgrid")
|
||||
self._store.delete_grid(track_id)
|
||||
return self._refresh_cues(track_id)
|
||||
|
||||
def set_grid_lock(self, track_id: str, locked: bool) -> TrackCues:
|
||||
raise Unsupported("OneLibrary has no beatgrid lock")
|
||||
|
||||
def replace_cues(self, track_id: str, cues: TrackCues) -> TrackCues:
|
||||
# Only a DJ app's library on this computer is pushed into; a stick is
|
||||
# filled by an export.
|
||||
raise Unsupported("A OneLibrary drive is filled by an export, not a push")
|
||||
@@ -0,0 +1,66 @@
|
||||
"""A OneLibrary beatgrid -> the generic marker list.
|
||||
|
||||
**The beatgrid is not in the database.** `exportLibrary.db` has no grid table at
|
||||
all — `content.bpmx100` is a single display tempo — and the real grid is the
|
||||
`PQTZ` tag of the track's ANLZ `.DAT`, holding EVERY BEAT explicitly. That is the
|
||||
same arrangement, and the same tag, as a desktop Rekordbox library: a drive is
|
||||
exported from one, and rekordbox regenerates the analysis files rather than
|
||||
inventing a new format for them.
|
||||
|
||||
Verified end to end on a track whose flexible grid Konduktor itself had written
|
||||
into `master.db`: exporting it to a OneLibrary drive preserved both tempo
|
||||
segments exactly (128.00 BPM to 60 s, then 90.00 BPM), so multi-tempo grids
|
||||
survive the whole chain and the marker list is the right generic shape.
|
||||
|
||||
The collapse rule is shared with the Rekordbox adapter deliberately rather than
|
||||
copied. Two implementations of "when is this a new marker?" would be free to
|
||||
drift apart by a rounding tolerance, and a drifting grid is a silent corruption
|
||||
rather than a visible bug. If a third AlphaTheta-format adapter ever appears,
|
||||
this and `rekordbox.beatgrid` should be promoted to one shared ANLZ module; the
|
||||
import direction here is the cheapest way to stay honest until then.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from ...core.model import GridMarker
|
||||
from ..rekordbox.beatgrid import BPM_EPSILON, markers_from_beats # noqa: F401
|
||||
|
||||
__all__ = ["BPM_EPSILON", "markers_from_beats", "beats_from_pqtz", "markers_from_anlz"]
|
||||
|
||||
|
||||
def beats_from_pqtz(anlz) -> tuple[list[float], list[float], list[int]] | None:
|
||||
"""Per-beat ``(times_sec, bpms, beat_in_bar)`` from a parsed ANLZ file's `PQTZ` tag
|
||||
(an `anlz_file.AnlzFile`).
|
||||
|
||||
Returns None when the file has no `PQTZ` — which is a real state, not an
|
||||
error: rekordbox analyses one-shot samples too, and gives them an analysis
|
||||
file with no beatgrid in it.
|
||||
|
||||
`PQTZ` stores time in milliseconds and tempo in hundredths of a BPM.
|
||||
"""
|
||||
for tag in getattr(anlz, "tags", []):
|
||||
if tag.type != "PQTZ":
|
||||
continue
|
||||
entries = tag.entries
|
||||
if not entries:
|
||||
return None
|
||||
times: list[float] = []
|
||||
bpms: list[float] = []
|
||||
beats: list[int] = []
|
||||
for e in entries:
|
||||
try:
|
||||
time, tempo, beat = int(e.time) / 1000.0, int(e.tempo) / 100.0, int(e.beat)
|
||||
except (AttributeError, TypeError, ValueError):
|
||||
continue
|
||||
times.append(time)
|
||||
bpms.append(tempo)
|
||||
beats.append(beat)
|
||||
return (times, bpms, beats) if times else None
|
||||
return None
|
||||
|
||||
|
||||
def markers_from_anlz(anlz) -> list[GridMarker]:
|
||||
"""The generic marker list for a parsed ANLZ file."""
|
||||
grid = beats_from_pqtz(anlz)
|
||||
if grid is None:
|
||||
return []
|
||||
return markers_from_beats(*grid)
|
||||
Loaded 100 of 465 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user