@andyfarthing/prolink-connect
Version:
Fork of prolink-connect with modern build system and fixes
1,229 lines (1,225 loc) • 173 kB
JavaScript
import {createRequire} from 'module';
const require = createRequire(import.meta.url);
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
// ksy:/home/runner/work/prolink-connect/prolink-connect/src/localdb/kaitai/rekordbox_anlz.ksy
var require_rekordbox_anlz = __commonJS({
"ksy:/home/runner/work/prolink-connect/prolink-connect/src/localdb/kaitai/rekordbox_anlz.ksy"(exports, module) {
"use strict";
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define(["kaitai-struct/KaitaiStream"], factory);
} else if (typeof module === "object" && module.exports) {
module.exports = factory(__require("kaitai-struct/KaitaiStream"));
} else {
root.RekordboxAnlz = factory(root.KaitaiStream);
}
})(typeof self !== "undefined" ? self : exports, function(KaitaiStream2) {
var RekordboxAnlz = function() {
RekordboxAnlz2.CueEntryStatus = Object.freeze({
DISABLED: 0,
ENABLED: 1,
0: "DISABLED",
1: "ENABLED"
});
RekordboxAnlz2.CueListType = Object.freeze({
MEMORY_CUES: 0,
HOT_CUES: 1,
0: "MEMORY_CUES",
1: "HOT_CUES"
});
RekordboxAnlz2.MoodHighPhrase = Object.freeze({
INTRO: 1,
UP: 2,
DOWN: 3,
CHORUS: 5,
OUTRO: 6,
1: "INTRO",
2: "UP",
3: "DOWN",
5: "CHORUS",
6: "OUTRO"
});
RekordboxAnlz2.TrackBank = Object.freeze({
DEFAULT: 0,
COOL: 1,
NATURAL: 2,
HOT: 3,
SUBTLE: 4,
WARM: 5,
VIVID: 6,
CLUB_1: 7,
CLUB_2: 8,
0: "DEFAULT",
1: "COOL",
2: "NATURAL",
3: "HOT",
4: "SUBTLE",
5: "WARM",
6: "VIVID",
7: "CLUB_1",
8: "CLUB_2"
});
RekordboxAnlz2.CueEntryType = Object.freeze({
MEMORY_CUE: 1,
LOOP: 2,
1: "MEMORY_CUE",
2: "LOOP"
});
RekordboxAnlz2.SectionTags = Object.freeze({
CUES_2: 1346588466,
CUES: 1346588482,
PATH: 1347441736,
BEAT_GRID: 1347507290,
SONG_STRUCTURE: 1347638089,
VBR: 1347830354,
WAVE_PREVIEW: 1347895638,
WAVE_TINY: 1347900978,
WAVE_SCROLL: 1347900979,
WAVE_COLOR_PREVIEW: 1347900980,
WAVE_COLOR_SCROLL: 1347900981,
1346588466: "CUES_2",
1346588482: "CUES",
1347441736: "PATH",
1347507290: "BEAT_GRID",
1347638089: "SONG_STRUCTURE",
1347830354: "VBR",
1347895638: "WAVE_PREVIEW",
1347900978: "WAVE_TINY",
1347900979: "WAVE_SCROLL",
1347900980: "WAVE_COLOR_PREVIEW",
1347900981: "WAVE_COLOR_SCROLL"
});
RekordboxAnlz2.TrackMood = Object.freeze({
HIGH: 1,
MID: 2,
LOW: 3,
1: "HIGH",
2: "MID",
3: "LOW"
});
RekordboxAnlz2.MoodMidPhrase = Object.freeze({
INTRO: 1,
VERSE_1: 2,
VERSE_2: 3,
VERSE_3: 4,
VERSE_4: 5,
VERSE_5: 6,
VERSE_6: 7,
BRIDGE: 8,
CHORUS: 9,
OUTRO: 10,
1: "INTRO",
2: "VERSE_1",
3: "VERSE_2",
4: "VERSE_3",
5: "VERSE_4",
6: "VERSE_5",
7: "VERSE_6",
8: "BRIDGE",
9: "CHORUS",
10: "OUTRO"
});
RekordboxAnlz2.MoodLowPhrase = Object.freeze({
INTRO: 1,
VERSE_1: 2,
VERSE_1B: 3,
VERSE_1C: 4,
VERSE_2: 5,
VERSE_2B: 6,
VERSE_2C: 7,
BRIDGE: 8,
CHORUS: 9,
OUTRO: 10,
1: "INTRO",
2: "VERSE_1",
3: "VERSE_1B",
4: "VERSE_1C",
5: "VERSE_2",
6: "VERSE_2B",
7: "VERSE_2C",
8: "BRIDGE",
9: "CHORUS",
10: "OUTRO"
});
function RekordboxAnlz2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
RekordboxAnlz2.prototype._read = function() {
this.magic = this._io.readBytes(4);
if (!(KaitaiStream2.byteArrayCompare(this.magic, [80, 77, 65, 73]) == 0)) {
throw new KaitaiStream2.ValidationNotEqualError([80, 77, 65, 73], this.magic, this._io, "/seq/0");
}
this.lenHeader = this._io.readU4be();
this.lenFile = this._io.readU4be();
this._unnamed3 = this._io.readBytes(this.lenHeader - this._io.pos);
this.sections = [];
var i = 0;
while (!this._io.isEof()) {
this.sections.push(new TaggedSection(this._io, this, this._root));
i++;
}
};
var PhraseMid = RekordboxAnlz2.PhraseMid = function() {
function PhraseMid2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
PhraseMid2.prototype._read = function() {
this.id = this._io.readU2be();
};
return PhraseMid2;
}();
var PathTag = RekordboxAnlz2.PathTag = function() {
function PathTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
PathTag2.prototype._read = function() {
this.lenPath = this._io.readU4be();
if (this.lenPath > 1) {
this.path = KaitaiStream2.bytesToStr(this._io.readBytes(this.lenPath - 2), "utf-16be");
}
};
return PathTag2;
}();
var WavePreviewTag = RekordboxAnlz2.WavePreviewTag = function() {
function WavePreviewTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
WavePreviewTag2.prototype._read = function() {
this.lenPreview = this._io.readU4be();
this._unnamed1 = this._io.readU4be();
if (this._parent.lenTag > this._parent.lenHeader) {
this.data = this._io.readBytes(this.lenPreview);
}
};
return WavePreviewTag2;
}();
var BeatGridTag = RekordboxAnlz2.BeatGridTag = function() {
function BeatGridTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
BeatGridTag2.prototype._read = function() {
this._unnamed0 = this._io.readU4be();
this._unnamed1 = this._io.readU4be();
this.lenBeats = this._io.readU4be();
this.beats = [];
for (var i = 0; i < this.lenBeats; i++) {
this.beats.push(new BeatGridBeat(this._io, this, this._root));
}
};
return BeatGridTag2;
}();
var SongStructureBody = RekordboxAnlz2.SongStructureBody = function() {
function SongStructureBody2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
SongStructureBody2.prototype._read = function() {
this.mood = this._io.readU2be();
this._unnamed1 = this._io.readBytes(6);
this.endBeat = this._io.readU2be();
this._unnamed3 = this._io.readBytes(2);
this.bank = this._io.readU1();
this._unnamed5 = this._io.readBytes(1);
this.entries = [];
for (var i = 0; i < this._parent.lenEntries; i++) {
this.entries.push(new SongStructureEntry(this._io, this, this._root));
}
};
return SongStructureBody2;
}();
var WaveColorPreviewTag = RekordboxAnlz2.WaveColorPreviewTag = function() {
function WaveColorPreviewTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
WaveColorPreviewTag2.prototype._read = function() {
this.lenEntryBytes = this._io.readU4be();
this.lenEntries = this._io.readU4be();
this._unnamed2 = this._io.readU4be();
this.entries = this._io.readBytes(this.lenEntries * this.lenEntryBytes);
};
return WaveColorPreviewTag2;
}();
var PhraseHigh = RekordboxAnlz2.PhraseHigh = function() {
function PhraseHigh2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
PhraseHigh2.prototype._read = function() {
this.id = this._io.readU2be();
};
return PhraseHigh2;
}();
var WaveScrollTag = RekordboxAnlz2.WaveScrollTag = function() {
function WaveScrollTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
WaveScrollTag2.prototype._read = function() {
this.lenEntryBytes = this._io.readU4be();
this.lenEntries = this._io.readU4be();
this._unnamed2 = this._io.readU4be();
this.entries = this._io.readBytes(this.lenEntries * this.lenEntryBytes);
};
return WaveScrollTag2;
}();
var SongStructureTag = RekordboxAnlz2.SongStructureTag = function() {
function SongStructureTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
SongStructureTag2.prototype._read = function() {
this.lenEntryBytes = this._io.readU4be();
this.lenEntries = this._io.readU2be();
this._raw__raw_body = this._io.readBytesFull();
this._raw_body = KaitaiStream2.processXorMany(this._raw__raw_body, this.mask);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new SongStructureBody(_io__raw_body, this, this._root);
};
Object.defineProperty(SongStructureTag2.prototype, "c", {
get: function() {
if (this._m_c !== void 0)
return this._m_c;
this._m_c = this.lenEntries;
return this._m_c;
}
});
Object.defineProperty(SongStructureTag2.prototype, "mask", {
get: function() {
if (this._m_mask !== void 0)
return this._m_mask;
this._m_mask = new Uint8Array([203 + this.c, 225 + this.c, 238 + this.c, 250 + this.c, 229 + this.c, 238 + this.c, 173 + this.c, 238 + this.c, 233 + this.c, 210 + this.c, 233 + this.c, 235 + this.c, 225 + this.c, 233 + this.c, 243 + this.c, 232 + this.c, 233 + this.c, 244 + this.c, 225 + this.c]);
return this._m_mask;
}
});
return SongStructureTag2;
}();
var CueExtendedEntry = RekordboxAnlz2.CueExtendedEntry = function() {
function CueExtendedEntry2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
CueExtendedEntry2.prototype._read = function() {
this.magic = this._io.readBytes(4);
if (!(KaitaiStream2.byteArrayCompare(this.magic, [80, 67, 80, 50]) == 0)) {
throw new KaitaiStream2.ValidationNotEqualError([80, 67, 80, 50], this.magic, this._io, "/types/cue_extended_entry/seq/0");
}
this.lenHeader = this._io.readU4be();
this.lenEntry = this._io.readU4be();
this.hotCue = this._io.readU4be();
this.type = this._io.readU1();
this._unnamed5 = this._io.readBytes(3);
this.time = this._io.readU4be();
this.loopTime = this._io.readU4be();
this.colorId = this._io.readU1();
this._unnamed9 = this._io.readBytes(11);
if (this.lenEntry > 43) {
this.lenComment = this._io.readU4be();
}
if (this.lenEntry > 43) {
this.comment = KaitaiStream2.bytesToStr(this._io.readBytes(this.lenComment), "utf-16be");
}
if (this.lenEntry - this.lenComment > 44) {
this.colorCode = this._io.readU1();
}
if (this.lenEntry - this.lenComment > 45) {
this.colorRed = this._io.readU1();
}
if (this.lenEntry - this.lenComment > 46) {
this.colorGreen = this._io.readU1();
}
if (this.lenEntry - this.lenComment > 47) {
this.colorBlue = this._io.readU1();
}
if (this.lenEntry - this.lenComment > 48) {
this._unnamed16 = this._io.readBytes(this.lenEntry - 48 - this.lenComment);
}
};
return CueExtendedEntry2;
}();
var VbrTag = RekordboxAnlz2.VbrTag = function() {
function VbrTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
VbrTag2.prototype._read = function() {
this._unnamed0 = this._io.readU4be();
this.index = [];
for (var i = 0; i < 400; i++) {
this.index.push(this._io.readU4be());
}
};
return VbrTag2;
}();
var SongStructureEntry = RekordboxAnlz2.SongStructureEntry = function() {
function SongStructureEntry2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
SongStructureEntry2.prototype._read = function() {
this.phraseNumber = this._io.readU2be();
this.beatNumber = this._io.readU2be();
switch (this._parent.mood) {
case RekordboxAnlz2.TrackMood.HIGH:
this.kind = new PhraseHigh(this._io, this, this._root);
break;
case RekordboxAnlz2.TrackMood.MID:
this.kind = new PhraseMid(this._io, this, this._root);
break;
case RekordboxAnlz2.TrackMood.LOW:
this.kind = new PhraseLow(this._io, this, this._root);
break;
default:
this.kind = new UnknownTag(this._io, this, this._root);
break;
}
this._unnamed3 = this._io.readBytes(this._parent._parent.lenEntryBytes - 9);
this.fillIn = this._io.readU1();
this.fillInBeatNumber = this._io.readU2be();
};
return SongStructureEntry2;
}();
var CueEntry = RekordboxAnlz2.CueEntry = function() {
function CueEntry2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
CueEntry2.prototype._read = function() {
this.magic = this._io.readBytes(4);
if (!(KaitaiStream2.byteArrayCompare(this.magic, [80, 67, 80, 84]) == 0)) {
throw new KaitaiStream2.ValidationNotEqualError([80, 67, 80, 84], this.magic, this._io, "/types/cue_entry/seq/0");
}
this.lenHeader = this._io.readU4be();
this.lenEntry = this._io.readU4be();
this.hotCue = this._io.readU4be();
this.status = this._io.readU4be();
this._unnamed5 = this._io.readU4be();
this.orderFirst = this._io.readU2be();
this.orderLast = this._io.readU2be();
this.type = this._io.readU1();
this._unnamed9 = this._io.readBytes(3);
this.time = this._io.readU4be();
this.loopTime = this._io.readU4be();
this._unnamed12 = this._io.readBytes(16);
};
return CueEntry2;
}();
var BeatGridBeat = RekordboxAnlz2.BeatGridBeat = function() {
function BeatGridBeat2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
BeatGridBeat2.prototype._read = function() {
this.beatNumber = this._io.readU2be();
this.tempo = this._io.readU2be();
this.time = this._io.readU4be();
};
return BeatGridBeat2;
}();
var CueExtendedTag = RekordboxAnlz2.CueExtendedTag = function() {
function CueExtendedTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
CueExtendedTag2.prototype._read = function() {
this.type = this._io.readU4be();
this.lenCues = this._io.readU2be();
this._unnamed2 = this._io.readBytes(2);
this.cues = [];
for (var i = 0; i < this.lenCues; i++) {
this.cues.push(new CueExtendedEntry(this._io, this, this._root));
}
};
return CueExtendedTag2;
}();
var PhraseLow = RekordboxAnlz2.PhraseLow = function() {
function PhraseLow2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
PhraseLow2.prototype._read = function() {
this.id = this._io.readU2be();
};
return PhraseLow2;
}();
var UnknownTag = RekordboxAnlz2.UnknownTag = function() {
function UnknownTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
UnknownTag2.prototype._read = function() {
};
return UnknownTag2;
}();
var TaggedSection = RekordboxAnlz2.TaggedSection = function() {
function TaggedSection2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
TaggedSection2.prototype._read = function() {
this.fourcc = this._io.readS4be();
this.lenHeader = this._io.readU4be();
this.lenTag = this._io.readU4be();
switch (this.fourcc) {
case RekordboxAnlz2.SectionTags.WAVE_COLOR_SCROLL:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new WaveColorScrollTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.WAVE_SCROLL:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new WaveScrollTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.VBR:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new VbrTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.CUES_2:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new CueExtendedTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.CUES:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new CueTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.SONG_STRUCTURE:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new SongStructureTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.BEAT_GRID:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new BeatGridTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.WAVE_PREVIEW:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new WavePreviewTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.WAVE_COLOR_PREVIEW:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new WaveColorPreviewTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.PATH:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new PathTag(_io__raw_body, this, this._root);
break;
case RekordboxAnlz2.SectionTags.WAVE_TINY:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new WavePreviewTag(_io__raw_body, this, this._root);
break;
default:
this._raw_body = this._io.readBytes(this.lenTag - 12);
var _io__raw_body = new KaitaiStream2(this._raw_body);
this.body = new UnknownTag(_io__raw_body, this, this._root);
break;
}
};
return TaggedSection2;
}();
var WaveColorScrollTag = RekordboxAnlz2.WaveColorScrollTag = function() {
function WaveColorScrollTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
WaveColorScrollTag2.prototype._read = function() {
this.lenEntryBytes = this._io.readU4be();
this.lenEntries = this._io.readU4be();
this._unnamed2 = this._io.readU4be();
this.entries = this._io.readBytes(this.lenEntries * this.lenEntryBytes);
};
return WaveColorScrollTag2;
}();
var CueTag = RekordboxAnlz2.CueTag = function() {
function CueTag2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
CueTag2.prototype._read = function() {
this.type = this._io.readU4be();
this._unnamed1 = this._io.readBytes(2);
this.lenCues = this._io.readU2be();
this.memoryCount = this._io.readU4be();
this.cues = [];
for (var i = 0; i < this.lenCues; i++) {
this.cues.push(new CueEntry(this._io, this, this._root));
}
};
return CueTag2;
}();
return RekordboxAnlz2;
}();
return RekordboxAnlz;
});
}
});
// ksy:/home/runner/work/prolink-connect/prolink-connect/src/localdb/kaitai/rekordbox_pdb.ksy
var require_rekordbox_pdb = __commonJS({
"ksy:/home/runner/work/prolink-connect/prolink-connect/src/localdb/kaitai/rekordbox_pdb.ksy"(exports, module) {
"use strict";
(function(root, factory) {
if (typeof define === "function" && define.amd) {
define(["kaitai-struct/KaitaiStream"], factory);
} else if (typeof module === "object" && module.exports) {
module.exports = factory(__require("kaitai-struct/KaitaiStream"));
} else {
root.RekordboxPdb = factory(root.KaitaiStream);
}
})(typeof self !== "undefined" ? self : exports, function(KaitaiStream2) {
var RekordboxPdb = function() {
RekordboxPdb2.PageType = Object.freeze({
TRACKS: 0,
GENRES: 1,
ARTISTS: 2,
ALBUMS: 3,
LABELS: 4,
KEYS: 5,
COLORS: 6,
PLAYLIST_TREE: 7,
PLAYLIST_ENTRIES: 8,
UNKNOWN_9: 9,
UNKNOWN_10: 10,
UNKNOWN_11: 11,
UNKNOWN_12: 12,
ARTWORK: 13,
UNKNOWN_14: 14,
UNKNOWN_15: 15,
COLUMNS: 16,
UNKNOWN_17: 17,
UNKNOWN_18: 18,
HISTORY: 19,
0: "TRACKS",
1: "GENRES",
2: "ARTISTS",
3: "ALBUMS",
4: "LABELS",
5: "KEYS",
6: "COLORS",
7: "PLAYLIST_TREE",
8: "PLAYLIST_ENTRIES",
9: "UNKNOWN_9",
10: "UNKNOWN_10",
11: "UNKNOWN_11",
12: "UNKNOWN_12",
13: "ARTWORK",
14: "UNKNOWN_14",
15: "UNKNOWN_15",
16: "COLUMNS",
17: "UNKNOWN_17",
18: "UNKNOWN_18",
19: "HISTORY"
});
function RekordboxPdb2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
RekordboxPdb2.prototype._read = function() {
this._unnamed0 = this._io.readU4le();
this.lenPage = this._io.readU4le();
this.numTables = this._io.readU4le();
this.nextUnusedPage = this._io.readU4le();
this._unnamed4 = this._io.readU4le();
this.sequence = this._io.readU4le();
this.gap = this._io.readBytes(4);
if (!(KaitaiStream2.byteArrayCompare(this.gap, [0, 0, 0, 0]) == 0)) {
throw new KaitaiStream2.ValidationNotEqualError([0, 0, 0, 0], this.gap, this._io, "/seq/6");
}
this.tables = [];
for (var i = 0; i < this.numTables; i++) {
this.tables.push(new Table(this._io, this, this._root));
}
};
var DeviceSqlString = RekordboxPdb2.DeviceSqlString = function() {
function DeviceSqlString2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
DeviceSqlString2.prototype._read = function() {
this.lengthAndKind = this._io.readU1();
switch (this.lengthAndKind) {
case 64:
this.body = new DeviceSqlLongAscii(this._io, this, this._root);
break;
case 144:
this.body = new DeviceSqlLongUtf16le(this._io, this, this._root);
break;
default:
this.body = new DeviceSqlShortAscii(this._io, this, this._root, this.lengthAndKind);
break;
}
};
return DeviceSqlString2;
}();
var PlaylistTreeRow = RekordboxPdb2.PlaylistTreeRow = function() {
function PlaylistTreeRow2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
PlaylistTreeRow2.prototype._read = function() {
this.parentId = this._io.readU4le();
this._unnamed1 = this._io.readBytes(4);
this.sortOrder = this._io.readU4le();
this.id = this._io.readU4le();
this.rawIsFolder = this._io.readU4le();
this.name = new DeviceSqlString(this._io, this, this._root);
};
Object.defineProperty(PlaylistTreeRow2.prototype, "isFolder", {
get: function() {
if (this._m_isFolder !== void 0)
return this._m_isFolder;
this._m_isFolder = this.rawIsFolder != 0;
return this._m_isFolder;
}
});
return PlaylistTreeRow2;
}();
var ColorRow = RekordboxPdb2.ColorRow = function() {
function ColorRow2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
ColorRow2.prototype._read = function() {
this._unnamed0 = this._io.readBytes(5);
this.id = this._io.readU2le();
this._unnamed2 = this._io.readU1();
this.name = new DeviceSqlString(this._io, this, this._root);
};
return ColorRow2;
}();
var DeviceSqlShortAscii = RekordboxPdb2.DeviceSqlShortAscii = function() {
function DeviceSqlShortAscii2(_io, _parent, _root, mangledLength) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this.mangledLength = mangledLength;
this._read();
}
DeviceSqlShortAscii2.prototype._read = function() {
if (KaitaiStream2.mod(this.mangledLength, 2) > 0 && this.length >= 0) {
this.text = KaitaiStream2.bytesToStr(this._io.readBytes(this.length), "ascii");
}
};
Object.defineProperty(DeviceSqlShortAscii2.prototype, "length", {
get: function() {
if (this._m_length !== void 0)
return this._m_length;
this._m_length = Math.floor((this.mangledLength - 1) / 2) - 1;
return this._m_length;
}
});
return DeviceSqlShortAscii2;
}();
var AlbumRow = RekordboxPdb2.AlbumRow = function() {
function AlbumRow2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
AlbumRow2.prototype._read = function() {
this._unnamed0 = this._io.readU2le();
this.indexShift = this._io.readU2le();
this._unnamed2 = this._io.readU4le();
this.artistId = this._io.readU4le();
this.id = this._io.readU4le();
this._unnamed5 = this._io.readU4le();
this._unnamed6 = this._io.readU1();
this.ofsName = this._io.readU1();
};
Object.defineProperty(AlbumRow2.prototype, "name", {
get: function() {
if (this._m_name !== void 0)
return this._m_name;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsName);
this._m_name = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_name;
}
});
return AlbumRow2;
}();
var Page = RekordboxPdb2.Page = function() {
function Page2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
Page2.prototype._read = function() {
this.gap = this._io.readBytes(4);
if (!(KaitaiStream2.byteArrayCompare(this.gap, [0, 0, 0, 0]) == 0)) {
throw new KaitaiStream2.ValidationNotEqualError([0, 0, 0, 0], this.gap, this._io, "/types/page/seq/0");
}
this.pageIndex = this._io.readU4le();
this.type = this._io.readU4le();
this.nextPage = new PageRef(this._io, this, this._root);
this._unnamed4 = this._io.readU4le();
this._unnamed5 = this._io.readBytes(4);
this.numRowsSmall = this._io.readU1();
this._unnamed7 = this._io.readU1();
this._unnamed8 = this._io.readU1();
this.pageFlags = this._io.readU1();
this.freeSize = this._io.readU2le();
this.usedSize = this._io.readU2le();
this._unnamed12 = this._io.readU2le();
this.numRowsLarge = this._io.readU2le();
this._unnamed14 = this._io.readU2le();
this._unnamed15 = this._io.readU2le();
if (false) {
this.heap = this._io.readBytesFull();
}
};
Object.defineProperty(Page2.prototype, "numRows", {
get: function() {
if (this._m_numRows !== void 0)
return this._m_numRows;
this._m_numRows = this.numRowsLarge > this.numRowsSmall && this.numRowsLarge != 8191 ? this.numRowsLarge : this.numRowsSmall;
return this._m_numRows;
}
});
Object.defineProperty(Page2.prototype, "numGroups", {
get: function() {
if (this._m_numGroups !== void 0)
return this._m_numGroups;
this._m_numGroups = Math.floor((this.numRows - 1) / 16) + 1;
return this._m_numGroups;
}
});
Object.defineProperty(Page2.prototype, "rowGroups", {
get: function() {
if (this._m_rowGroups !== void 0)
return this._m_rowGroups;
if (this.isDataPage) {
this._m_rowGroups = [];
for (var i = 0; i < this.numGroups; i++) {
this._m_rowGroups.push(new RowGroup(this._io, this, this._root, i));
}
}
return this._m_rowGroups;
}
});
Object.defineProperty(Page2.prototype, "heapPos", {
get: function() {
if (this._m_heapPos !== void 0)
return this._m_heapPos;
this._m_heapPos = this._io.pos;
return this._m_heapPos;
}
});
Object.defineProperty(Page2.prototype, "isDataPage", {
get: function() {
if (this._m_isDataPage !== void 0)
return this._m_isDataPage;
this._m_isDataPage = (this.pageFlags & 64) == 0;
return this._m_isDataPage;
}
});
return Page2;
}();
var RowGroup = RekordboxPdb2.RowGroup = function() {
function RowGroup2(_io, _parent, _root, groupIndex) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this.groupIndex = groupIndex;
this._read();
}
RowGroup2.prototype._read = function() {
};
Object.defineProperty(RowGroup2.prototype, "base", {
get: function() {
if (this._m_base !== void 0)
return this._m_base;
this._m_base = this._root.lenPage - this.groupIndex * 36;
return this._m_base;
}
});
Object.defineProperty(RowGroup2.prototype, "rowPresentFlags", {
get: function() {
if (this._m_rowPresentFlags !== void 0)
return this._m_rowPresentFlags;
var _pos = this._io.pos;
this._io.seek(this.base - 4);
this._m_rowPresentFlags = this._io.readU2le();
this._io.seek(_pos);
return this._m_rowPresentFlags;
}
});
Object.defineProperty(RowGroup2.prototype, "rows", {
get: function() {
if (this._m_rows !== void 0)
return this._m_rows;
this._m_rows = [];
for (var i = 0; i < (this.groupIndex < this._parent.numGroups - 1 ? 16 : KaitaiStream2.mod(this._parent.numRows - 1, 16) + 1); i++) {
this._m_rows.push(new RowRef(this._io, this, this._root, i));
}
return this._m_rows;
}
});
return RowGroup2;
}();
var GenreRow = RekordboxPdb2.GenreRow = function() {
function GenreRow2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
GenreRow2.prototype._read = function() {
this.id = this._io.readU4le();
this.name = new DeviceSqlString(this._io, this, this._root);
};
return GenreRow2;
}();
var ArtworkRow = RekordboxPdb2.ArtworkRow = function() {
function ArtworkRow2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
ArtworkRow2.prototype._read = function() {
this.id = this._io.readU4le();
this.path = new DeviceSqlString(this._io, this, this._root);
};
return ArtworkRow2;
}();
var DeviceSqlLongAscii = RekordboxPdb2.DeviceSqlLongAscii = function() {
function DeviceSqlLongAscii2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
DeviceSqlLongAscii2.prototype._read = function() {
this.length = this._io.readU2le();
this.text = KaitaiStream2.bytesToStr(this._io.readBytes(this.length), "ascii");
};
return DeviceSqlLongAscii2;
}();
var ArtistRow = RekordboxPdb2.ArtistRow = function() {
function ArtistRow2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
ArtistRow2.prototype._read = function() {
this.subtype = this._io.readU2le();
this.indexShift = this._io.readU2le();
this.id = this._io.readU4le();
this._unnamed3 = this._io.readU1();
this.ofsNameNear = this._io.readU1();
};
Object.defineProperty(ArtistRow2.prototype, "ofsNameFar", {
get: function() {
if (this._m_ofsNameFar !== void 0)
return this._m_ofsNameFar;
if (this.subtype == 100) {
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + 10);
this._m_ofsNameFar = this._io.readU2le();
this._io.seek(_pos);
}
return this._m_ofsNameFar;
}
});
Object.defineProperty(ArtistRow2.prototype, "name", {
get: function() {
if (this._m_name !== void 0)
return this._m_name;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + (this.subtype == 100 ? this.ofsNameFar : this.ofsNameNear));
this._m_name = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_name;
}
});
return ArtistRow2;
}();
var PageRef = RekordboxPdb2.PageRef = function() {
function PageRef2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
PageRef2.prototype._read = function() {
this.index = this._io.readU4le();
};
Object.defineProperty(PageRef2.prototype, "body", {
get: function() {
if (this._m_body !== void 0)
return this._m_body;
var io = this._root._io;
var _pos = io.pos;
io.seek(this._root.lenPage * this.index);
this._raw__m_body = io.readBytes(this._root.lenPage);
var _io__raw__m_body = new KaitaiStream2(this._raw__m_body);
this._m_body = new Page(_io__raw__m_body, this, this._root);
io.seek(_pos);
return this._m_body;
}
});
return PageRef2;
}();
var TrackRow = RekordboxPdb2.TrackRow = function() {
function TrackRow2(_io, _parent, _root) {
this._io = _io;
this._parent = _parent;
this._root = _root || this;
this._read();
}
TrackRow2.prototype._read = function() {
this._unnamed0 = this._io.readU2le();
this.indexShift = this._io.readU2le();
this.bitmask = this._io.readU4le();
this.sampleRate = this._io.readU4le();
this.composerId = this._io.readU4le();
this.fileSize = this._io.readU4le();
this._unnamed6 = this._io.readU4le();
this._unnamed7 = this._io.readU2le();
this._unnamed8 = this._io.readU2le();
this.artworkId = this._io.readU4le();
this.keyId = this._io.readU4le();
this.originalArtistId = this._io.readU4le();
this.labelId = this._io.readU4le();
this.remixerId = this._io.readU4le();
this.bitrate = this._io.readU4le();
this.trackNumber = this._io.readU4le();
this.tempo = this._io.readU4le();
this.genreId = this._io.readU4le();
this.albumId = this._io.readU4le();
this.artistId = this._io.readU4le();
this.id = this._io.readU4le();
this.discNumber = this._io.readU2le();
this.playCount = this._io.readU2le();
this.year = this._io.readU2le();
this.sampleDepth = this._io.readU2le();
this.duration = this._io.readU2le();
this._unnamed26 = this._io.readU2le();
this.colorId = this._io.readU1();
this.rating = this._io.readU1();
this._unnamed29 = this._io.readU2le();
this._unnamed30 = this._io.readU2le();
this.ofsStrings = [];
for (var i = 0; i < 21; i++) {
this.ofsStrings.push(this._io.readU2le());
}
};
Object.defineProperty(TrackRow2.prototype, "unknownString8", {
get: function() {
if (this._m_unknownString8 !== void 0)
return this._m_unknownString8;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[18]);
this._m_unknownString8 = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_unknownString8;
}
});
Object.defineProperty(TrackRow2.prototype, "unknownString6", {
get: function() {
if (this._m_unknownString6 !== void 0)
return this._m_unknownString6;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[9]);
this._m_unknownString6 = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_unknownString6;
}
});
Object.defineProperty(TrackRow2.prototype, "analyzeDate", {
get: function() {
if (this._m_analyzeDate !== void 0)
return this._m_analyzeDate;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[15]);
this._m_analyzeDate = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_analyzeDate;
}
});
Object.defineProperty(TrackRow2.prototype, "filePath", {
get: function() {
if (this._m_filePath !== void 0)
return this._m_filePath;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[20]);
this._m_filePath = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_filePath;
}
});
Object.defineProperty(TrackRow2.prototype, "autoloadHotcues", {
get: function() {
if (this._m_autoloadHotcues !== void 0)
return this._m_autoloadHotcues;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[7]);
this._m_autoloadHotcues = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_autoloadHotcues;
}
});
Object.defineProperty(TrackRow2.prototype, "dateAdded", {
get: function() {
if (this._m_dateAdded !== void 0)
return this._m_dateAdded;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[10]);
this._m_dateAdded = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_dateAdded;
}
});
Object.defineProperty(TrackRow2.prototype, "unknownString3", {
get: function() {
if (this._m_unknownString3 !== void 0)
return this._m_unknownString3;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[3]);
this._m_unknownString3 = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_unknownString3;
}
});
Object.defineProperty(TrackRow2.prototype, "texter", {
get: function() {
if (this._m_texter !== void 0)
return this._m_texter;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[1]);
this._m_texter = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_texter;
}
});
Object.defineProperty(TrackRow2.prototype, "kuvoPublic", {
get: function() {
if (this._m_kuvoPublic !== void 0)
return this._m_kuvoPublic;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[6]);
this._m_kuvoPublic = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_kuvoPublic;
}
});
Object.defineProperty(TrackRow2.prototype, "mixName", {
get: function() {
if (this._m_mixName !== void 0)
return this._m_mixName;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[12]);
this._m_mixName = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos);
return this._m_mixName;
}
});
Object.defineProperty(TrackRow2.prototype, "unknownString5", {
get: function() {
if (this._m_unknownString5 !== void 0)
return this._m_unknownString5;
var _pos = this._io.pos;
this._io.seek(this._parent.rowBase + this.ofsStrings[8]);
this._m_unknownString5 = new DeviceSqlString(this._io, this, this._root);
this._io.seek(_pos)