Implemented OneLibrary adapter base

This commit is contained in:
patben8 committed 2026-09-22 16:43:12 +02:00
1 parent 7b0d7e3a07
commit 0b38d4826f
30 files changed
+2068 -22

No files matched your search

@@ -0,0 +1 @@
placeholder
@@ -0,0 +1 @@
placeholder
Binary file not shown.
+58
View File
@@ -0,0 +1,58 @@
# 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.
+208
View File
@@ -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
);