rekordbox-connect 1.0.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/db.d.ts +26 -2
- package/dist/db.js +320 -2
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/rekordboxConnect.d.ts +25 -2
- package/dist/rekordboxConnect.js +77 -7
- package/dist/rekordboxConnect.js.map +1 -1
- package/dist/types.d.ts +85 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/db.d.ts
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
|
-
import type { RekordboxHistoryPayload, RekordboxTracksPayload } from './types';
|
|
1
|
+
import type { Playlist, PlaylistTrack, RekordboxHistoryPayload, RekordboxTracksPayload, SongHistoryRecord, SongPlaylistRecord } from './types';
|
|
2
2
|
export declare class RekordboxDb {
|
|
3
3
|
private readonly dbPath;
|
|
4
4
|
private readonly password;
|
|
5
5
|
private db?;
|
|
6
|
-
|
|
6
|
+
private readonly isReadonly;
|
|
7
|
+
constructor(dbPath: string, password: string, readonly?: boolean);
|
|
7
8
|
open(): void;
|
|
8
9
|
close(): void;
|
|
9
10
|
loadTracks(maxRows?: number): RekordboxTracksPayload | undefined;
|
|
11
|
+
loadPlaylists(): Playlist[] | undefined;
|
|
12
|
+
loadPlaylistTracks(playlistId: string): PlaylistTrack[] | undefined;
|
|
13
|
+
private createPlaylistEntry;
|
|
14
|
+
createPlaylist(name: string, parentId?: string): Playlist | undefined;
|
|
15
|
+
createFolder(name: string, parentId?: string): Playlist | undefined;
|
|
16
|
+
deletePlaylist(playlistId: string): boolean;
|
|
17
|
+
renamePlaylist(playlistId: string, name: string): boolean;
|
|
18
|
+
addTrackToPlaylist(playlistId: string, contentId: string): SongPlaylistRecord | undefined;
|
|
19
|
+
removeTrackFromPlaylist(playlistId: string, contentId: string): boolean;
|
|
20
|
+
reorderPlaylistTrack(playlistId: string, contentId: string, newTrackNo: number): boolean;
|
|
10
21
|
seedHistoryCursor(): number | undefined;
|
|
11
22
|
loadNewHistory(sinceRowId: number | undefined, maxRows?: number): RekordboxHistoryPayload | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Pop (remove and return) the last song history entry.
|
|
25
|
+
* Only works if the database was opened with readonly=false.
|
|
26
|
+
* Returns undefined if readonly or no entries exist.
|
|
27
|
+
*/
|
|
28
|
+
popHistory(): SongHistoryRecord | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Push (insert) a song history entry back into the database.
|
|
31
|
+
* Only works if the database was opened with readonly=false.
|
|
32
|
+
* The record should be one previously returned by popHistory().
|
|
33
|
+
* Returns true if successful, false otherwise.
|
|
34
|
+
*/
|
|
35
|
+
pushHistory(record: SongHistoryRecord): boolean;
|
|
12
36
|
}
|
package/dist/db.js
CHANGED
|
@@ -5,23 +5,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.RekordboxDb = void 0;
|
|
7
7
|
const better_sqlite3_multiple_ciphers_1 = __importDefault(require("better-sqlite3-multiple-ciphers"));
|
|
8
|
+
const node_crypto_1 = require("node:crypto");
|
|
8
9
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
10
|
const DEFAULT_MAX_ROWS = 5000;
|
|
10
11
|
const DEFAULT_HISTORY_ROWS = 100;
|
|
11
12
|
// Known Rekordbox 6 table names
|
|
12
13
|
const HISTORY_TABLE = 'djmdSongHistory';
|
|
13
14
|
const CONTENT_TABLE = 'djmdContent';
|
|
15
|
+
const PLAYLIST_TABLE = 'djmdPlaylist';
|
|
16
|
+
const SONG_PLAYLIST_TABLE = 'djmdSongPlaylist';
|
|
14
17
|
class RekordboxDb {
|
|
15
|
-
constructor(dbPath, password) {
|
|
18
|
+
constructor(dbPath, password, readonly = true) {
|
|
16
19
|
this.dbPath = dbPath;
|
|
17
20
|
this.password = password;
|
|
21
|
+
this.isReadonly = readonly;
|
|
18
22
|
}
|
|
19
23
|
open() {
|
|
20
24
|
this.close();
|
|
21
25
|
if (!node_fs_1.default.existsSync(this.dbPath)) {
|
|
22
26
|
throw new Error(`Rekordbox database not found at: ${this.dbPath}`);
|
|
23
27
|
}
|
|
24
|
-
this.db = new better_sqlite3_multiple_ciphers_1.default(this.dbPath, { readonly:
|
|
28
|
+
this.db = new better_sqlite3_multiple_ciphers_1.default(this.dbPath, { readonly: this.isReadonly });
|
|
25
29
|
// Configure SQLCipher
|
|
26
30
|
this.db.pragma(`cipher='sqlcipher'`);
|
|
27
31
|
this.db.pragma(`legacy=4`);
|
|
@@ -90,6 +94,228 @@ class RekordboxDb {
|
|
|
90
94
|
return { dbPath: this.dbPath, count: 0, rows: [] };
|
|
91
95
|
}
|
|
92
96
|
}
|
|
97
|
+
loadPlaylists() {
|
|
98
|
+
if (!this.db)
|
|
99
|
+
return undefined;
|
|
100
|
+
const query = `
|
|
101
|
+
SELECT ID, Seq, Name, ImagePath, Attribute, ParentID, SmartList,
|
|
102
|
+
created_at, updated_at
|
|
103
|
+
FROM ${PLAYLIST_TABLE}
|
|
104
|
+
ORDER BY Seq ASC
|
|
105
|
+
`;
|
|
106
|
+
try {
|
|
107
|
+
return this.db.prepare(query).all();
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
loadPlaylistTracks(playlistId) {
|
|
114
|
+
if (!this.db)
|
|
115
|
+
return undefined;
|
|
116
|
+
const query = `
|
|
117
|
+
SELECT
|
|
118
|
+
sp.TrackNo AS trackNo,
|
|
119
|
+
c.ID AS id,
|
|
120
|
+
c.FolderPath AS filePath,
|
|
121
|
+
c.Title AS title,
|
|
122
|
+
c.Subtitle AS subTitle,
|
|
123
|
+
a.Name AS artist,
|
|
124
|
+
c.ImagePath AS imagePath,
|
|
125
|
+
c.BPM AS bpm,
|
|
126
|
+
c.Rating AS rating,
|
|
127
|
+
c.ReleaseDate AS releaseDate,
|
|
128
|
+
c.Length AS length,
|
|
129
|
+
c.ColorID AS colorId,
|
|
130
|
+
c.Commnt AS comment,
|
|
131
|
+
c.ISRC AS isrc,
|
|
132
|
+
al.Name AS album,
|
|
133
|
+
la.Name AS label,
|
|
134
|
+
ge.Name AS genre,
|
|
135
|
+
k.ScaleName AS key,
|
|
136
|
+
rmx.Name AS remixer
|
|
137
|
+
FROM ${SONG_PLAYLIST_TABLE} AS sp
|
|
138
|
+
JOIN ${CONTENT_TABLE} AS c ON sp.ContentID = c.ID
|
|
139
|
+
LEFT JOIN djmdArtist AS a ON c.ArtistID = a.ID
|
|
140
|
+
LEFT JOIN djmdArtist AS rmx ON c.RemixerID = rmx.ID
|
|
141
|
+
LEFT JOIN djmdAlbum AS al ON c.AlbumID = al.ID
|
|
142
|
+
LEFT JOIN djmdLabel AS la ON c.LabelID = la.ID
|
|
143
|
+
LEFT JOIN djmdGenre AS ge ON c.GenreID = ge.ID
|
|
144
|
+
LEFT JOIN djmdKey AS k ON c.KeyID = k.ID
|
|
145
|
+
WHERE sp.PlaylistID = @playlistId
|
|
146
|
+
ORDER BY sp.TrackNo ASC
|
|
147
|
+
`;
|
|
148
|
+
try {
|
|
149
|
+
return this.db.prepare(query).all({ playlistId });
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
return [];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
createPlaylistEntry(name, attribute, parentId) {
|
|
156
|
+
if (!this.db || this.isReadonly)
|
|
157
|
+
return undefined;
|
|
158
|
+
try {
|
|
159
|
+
const seqRow = this.db.prepare(`SELECT MAX(Seq) AS maxSeq FROM ${PLAYLIST_TABLE}`).get();
|
|
160
|
+
const nextSeq = (seqRow?.maxSeq ?? 0) + 1;
|
|
161
|
+
const now = new Date().toISOString().replace('T', ' ').replace('Z', '');
|
|
162
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
163
|
+
const playlist = {
|
|
164
|
+
ID: id,
|
|
165
|
+
Seq: nextSeq,
|
|
166
|
+
Name: name,
|
|
167
|
+
ImagePath: null,
|
|
168
|
+
Attribute: attribute,
|
|
169
|
+
ParentID: parentId ?? null,
|
|
170
|
+
SmartList: null,
|
|
171
|
+
created_at: now,
|
|
172
|
+
updated_at: now,
|
|
173
|
+
};
|
|
174
|
+
this.db.prepare(`
|
|
175
|
+
INSERT INTO ${PLAYLIST_TABLE} (
|
|
176
|
+
ID, Seq, Name, ImagePath, Attribute, ParentID, SmartList,
|
|
177
|
+
UUID, rb_data_status, rb_local_data_status, rb_local_deleted,
|
|
178
|
+
rb_local_synced, usn, rb_local_usn, created_at, updated_at
|
|
179
|
+
) VALUES (
|
|
180
|
+
@ID, @Seq, @Name, @ImagePath, @Attribute, @ParentID, @SmartList,
|
|
181
|
+
@UUID, 0, 0, 0, 0, 0, 0, @created_at, @updated_at
|
|
182
|
+
)
|
|
183
|
+
`).run({ ...playlist, UUID: id });
|
|
184
|
+
return playlist;
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
createPlaylist(name, parentId) {
|
|
191
|
+
return this.createPlaylistEntry(name, 0, parentId);
|
|
192
|
+
}
|
|
193
|
+
createFolder(name, parentId) {
|
|
194
|
+
return this.createPlaylistEntry(name, 1, parentId);
|
|
195
|
+
}
|
|
196
|
+
deletePlaylist(playlistId) {
|
|
197
|
+
if (!this.db || this.isReadonly)
|
|
198
|
+
return false;
|
|
199
|
+
try {
|
|
200
|
+
const row = this.db.prepare(`SELECT Attribute FROM ${PLAYLIST_TABLE} WHERE ID = @playlistId`).get({ playlistId });
|
|
201
|
+
if (!row)
|
|
202
|
+
return false;
|
|
203
|
+
// If it's a folder, check for children
|
|
204
|
+
if (row.Attribute === 1) {
|
|
205
|
+
const children = this.db.prepare(`SELECT ID FROM ${PLAYLIST_TABLE} WHERE ParentID = @playlistId`).all({ playlistId });
|
|
206
|
+
if (children.length > 0)
|
|
207
|
+
return false;
|
|
208
|
+
}
|
|
209
|
+
// Delete track assignments then the playlist itself
|
|
210
|
+
this.db.prepare(`DELETE FROM ${SONG_PLAYLIST_TABLE} WHERE PlaylistID = @playlistId`).run({ playlistId });
|
|
211
|
+
this.db.prepare(`DELETE FROM ${PLAYLIST_TABLE} WHERE ID = @playlistId`).run({ playlistId });
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
renamePlaylist(playlistId, name) {
|
|
219
|
+
if (!this.db || this.isReadonly)
|
|
220
|
+
return false;
|
|
221
|
+
try {
|
|
222
|
+
const now = new Date().toISOString().replace('T', ' ').replace('Z', '');
|
|
223
|
+
const result = this.db.prepare(`UPDATE ${PLAYLIST_TABLE} SET Name = @name, updated_at = @now WHERE ID = @playlistId`).run({ playlistId, name, now });
|
|
224
|
+
return result.changes > 0;
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
addTrackToPlaylist(playlistId, contentId) {
|
|
231
|
+
if (!this.db || this.isReadonly)
|
|
232
|
+
return undefined;
|
|
233
|
+
try {
|
|
234
|
+
const trackNoRow = this.db.prepare(`SELECT MAX(TrackNo) AS maxTrackNo FROM ${SONG_PLAYLIST_TABLE} WHERE PlaylistID = @playlistId`).get({ playlistId });
|
|
235
|
+
const nextTrackNo = (trackNoRow?.maxTrackNo ?? 0) + 1;
|
|
236
|
+
const now = new Date().toISOString().replace('T', ' ').replace('Z', '');
|
|
237
|
+
const id = (0, node_crypto_1.randomUUID)();
|
|
238
|
+
const record = {
|
|
239
|
+
ID: id,
|
|
240
|
+
PlaylistID: playlistId,
|
|
241
|
+
ContentID: contentId,
|
|
242
|
+
TrackNo: nextTrackNo,
|
|
243
|
+
UUID: id,
|
|
244
|
+
rb_data_status: 0,
|
|
245
|
+
rb_local_data_status: 0,
|
|
246
|
+
rb_local_deleted: 0,
|
|
247
|
+
rb_local_synced: 0,
|
|
248
|
+
usn: 0,
|
|
249
|
+
rb_local_usn: 0,
|
|
250
|
+
created_at: now,
|
|
251
|
+
updated_at: now,
|
|
252
|
+
};
|
|
253
|
+
this.db.prepare(`
|
|
254
|
+
INSERT INTO ${SONG_PLAYLIST_TABLE} (
|
|
255
|
+
ID, PlaylistID, ContentID, TrackNo, UUID,
|
|
256
|
+
rb_data_status, rb_local_data_status, rb_local_deleted,
|
|
257
|
+
rb_local_synced, usn, rb_local_usn, created_at, updated_at
|
|
258
|
+
) VALUES (
|
|
259
|
+
@ID, @PlaylistID, @ContentID, @TrackNo, @UUID,
|
|
260
|
+
@rb_data_status, @rb_local_data_status, @rb_local_deleted,
|
|
261
|
+
@rb_local_synced, @usn, @rb_local_usn, @created_at, @updated_at
|
|
262
|
+
)
|
|
263
|
+
`).run(record);
|
|
264
|
+
return record;
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
return undefined;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
removeTrackFromPlaylist(playlistId, contentId) {
|
|
271
|
+
if (!this.db || this.isReadonly)
|
|
272
|
+
return false;
|
|
273
|
+
try {
|
|
274
|
+
const remove = this.db.transaction(() => {
|
|
275
|
+
const result = this.db.prepare(`DELETE FROM ${SONG_PLAYLIST_TABLE} WHERE PlaylistID = @playlistId AND ContentID = @contentId`).run({ playlistId, contentId });
|
|
276
|
+
if (result.changes === 0)
|
|
277
|
+
return false;
|
|
278
|
+
// Re-sequence: assign TrackNo 1,2,3... based on current order
|
|
279
|
+
const remaining = this.db.prepare(`SELECT ID FROM ${SONG_PLAYLIST_TABLE} WHERE PlaylistID = @playlistId ORDER BY TrackNo ASC`).all({ playlistId });
|
|
280
|
+
const updateStmt = this.db.prepare(`UPDATE ${SONG_PLAYLIST_TABLE} SET TrackNo = @trackNo WHERE ID = @id`);
|
|
281
|
+
for (let i = 0; i < remaining.length; i++) {
|
|
282
|
+
updateStmt.run({ id: remaining[i].ID, trackNo: i + 1 });
|
|
283
|
+
}
|
|
284
|
+
return true;
|
|
285
|
+
});
|
|
286
|
+
return remove();
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return false;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
reorderPlaylistTrack(playlistId, contentId, newTrackNo) {
|
|
293
|
+
if (!this.db || this.isReadonly)
|
|
294
|
+
return false;
|
|
295
|
+
try {
|
|
296
|
+
const reorder = this.db.transaction(() => {
|
|
297
|
+
// Find the track's current record
|
|
298
|
+
const record = this.db.prepare(`SELECT ID FROM ${SONG_PLAYLIST_TABLE} WHERE PlaylistID = @playlistId AND ContentID = @contentId`).get({ playlistId, contentId });
|
|
299
|
+
if (!record)
|
|
300
|
+
return false;
|
|
301
|
+
// Get all OTHER tracks in order
|
|
302
|
+
const others = this.db.prepare(`SELECT ID FROM ${SONG_PLAYLIST_TABLE} WHERE PlaylistID = @playlistId AND ID != @id ORDER BY TrackNo ASC`).all({ playlistId, id: record.ID });
|
|
303
|
+
// Insert our track at the desired position (1-indexed)
|
|
304
|
+
const insertIdx = Math.max(0, Math.min(newTrackNo - 1, others.length));
|
|
305
|
+
others.splice(insertIdx, 0, record);
|
|
306
|
+
// Re-sequence all
|
|
307
|
+
const updateStmt = this.db.prepare(`UPDATE ${SONG_PLAYLIST_TABLE} SET TrackNo = @trackNo WHERE ID = @id`);
|
|
308
|
+
for (let i = 0; i < others.length; i++) {
|
|
309
|
+
updateStmt.run({ id: others[i].ID, trackNo: i + 1 });
|
|
310
|
+
}
|
|
311
|
+
return true;
|
|
312
|
+
});
|
|
313
|
+
return reorder();
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
return false;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
93
319
|
seedHistoryCursor() {
|
|
94
320
|
if (!this.db)
|
|
95
321
|
return undefined;
|
|
@@ -151,6 +377,98 @@ class RekordboxDb {
|
|
|
151
377
|
return { dbPath: this.dbPath, count: 0, rows: [], lastRowId: sinceRowId };
|
|
152
378
|
}
|
|
153
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* Pop (remove and return) the last song history entry.
|
|
382
|
+
* Only works if the database was opened with readonly=false.
|
|
383
|
+
* Returns undefined if readonly or no entries exist.
|
|
384
|
+
*/
|
|
385
|
+
popHistory() {
|
|
386
|
+
if (!this.db || this.isReadonly)
|
|
387
|
+
return undefined;
|
|
388
|
+
try {
|
|
389
|
+
// Get the last entry (highest rowid)
|
|
390
|
+
const selectQuery = `
|
|
391
|
+
SELECT
|
|
392
|
+
rowid,
|
|
393
|
+
ID,
|
|
394
|
+
HistoryID,
|
|
395
|
+
ContentID,
|
|
396
|
+
TrackNo,
|
|
397
|
+
UUID,
|
|
398
|
+
rb_data_status,
|
|
399
|
+
rb_local_data_status,
|
|
400
|
+
rb_local_deleted,
|
|
401
|
+
rb_local_synced,
|
|
402
|
+
usn,
|
|
403
|
+
rb_local_usn,
|
|
404
|
+
created_at,
|
|
405
|
+
updated_at
|
|
406
|
+
FROM ${HISTORY_TABLE}
|
|
407
|
+
ORDER BY rowid DESC
|
|
408
|
+
LIMIT 1
|
|
409
|
+
`;
|
|
410
|
+
const record = this.db.prepare(selectQuery).get();
|
|
411
|
+
if (!record)
|
|
412
|
+
return undefined;
|
|
413
|
+
// Delete the entry
|
|
414
|
+
const deleteQuery = `DELETE FROM ${HISTORY_TABLE} WHERE rowid = @rowid`;
|
|
415
|
+
this.db.prepare(deleteQuery).run({ rowid: record.rowid });
|
|
416
|
+
return record;
|
|
417
|
+
}
|
|
418
|
+
catch {
|
|
419
|
+
return undefined;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Push (insert) a song history entry back into the database.
|
|
424
|
+
* Only works if the database was opened with readonly=false.
|
|
425
|
+
* The record should be one previously returned by popHistory().
|
|
426
|
+
* Returns true if successful, false otherwise.
|
|
427
|
+
*/
|
|
428
|
+
pushHistory(record) {
|
|
429
|
+
if (!this.db || this.isReadonly)
|
|
430
|
+
return false;
|
|
431
|
+
try {
|
|
432
|
+
const insertQuery = `
|
|
433
|
+
INSERT INTO ${HISTORY_TABLE} (
|
|
434
|
+
rowid,
|
|
435
|
+
ID,
|
|
436
|
+
HistoryID,
|
|
437
|
+
ContentID,
|
|
438
|
+
TrackNo,
|
|
439
|
+
UUID,
|
|
440
|
+
rb_data_status,
|
|
441
|
+
rb_local_data_status,
|
|
442
|
+
rb_local_deleted,
|
|
443
|
+
rb_local_synced,
|
|
444
|
+
usn,
|
|
445
|
+
rb_local_usn,
|
|
446
|
+
created_at,
|
|
447
|
+
updated_at
|
|
448
|
+
) VALUES (
|
|
449
|
+
@rowid,
|
|
450
|
+
@ID,
|
|
451
|
+
@HistoryID,
|
|
452
|
+
@ContentID,
|
|
453
|
+
@TrackNo,
|
|
454
|
+
@UUID,
|
|
455
|
+
@rb_data_status,
|
|
456
|
+
@rb_local_data_status,
|
|
457
|
+
@rb_local_deleted,
|
|
458
|
+
@rb_local_synced,
|
|
459
|
+
@usn,
|
|
460
|
+
@rb_local_usn,
|
|
461
|
+
@created_at,
|
|
462
|
+
@updated_at
|
|
463
|
+
)
|
|
464
|
+
`;
|
|
465
|
+
this.db.prepare(insertQuery).run(record);
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
catch {
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
154
472
|
}
|
|
155
473
|
exports.RekordboxDb = RekordboxDb;
|
|
156
474
|
//# sourceMappingURL=db.js.map
|
package/dist/db.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.js","sourceRoot":"","sources":["../src/db.ts"],"names":[],"mappings":";;;;;;AACA,sGAAkE;AAClE,sDAAyB;AAGzB,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,gCAAgC;AAChC,MAAM,aAAa,GAAG,i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;;;;;;;;;;;;;;;;;;;;;;;;OA+B5B,CAAC;YAEF,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF;AAhhBD,kCAghBC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { RekordboxConnect } from './rekordboxConnect';
|
|
2
|
-
export type { RekordboxConnectEvents, RekordboxConnectOptions, RekordboxHistoryPayload, RekordboxOptions, RekordboxReadyInfo, RekordboxTracksPayload } from './types';
|
|
2
|
+
export type { Playlist, PlaylistTrack, RekordboxConnectEvents, RekordboxConnectOptions, RekordboxHistoryPayload, RekordboxOptions, RekordboxReadyInfo, RekordboxTracksPayload, SongHistoryRecord, SongPlaylistRecord } from './types';
|
|
3
3
|
export { REKORDBOX_MAGIC } from './types';
|
|
4
4
|
export { detectRekordboxDbPath, getRekordboxConfig, getOptionsPath, readRekordboxOptions } from './detectDb';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AAazB,iCAA0C;AAAjC,wGAAA,eAAe,OAAA;AACxB,uCAKoB;AAJhB,iHAAA,qBAAqB,OAAA;AACrB,8GAAA,kBAAkB,OAAA;AAClB,0GAAA,cAAc,OAAA;AACd,gHAAA,oBAAoB,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RekordboxConnectEvents, RekordboxConnectOptions, TypedEmitter } from
|
|
1
|
+
import type { Playlist, PlaylistTrack, RekordboxConnectEvents, RekordboxConnectOptions, SongHistoryRecord, SongPlaylistRecord, TypedEmitter } from "./types";
|
|
2
2
|
declare const RekordboxConnect_base: {
|
|
3
3
|
new (): TypedEmitter;
|
|
4
4
|
};
|
|
@@ -7,6 +7,7 @@ export declare class RekordboxConnect extends RekordboxConnect_base {
|
|
|
7
7
|
private readonly historyMaxRows?;
|
|
8
8
|
private readonly explicitDbPath?;
|
|
9
9
|
private readonly explicitDbPassword?;
|
|
10
|
+
private readonly dangerouslyModifyDatabase;
|
|
10
11
|
private dbPath?;
|
|
11
12
|
private timer?;
|
|
12
13
|
private db?;
|
|
@@ -16,5 +17,27 @@ export declare class RekordboxConnect extends RekordboxConnect_base {
|
|
|
16
17
|
stop(): void;
|
|
17
18
|
private pollOnce;
|
|
18
19
|
private loadHistorySafe;
|
|
20
|
+
/**
|
|
21
|
+
* Pop (remove and return) the last song history entry.
|
|
22
|
+
* Only works if dangerouslyModifyDatabase was set to true.
|
|
23
|
+
* Returns undefined if not enabled or no entries exist.
|
|
24
|
+
*/
|
|
25
|
+
popHistory(): SongHistoryRecord | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Push (insert) a song history entry back into the database.
|
|
28
|
+
* Only works if dangerouslyModifyDatabase was set to true.
|
|
29
|
+
* The record should be one previously returned by popHistory().
|
|
30
|
+
* Returns true if successful, false otherwise.
|
|
31
|
+
*/
|
|
32
|
+
pushHistory(record: SongHistoryRecord): boolean;
|
|
33
|
+
loadPlaylists(): Playlist[] | undefined;
|
|
34
|
+
loadPlaylistTracks(playlistId: string): PlaylistTrack[] | undefined;
|
|
35
|
+
createPlaylist(name: string, parentId?: string): Playlist | undefined;
|
|
36
|
+
createFolder(name: string, parentId?: string): Playlist | undefined;
|
|
37
|
+
deletePlaylist(playlistId: string): boolean;
|
|
38
|
+
renamePlaylist(playlistId: string, name: string): boolean;
|
|
39
|
+
addTrackToPlaylist(playlistId: string, contentId: string): SongPlaylistRecord | undefined;
|
|
40
|
+
removeTrackFromPlaylist(playlistId: string, contentId: string): boolean;
|
|
41
|
+
reorderPlaylistTrack(playlistId: string, contentId: string, newTrackNo: number): boolean;
|
|
19
42
|
}
|
|
20
|
-
export type { RekordboxConnectEvents, RekordboxConnectOptions };
|
|
43
|
+
export type { Playlist, PlaylistTrack, RekordboxConnectEvents, RekordboxConnectOptions, SongHistoryRecord, SongPlaylistRecord, };
|
package/dist/rekordboxConnect.js
CHANGED
|
@@ -14,20 +14,24 @@ class RekordboxConnect extends node_events_1.default {
|
|
|
14
14
|
this.explicitDbPath = opts.dbPath;
|
|
15
15
|
this.explicitDbPassword = opts.dbPassword;
|
|
16
16
|
this.historyMaxRows = opts.historyMaxRows;
|
|
17
|
+
// Enable via option or environment variable NP_DANGEROUSLY_MODIFY_RB_DB=true
|
|
18
|
+
this.dangerouslyModifyDatabase =
|
|
19
|
+
opts.dangerouslyModifyDatabase ??
|
|
20
|
+
process.env.NP_DANGEROUSLY_MODIFY_RB_DB === "1";
|
|
17
21
|
}
|
|
18
22
|
start() {
|
|
19
23
|
try {
|
|
20
24
|
// Get database path and password from options.json or explicit config
|
|
21
25
|
const { dbPath, password } = (0, detectDb_1.getRekordboxConfig)(this.explicitDbPath, this.explicitDbPassword);
|
|
22
26
|
this.dbPath = dbPath;
|
|
23
|
-
this.db = new db_1.RekordboxDb(dbPath, password);
|
|
27
|
+
this.db = new db_1.RekordboxDb(dbPath, password, !this.dangerouslyModifyDatabase);
|
|
24
28
|
this.db.open();
|
|
25
29
|
this.lastHistoryRowId = this.db.seedHistoryCursor();
|
|
26
|
-
this.emit(
|
|
30
|
+
this.emit("ready", { dbPath: this.dbPath });
|
|
27
31
|
this.timer = setInterval(() => this.pollOnce(), this.pollIntervalMs);
|
|
28
32
|
}
|
|
29
33
|
catch (err) {
|
|
30
|
-
this.emit(
|
|
34
|
+
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
stop() {
|
|
@@ -44,12 +48,12 @@ class RekordboxConnect extends node_events_1.default {
|
|
|
44
48
|
if (!this.dbPath || !this.db)
|
|
45
49
|
return;
|
|
46
50
|
try {
|
|
47
|
-
this.emit(
|
|
51
|
+
this.emit("poll");
|
|
48
52
|
// Always poll history directly - mtime checks are unreliable with SQLite WAL mode
|
|
49
53
|
this.loadHistorySafe();
|
|
50
54
|
}
|
|
51
55
|
catch (err) {
|
|
52
|
-
this.emit(
|
|
56
|
+
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
loadHistorySafe() {
|
|
@@ -59,13 +63,79 @@ class RekordboxConnect extends node_events_1.default {
|
|
|
59
63
|
const payload = this.db.loadNewHistory(this.lastHistoryRowId, this.historyMaxRows);
|
|
60
64
|
if (payload && payload.count > 0) {
|
|
61
65
|
this.lastHistoryRowId = payload.lastRowId ?? this.lastHistoryRowId;
|
|
62
|
-
this.emit(
|
|
66
|
+
this.emit("history", payload);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
catch (err) {
|
|
66
|
-
this.emit(
|
|
70
|
+
this.emit("error", err instanceof Error ? err : new Error(String(err)));
|
|
67
71
|
}
|
|
68
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Pop (remove and return) the last song history entry.
|
|
75
|
+
* Only works if dangerouslyModifyDatabase was set to true.
|
|
76
|
+
* Returns undefined if not enabled or no entries exist.
|
|
77
|
+
*/
|
|
78
|
+
popHistory() {
|
|
79
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
80
|
+
return undefined;
|
|
81
|
+
return this.db.popHistory();
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Push (insert) a song history entry back into the database.
|
|
85
|
+
* Only works if dangerouslyModifyDatabase was set to true.
|
|
86
|
+
* The record should be one previously returned by popHistory().
|
|
87
|
+
* Returns true if successful, false otherwise.
|
|
88
|
+
*/
|
|
89
|
+
pushHistory(record) {
|
|
90
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
91
|
+
return false;
|
|
92
|
+
return this.db.pushHistory(record);
|
|
93
|
+
}
|
|
94
|
+
loadPlaylists() {
|
|
95
|
+
if (!this.db)
|
|
96
|
+
return undefined;
|
|
97
|
+
return this.db.loadPlaylists();
|
|
98
|
+
}
|
|
99
|
+
loadPlaylistTracks(playlistId) {
|
|
100
|
+
if (!this.db)
|
|
101
|
+
return undefined;
|
|
102
|
+
return this.db.loadPlaylistTracks(playlistId);
|
|
103
|
+
}
|
|
104
|
+
createPlaylist(name, parentId) {
|
|
105
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
106
|
+
return undefined;
|
|
107
|
+
return this.db.createPlaylist(name, parentId);
|
|
108
|
+
}
|
|
109
|
+
createFolder(name, parentId) {
|
|
110
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
111
|
+
return undefined;
|
|
112
|
+
return this.db.createFolder(name, parentId);
|
|
113
|
+
}
|
|
114
|
+
deletePlaylist(playlistId) {
|
|
115
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
116
|
+
return false;
|
|
117
|
+
return this.db.deletePlaylist(playlistId);
|
|
118
|
+
}
|
|
119
|
+
renamePlaylist(playlistId, name) {
|
|
120
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
121
|
+
return false;
|
|
122
|
+
return this.db.renamePlaylist(playlistId, name);
|
|
123
|
+
}
|
|
124
|
+
addTrackToPlaylist(playlistId, contentId) {
|
|
125
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
126
|
+
return undefined;
|
|
127
|
+
return this.db.addTrackToPlaylist(playlistId, contentId);
|
|
128
|
+
}
|
|
129
|
+
removeTrackFromPlaylist(playlistId, contentId) {
|
|
130
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
131
|
+
return false;
|
|
132
|
+
return this.db.removeTrackFromPlaylist(playlistId, contentId);
|
|
133
|
+
}
|
|
134
|
+
reorderPlaylistTrack(playlistId, contentId, newTrackNo) {
|
|
135
|
+
if (!this.db || !this.dangerouslyModifyDatabase)
|
|
136
|
+
return false;
|
|
137
|
+
return this.db.reorderPlaylistTrack(playlistId, contentId, newTrackNo);
|
|
138
|
+
}
|
|
69
139
|
}
|
|
70
140
|
exports.RekordboxConnect = RekordboxConnect;
|
|
71
141
|
//# sourceMappingURL=rekordboxConnect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rekordboxConnect.js","sourceRoot":"","sources":["../src/rekordboxConnect.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAuC;AACvC,6BAAmC;AACnC,yCAAgD;
|
|
1
|
+
{"version":3,"file":"rekordboxConnect.js","sourceRoot":"","sources":["../src/rekordboxConnect.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAuC;AACvC,6BAAmC;AACnC,yCAAgD;AAYhD,MAAa,gBAAiB,SAAS,qBAErC;IAWA,YAAY,OAAgC,EAAE;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC;QAClD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,UAAU,CAAC;QAC1C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC1C,6EAA6E;QAC7E,IAAI,CAAC,yBAAyB;YAC5B,IAAI,CAAC,yBAAyB;gBAC9B,OAAO,CAAC,GAAG,CAAC,2BAA2B,KAAK,GAAG,CAAC;IACpD,CAAC;IAED,KAAK;QACH,IAAI,CAAC;YACH,sEAAsE;YACtE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,6BAAkB,EAC7C,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,kBAAkB,CACxB,CAAC;YAEF,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;YACrB,IAAI,CAAC,EAA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C,IAAI,CAAC,yBAAyB;YAAE,OAAO,SAAS,CAAC;QAClE,OAAO,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;IAED,uBAAuB,CAAC,UAAkB,EAAE,SAAiB;QAC3D,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,yBAAyB;YAAE,OAAO,KAAK,CAAC;QAC9D,OAAO,IAAI,CAAC,EAAE,CAAC,uBAAuB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;IAED,oBAAoB,CAAC,UAAkB,EAAE,SAAiB,EAAE,UAAkB;QAC5E,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,yBAAyB;YAAE,OAAO,KAAK,CAAC;QAC9D,OAAO,IAAI,CAAC,EAAE,CAAC,oBAAoB,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IACzE,CAAC;CACF;AA1JD,4CA0JC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ export type RekordboxConnectOptions = {
|
|
|
11
11
|
maxRows?: number;
|
|
12
12
|
/** Maximum number of new history rows to emit per poll. */
|
|
13
13
|
historyMaxRows?: number;
|
|
14
|
+
/**
|
|
15
|
+
* DANGEROUS: Enable write access to modify the Rekordbox database.
|
|
16
|
+
* When enabled, write operations (history pop/push, playlist CRUD) will modify the database.
|
|
17
|
+
* When disabled (default), write methods are no-ops.
|
|
18
|
+
* Only enable if you understand the risks of modifying the Rekordbox database.
|
|
19
|
+
*/
|
|
20
|
+
dangerouslyModifyDatabase?: boolean;
|
|
14
21
|
};
|
|
15
22
|
/**
|
|
16
23
|
* Rekordbox options.json structure (partial)
|
|
@@ -36,6 +43,84 @@ export type RekordboxHistoryPayload = {
|
|
|
36
43
|
rows: Record<string, unknown>[];
|
|
37
44
|
lastRowId?: number;
|
|
38
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Full djmdSongHistory record as stored in the database.
|
|
48
|
+
* Used for pop/push operations to preserve the exact record.
|
|
49
|
+
*/
|
|
50
|
+
export type SongHistoryRecord = {
|
|
51
|
+
rowid: number;
|
|
52
|
+
ID: string;
|
|
53
|
+
HistoryID: string;
|
|
54
|
+
ContentID: string;
|
|
55
|
+
TrackNo: number;
|
|
56
|
+
UUID: string;
|
|
57
|
+
rb_data_status: number;
|
|
58
|
+
rb_local_data_status: number;
|
|
59
|
+
rb_local_deleted: number;
|
|
60
|
+
rb_local_synced: number;
|
|
61
|
+
usn: number;
|
|
62
|
+
rb_local_usn: number;
|
|
63
|
+
created_at: string;
|
|
64
|
+
updated_at: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Playlist or folder from djmdPlaylist table.
|
|
68
|
+
* Attribute: 0=playlist, 1=folder
|
|
69
|
+
*/
|
|
70
|
+
export type Playlist = {
|
|
71
|
+
ID: string;
|
|
72
|
+
Seq: number;
|
|
73
|
+
Name: string;
|
|
74
|
+
ImagePath: string | null;
|
|
75
|
+
Attribute: number;
|
|
76
|
+
ParentID: string | null;
|
|
77
|
+
SmartList: string | null;
|
|
78
|
+
created_at: string;
|
|
79
|
+
updated_at: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Full djmdSongPlaylist record as stored in the database.
|
|
83
|
+
* Represents a track assignment within a playlist.
|
|
84
|
+
*/
|
|
85
|
+
export type SongPlaylistRecord = {
|
|
86
|
+
ID: string;
|
|
87
|
+
PlaylistID: string;
|
|
88
|
+
ContentID: string;
|
|
89
|
+
TrackNo: number;
|
|
90
|
+
UUID: string;
|
|
91
|
+
rb_data_status: number;
|
|
92
|
+
rb_local_data_status: number;
|
|
93
|
+
rb_local_deleted: number;
|
|
94
|
+
rb_local_synced: number;
|
|
95
|
+
usn: number;
|
|
96
|
+
rb_local_usn: number;
|
|
97
|
+
created_at: string;
|
|
98
|
+
updated_at: string;
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Enriched track within a playlist, with joined metadata from djmdContent.
|
|
102
|
+
*/
|
|
103
|
+
export type PlaylistTrack = {
|
|
104
|
+
trackNo: number;
|
|
105
|
+
id: string;
|
|
106
|
+
filePath: string;
|
|
107
|
+
title: string;
|
|
108
|
+
subTitle: string | null;
|
|
109
|
+
artist: string | null;
|
|
110
|
+
imagePath: string | null;
|
|
111
|
+
bpm: number | null;
|
|
112
|
+
rating: number | null;
|
|
113
|
+
releaseDate: string | null;
|
|
114
|
+
length: number | null;
|
|
115
|
+
colorId: number | null;
|
|
116
|
+
comment: string | null;
|
|
117
|
+
isrc: string | null;
|
|
118
|
+
album: string | null;
|
|
119
|
+
label: string | null;
|
|
120
|
+
genre: string | null;
|
|
121
|
+
key: string | null;
|
|
122
|
+
remixer: string | null;
|
|
123
|
+
};
|
|
39
124
|
export interface RekordboxConnectEvents {
|
|
40
125
|
ready: (info: RekordboxReadyInfo) => void;
|
|
41
126
|
poll: () => void;
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA8BA;;GAEG;AACU,QAAA,eAAe,GAAG,kBAAkB,CAAC"}
|