alphatheta-connect 0.15.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/LICENSE +21 -0
- package/README.md +166 -0
- package/lib/artwork/index.d.ts +9 -0
- package/lib/artwork/parsers/aiff.d.ts +2 -0
- package/lib/artwork/parsers/flac.d.ts +2 -0
- package/lib/artwork/parsers/id3.d.ts +2 -0
- package/lib/artwork/parsers/index.d.ts +5 -0
- package/lib/artwork/parsers/mp4.d.ts +2 -0
- package/lib/artwork/parsers/utils.d.ts +3 -0
- package/lib/artwork/reader.d.ts +15 -0
- package/lib/artwork/types.d.ts +44 -0
- package/lib/cli/index.d.ts +1 -0
- package/lib/cli.js +11431 -0
- package/lib/cli.js.map +1 -0
- package/lib/constants.d.ts +40 -0
- package/lib/control/index.d.ts +20 -0
- package/lib/db/getArtworkFromFile.d.ts +13 -0
- package/lib/db/getArtworkThumbnail.d.ts +29 -0
- package/lib/db/getFile.d.ts +29 -0
- package/lib/db/getMetadata.d.ts +28 -0
- package/lib/db/getPlaylist.d.ts +26 -0
- package/lib/db/getWaveforms.d.ts +29 -0
- package/lib/db/index.d.ts +70 -0
- package/lib/db/utils.d.ts +7 -0
- package/lib/devices/index.d.ts +66 -0
- package/lib/devices/utils.d.ts +5 -0
- package/lib/entities.d.ts +122 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +13381 -0
- package/lib/index.js.map +1 -0
- package/lib/localdb/database-adapter.d.ts +49 -0
- package/lib/localdb/index.d.ts +104 -0
- package/lib/localdb/onelibrary-schema.d.ts +250 -0
- package/lib/localdb/onelibrary.d.ts +185 -0
- package/lib/localdb/orm.d.ts +60 -0
- package/lib/localdb/rekordbox.d.ts +112 -0
- package/lib/localdb/schema.d.ts +1 -0
- package/lib/localdb/utils.d.ts +5 -0
- package/lib/mixstatus/index.d.ts +109 -0
- package/lib/mixstatus/utils.d.ts +9 -0
- package/lib/network.d.ts +201 -0
- package/lib/nfs/index.d.ts +63 -0
- package/lib/nfs/programs.d.ts +61 -0
- package/lib/nfs/rpc.d.ts +60 -0
- package/lib/nfs/utils.d.ts +4 -0
- package/lib/nfs/xdr.d.ts +17 -0
- package/lib/passive/alphatheta.d.ts +94 -0
- package/lib/passive/devices.d.ts +64 -0
- package/lib/passive/index.d.ts +169 -0
- package/lib/passive/localdb.d.ts +122 -0
- package/lib/passive/pcap-adapter.d.ts +77 -0
- package/lib/passive/position.d.ts +32 -0
- package/lib/passive/remotedb.d.ts +49 -0
- package/lib/passive/status.d.ts +41 -0
- package/lib/remotedb/constants.d.ts +8 -0
- package/lib/remotedb/fields.d.ts +169 -0
- package/lib/remotedb/index.d.ts +160 -0
- package/lib/remotedb/message/index.d.ts +39 -0
- package/lib/remotedb/message/item.d.ts +530 -0
- package/lib/remotedb/message/response.d.ts +18 -0
- package/lib/remotedb/message/types.d.ts +227 -0
- package/lib/remotedb/queries.d.ts +99 -0
- package/lib/remotedb/utils.d.ts +23 -0
- package/lib/status/index.d.ts +39 -0
- package/lib/status/media.d.ts +22 -0
- package/lib/status/position.d.ts +29 -0
- package/lib/status/types.d.ts +170 -0
- package/lib/status/utils.d.ts +19 -0
- package/lib/types.d.ts +457 -0
- package/lib/types.js +274 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/converters.d.ts +17 -0
- package/lib/utils/index.d.ts +28 -0
- package/lib/utils/telemetry.d.ts +82 -0
- package/lib/utils/udp.d.ts +20 -0
- package/lib/virtualcdj/index.d.ts +33 -0
- package/package.json +93 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common interface for database adapters.
|
|
3
|
+
*
|
|
4
|
+
* Both MetadataORM (for PDB files) and OneLibraryAdapter (for exportLibrary.db)
|
|
5
|
+
* implement this interface, allowing LocalDatabase to use either transparently.
|
|
6
|
+
*/
|
|
7
|
+
import { EntityFK, Playlist, PlaylistEntry, Track } from "../entities";
|
|
8
|
+
/**
|
|
9
|
+
* Database format preference for loading rekordbox databases.
|
|
10
|
+
*
|
|
11
|
+
* - 'auto': Try OneLibrary first (rekordbox 7.x+), fall back to PDB (rekordbox 6.x)
|
|
12
|
+
* - 'oneLibrary': Only use OneLibrary format (exportLibrary.db)
|
|
13
|
+
* - 'pdb': Only use PDB format (export.pdb)
|
|
14
|
+
*/
|
|
15
|
+
export type DatabasePreference = 'auto' | 'oneLibrary' | 'pdb';
|
|
16
|
+
/**
|
|
17
|
+
* Result of a playlist query
|
|
18
|
+
*/
|
|
19
|
+
export interface PlaylistQueryResult {
|
|
20
|
+
folders: Playlist[];
|
|
21
|
+
playlists: Playlist[];
|
|
22
|
+
trackEntries: PlaylistEntry<EntityFK.WithFKs>[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Database type identifier
|
|
26
|
+
*/
|
|
27
|
+
export type DatabaseType = 'oneLibrary' | 'pdb';
|
|
28
|
+
/**
|
|
29
|
+
* Common interface for database adapters
|
|
30
|
+
*/
|
|
31
|
+
export interface DatabaseAdapter {
|
|
32
|
+
/**
|
|
33
|
+
* The type of database (oneLibrary or pdb)
|
|
34
|
+
*/
|
|
35
|
+
readonly type: DatabaseType;
|
|
36
|
+
/**
|
|
37
|
+
* Find a track by ID
|
|
38
|
+
*/
|
|
39
|
+
findTrack(id: number): Track | null;
|
|
40
|
+
/**
|
|
41
|
+
* Query for a list of {folders, playlists, tracks} given a playlist ID.
|
|
42
|
+
* If no ID is provided the root list is queried.
|
|
43
|
+
*/
|
|
44
|
+
findPlaylist(playlistId?: number): PlaylistQueryResult;
|
|
45
|
+
/**
|
|
46
|
+
* Close the database connection
|
|
47
|
+
*/
|
|
48
|
+
close(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import DeviceManager from "../devices";
|
|
4
|
+
import { FetchProgress } from "../nfs";
|
|
5
|
+
import StatusEmitter from "../status";
|
|
6
|
+
import { Device, DeviceID, MediaSlot } from "../types";
|
|
7
|
+
import { DatabaseAdapter, DatabasePreference, DatabaseType } from './database-adapter';
|
|
8
|
+
import { HydrationProgress } from './rekordbox';
|
|
9
|
+
/**
|
|
10
|
+
* Rekordbox databases will only exist within these two slots
|
|
11
|
+
*/
|
|
12
|
+
type DatabaseSlot = MediaSlot.USB | MediaSlot.SD;
|
|
13
|
+
interface CommonProgressOpts {
|
|
14
|
+
/**
|
|
15
|
+
* The device progress is being reported for
|
|
16
|
+
*/
|
|
17
|
+
device: Device;
|
|
18
|
+
/**
|
|
19
|
+
* The media slot progress is being reported for
|
|
20
|
+
*/
|
|
21
|
+
slot: MediaSlot;
|
|
22
|
+
}
|
|
23
|
+
type DownloadProgressOpts = CommonProgressOpts & {
|
|
24
|
+
/**
|
|
25
|
+
* The current progress of the fetch
|
|
26
|
+
*/
|
|
27
|
+
progress: FetchProgress;
|
|
28
|
+
};
|
|
29
|
+
type HydrationProgressOpts = CommonProgressOpts & {
|
|
30
|
+
/**
|
|
31
|
+
* The current progress of the database hydration
|
|
32
|
+
*/
|
|
33
|
+
progress: HydrationProgress;
|
|
34
|
+
};
|
|
35
|
+
type HydrationDoneOpts = CommonProgressOpts;
|
|
36
|
+
/**
|
|
37
|
+
* Events that may be triggered by the LocalDatabase emitter
|
|
38
|
+
*/
|
|
39
|
+
interface DatabaseEvents {
|
|
40
|
+
/**
|
|
41
|
+
* Triggered when we are fetching a database from a CDJ
|
|
42
|
+
*/
|
|
43
|
+
fetchProgress: (opts: DownloadProgressOpts) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Triggered when we are hydrating a rekordbox database into the in-memory
|
|
46
|
+
* sqlite database.
|
|
47
|
+
*/
|
|
48
|
+
hydrationProgress: (opts: HydrationProgressOpts) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Triggered when the database has been fully hydrated.
|
|
51
|
+
*
|
|
52
|
+
* There is a period of time between hydrationProgress reporting 100% copletion,
|
|
53
|
+
* and the database being flushed, so it may be useful to wait for this event
|
|
54
|
+
* before considering the database to be fully hydrated.
|
|
55
|
+
*/
|
|
56
|
+
hydrationDone: (opts: HydrationDoneOpts) => void;
|
|
57
|
+
}
|
|
58
|
+
type Emitter = StrictEventEmitter<EventEmitter, DatabaseEvents>;
|
|
59
|
+
/**
|
|
60
|
+
* The local database is responsible for syncing the remote rekordbox databases
|
|
61
|
+
* of media slots on a device into in-memory sqlite databases.
|
|
62
|
+
*
|
|
63
|
+
* This service will attempt to ensure the in-memory databases for each media
|
|
64
|
+
* device that is connected to a CDJ is locally kept in sync. Fetching the
|
|
65
|
+
* database for any media slot of it's not already cached.
|
|
66
|
+
*/
|
|
67
|
+
declare class LocalDatabase {
|
|
68
|
+
#private;
|
|
69
|
+
constructor(hostDevice: Device, deviceManager: DeviceManager, statusEmitter: StatusEmitter, preference?: DatabasePreference);
|
|
70
|
+
/**
|
|
71
|
+
* Get the current database preference
|
|
72
|
+
*/
|
|
73
|
+
get preference(): DatabasePreference;
|
|
74
|
+
/**
|
|
75
|
+
* Set the database preference. Only affects newly loaded databases.
|
|
76
|
+
*/
|
|
77
|
+
set preference(value: DatabasePreference);
|
|
78
|
+
on: Emitter['on'];
|
|
79
|
+
off: Emitter['off'];
|
|
80
|
+
once: Emitter['once'];
|
|
81
|
+
/**
|
|
82
|
+
* Disconnects the local database connection for the specified device
|
|
83
|
+
*/
|
|
84
|
+
disconnectForDevice(device: Device): void;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the database adapter for the media metadata in the provided device slot.
|
|
87
|
+
*
|
|
88
|
+
* If the database has not already been loaded this will first fetch and load the
|
|
89
|
+
* database, which may take some time depending on the size of the database.
|
|
90
|
+
*
|
|
91
|
+
* @returns null if no rekordbox media present
|
|
92
|
+
*/
|
|
93
|
+
get(deviceId: DeviceID, slot: DatabaseSlot): Promise<DatabaseAdapter | null>;
|
|
94
|
+
/**
|
|
95
|
+
* Get the database type for an already-loaded device slot.
|
|
96
|
+
* Returns null if no database is loaded for that device/slot.
|
|
97
|
+
*/
|
|
98
|
+
getDatabaseType(deviceId: DeviceID, slot: DatabaseSlot): DatabaseType | null;
|
|
99
|
+
/**
|
|
100
|
+
* Preload the databases for all connected devices.
|
|
101
|
+
*/
|
|
102
|
+
preload(): Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
export default LocalDatabase;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript interfaces for the OneLibrary (exportLibrary.db) SQLite schema.
|
|
3
|
+
*
|
|
4
|
+
* These match the actual column names in the SQLite database,
|
|
5
|
+
* which differ from the legacy PDB format.
|
|
6
|
+
*
|
|
7
|
+
* Note: Column names use camelCase in the database (e.g., bpmx100, titleForSearch)
|
|
8
|
+
*/
|
|
9
|
+
export interface ContentRow {
|
|
10
|
+
content_id: number;
|
|
11
|
+
title: string | null;
|
|
12
|
+
titleForSearch: string | null;
|
|
13
|
+
subtitle: string | null;
|
|
14
|
+
bpmx100: number | null;
|
|
15
|
+
length: number | null;
|
|
16
|
+
trackNo: number | null;
|
|
17
|
+
discNo: number | null;
|
|
18
|
+
artist_id_artist: number | null;
|
|
19
|
+
artist_id_remixer: number | null;
|
|
20
|
+
artist_id_originalArtist: number | null;
|
|
21
|
+
artist_id_composer: number | null;
|
|
22
|
+
artist_id_lyricist: number | null;
|
|
23
|
+
album_id: number | null;
|
|
24
|
+
genre_id: number | null;
|
|
25
|
+
label_id: number | null;
|
|
26
|
+
key_id: number | null;
|
|
27
|
+
color_id: number | null;
|
|
28
|
+
image_id: number | null;
|
|
29
|
+
djComment: string | null;
|
|
30
|
+
rating: number | null;
|
|
31
|
+
releaseYear: number | null;
|
|
32
|
+
releaseDate: string | null;
|
|
33
|
+
dateCreated: string | null;
|
|
34
|
+
dateAdded: string | null;
|
|
35
|
+
path: string | null;
|
|
36
|
+
fileName: string | null;
|
|
37
|
+
fileSize: number | null;
|
|
38
|
+
fileType: number | null;
|
|
39
|
+
bitrate: number | null;
|
|
40
|
+
bitDepth: number | null;
|
|
41
|
+
samplingRate: number | null;
|
|
42
|
+
isrc: string | null;
|
|
43
|
+
djPlayCount: number | null;
|
|
44
|
+
isHotCueAutoLoadOn: number | null;
|
|
45
|
+
isKuvoDeliverStatusOn: number | null;
|
|
46
|
+
kuvoDeliveryComment: string | null;
|
|
47
|
+
masterDbId: number | null;
|
|
48
|
+
masterContentId: number | null;
|
|
49
|
+
analysisDataFilePath: string | null;
|
|
50
|
+
analysedBits: number | null;
|
|
51
|
+
contentLink: number | null;
|
|
52
|
+
hasModified: number | null;
|
|
53
|
+
cueUpdateCount: number | null;
|
|
54
|
+
analysisDataUpdateCount: number | null;
|
|
55
|
+
informationUpdateCount: number | null;
|
|
56
|
+
}
|
|
57
|
+
export interface ArtistRow {
|
|
58
|
+
artist_id: number;
|
|
59
|
+
name: string | null;
|
|
60
|
+
nameForSearch: string | null;
|
|
61
|
+
}
|
|
62
|
+
export interface AlbumRow {
|
|
63
|
+
album_id: number;
|
|
64
|
+
name: string | null;
|
|
65
|
+
artist_id: number | null;
|
|
66
|
+
image_id: number | null;
|
|
67
|
+
isComplation: number | null;
|
|
68
|
+
nameForSearch: string | null;
|
|
69
|
+
}
|
|
70
|
+
export interface GenreRow {
|
|
71
|
+
genre_id: number;
|
|
72
|
+
name: string | null;
|
|
73
|
+
}
|
|
74
|
+
export interface KeyRow {
|
|
75
|
+
key_id: number;
|
|
76
|
+
name: string | null;
|
|
77
|
+
}
|
|
78
|
+
export interface ColorRow {
|
|
79
|
+
color_id: number;
|
|
80
|
+
name: string | null;
|
|
81
|
+
}
|
|
82
|
+
export interface LabelRow {
|
|
83
|
+
label_id: number;
|
|
84
|
+
name: string | null;
|
|
85
|
+
}
|
|
86
|
+
export interface ImageRow {
|
|
87
|
+
image_id: number;
|
|
88
|
+
path: string | null;
|
|
89
|
+
}
|
|
90
|
+
export interface CueRow {
|
|
91
|
+
cue_id: number;
|
|
92
|
+
content_id: number | null;
|
|
93
|
+
kind: number | null;
|
|
94
|
+
colorTableIndex: number | null;
|
|
95
|
+
cueComment: string | null;
|
|
96
|
+
isActiveLoop: number | null;
|
|
97
|
+
beatLoopNumerator: number | null;
|
|
98
|
+
beatLoopDenominator: number | null;
|
|
99
|
+
inUsec: number | null;
|
|
100
|
+
outUsec: number | null;
|
|
101
|
+
in150FramePerSec: number | null;
|
|
102
|
+
out150FramePerSec: number | null;
|
|
103
|
+
inMpegFrameNumber: number | null;
|
|
104
|
+
outMpegFrameNumber: number | null;
|
|
105
|
+
inMpegAbs: number | null;
|
|
106
|
+
outMpegAbs: number | null;
|
|
107
|
+
inDecodingStartFramePosition: number | null;
|
|
108
|
+
outDecodingStartFramePosition: number | null;
|
|
109
|
+
inFileOffsetInBlock: number | null;
|
|
110
|
+
OutFileOffsetInBlock: number | null;
|
|
111
|
+
inNumberOfSampleInBlock: number | null;
|
|
112
|
+
outNumberOfSampleInBlock: number | null;
|
|
113
|
+
}
|
|
114
|
+
export interface PlaylistRow {
|
|
115
|
+
playlist_id: number;
|
|
116
|
+
sequenceNo: number | null;
|
|
117
|
+
name: string | null;
|
|
118
|
+
image_id: number | null;
|
|
119
|
+
attribute: number | null;
|
|
120
|
+
playlist_id_parent: number | null;
|
|
121
|
+
}
|
|
122
|
+
export interface PlaylistContentRow {
|
|
123
|
+
playlist_id: number;
|
|
124
|
+
content_id: number;
|
|
125
|
+
sequenceNo: number;
|
|
126
|
+
}
|
|
127
|
+
export interface PropertyRow {
|
|
128
|
+
deviceName: string | null;
|
|
129
|
+
dbVersion: string | null;
|
|
130
|
+
numberOfContents: number | null;
|
|
131
|
+
createdDate: string | null;
|
|
132
|
+
backGroundColorType: number | null;
|
|
133
|
+
myTagMasterDBID: number | null;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Cue point types based on the 'kind' field in the cue table.
|
|
137
|
+
*
|
|
138
|
+
* Note: These values may vary. Verify with actual data.
|
|
139
|
+
*/
|
|
140
|
+
export declare const CueKind: {
|
|
141
|
+
readonly MEMORY_CUE: 0;
|
|
142
|
+
readonly HOT_CUE: 1;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Playlist attribute types based on the 'attribute' field.
|
|
146
|
+
*/
|
|
147
|
+
export declare const PlaylistAttribute: {
|
|
148
|
+
readonly PLAYLIST: 0;
|
|
149
|
+
readonly FOLDER: 1;
|
|
150
|
+
};
|
|
151
|
+
export interface MyTagRow {
|
|
152
|
+
myTag_id: number;
|
|
153
|
+
sequenceNo: number | null;
|
|
154
|
+
name: string | null;
|
|
155
|
+
attribute: number | null;
|
|
156
|
+
myTag_id_parent: number | null;
|
|
157
|
+
}
|
|
158
|
+
export interface MyTagContentRow {
|
|
159
|
+
myTag_id: number;
|
|
160
|
+
content_id: number;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* MyTag attribute types based on the 'attribute' field.
|
|
164
|
+
*/
|
|
165
|
+
export declare const MyTagAttribute: {
|
|
166
|
+
readonly TAG: 0;
|
|
167
|
+
readonly FOLDER: 1;
|
|
168
|
+
};
|
|
169
|
+
export interface HistoryRow {
|
|
170
|
+
history_id: number;
|
|
171
|
+
sequenceNo: number | null;
|
|
172
|
+
name: string | null;
|
|
173
|
+
attribute: number | null;
|
|
174
|
+
history_id_parent: number | null;
|
|
175
|
+
}
|
|
176
|
+
export interface HistoryContentRow {
|
|
177
|
+
history_id: number;
|
|
178
|
+
content_id: number;
|
|
179
|
+
sequenceNo: number;
|
|
180
|
+
}
|
|
181
|
+
export interface HotCueBankListRow {
|
|
182
|
+
hotCueBankList_id: number;
|
|
183
|
+
sequenceNo: number | null;
|
|
184
|
+
name: string | null;
|
|
185
|
+
image_id: number | null;
|
|
186
|
+
attribute: number | null;
|
|
187
|
+
hotCueBankList_id_parent: number | null;
|
|
188
|
+
}
|
|
189
|
+
export interface HotCueBankListCueRow {
|
|
190
|
+
hotCueBankList_id: number;
|
|
191
|
+
cue_id: number;
|
|
192
|
+
sequenceNo: number;
|
|
193
|
+
}
|
|
194
|
+
export interface MenuItemRow {
|
|
195
|
+
menuItem_id: number;
|
|
196
|
+
kind: number | null;
|
|
197
|
+
name: string | null;
|
|
198
|
+
}
|
|
199
|
+
export interface CategoryRow {
|
|
200
|
+
category_id: number;
|
|
201
|
+
menuItem_id: number | null;
|
|
202
|
+
sequenceNo: number | null;
|
|
203
|
+
isVisible: number | null;
|
|
204
|
+
}
|
|
205
|
+
export interface SortRow {
|
|
206
|
+
sort_id: number;
|
|
207
|
+
menuItem_id: number | null;
|
|
208
|
+
sequenceNo: number | null;
|
|
209
|
+
isVisible: number | null;
|
|
210
|
+
isSelectedAsSubColumn: number | null;
|
|
211
|
+
}
|
|
212
|
+
export interface RecommendedLikeRow {
|
|
213
|
+
content_id_1: number;
|
|
214
|
+
content_id_2: number;
|
|
215
|
+
rating: number | null;
|
|
216
|
+
createdDate: number | null;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Menu item kinds for browsing categories.
|
|
220
|
+
* These match the 'kind' field in the menuItem table.
|
|
221
|
+
*/
|
|
222
|
+
export declare const MenuItemKind: {
|
|
223
|
+
readonly GENRE: 128;
|
|
224
|
+
readonly ARTIST: 129;
|
|
225
|
+
readonly ALBUM: 130;
|
|
226
|
+
readonly TRACK: 131;
|
|
227
|
+
readonly PLAYLIST: 132;
|
|
228
|
+
readonly BPM: 133;
|
|
229
|
+
readonly RATING: 134;
|
|
230
|
+
readonly YEAR: 135;
|
|
231
|
+
readonly REMIXER: 136;
|
|
232
|
+
readonly LABEL: 137;
|
|
233
|
+
readonly ORIGINAL_ARTIST: 138;
|
|
234
|
+
readonly KEY: 139;
|
|
235
|
+
readonly DATE_ADDED: 140;
|
|
236
|
+
readonly CUE: 141;
|
|
237
|
+
readonly COLOR: 142;
|
|
238
|
+
readonly FOLDER: 144;
|
|
239
|
+
readonly SEARCH: 145;
|
|
240
|
+
readonly TIME: 146;
|
|
241
|
+
readonly BITRATE: 147;
|
|
242
|
+
readonly FILE_NAME: 148;
|
|
243
|
+
readonly HISTORY: 149;
|
|
244
|
+
readonly COMMENTS: 150;
|
|
245
|
+
readonly DJ_PLAY_COUNT: 151;
|
|
246
|
+
readonly HOT_CUE_BANK: 152;
|
|
247
|
+
readonly DEFAULT: 161;
|
|
248
|
+
readonly ALPHABET: 162;
|
|
249
|
+
readonly MATCHING: 170;
|
|
250
|
+
};
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OneLibrary Database Adapter
|
|
3
|
+
*
|
|
4
|
+
* Provides an interface for reading the OneLibrary (exportLibrary.db) SQLite database
|
|
5
|
+
* used by modern rekordbox versions and Pioneer DJ devices.
|
|
6
|
+
*
|
|
7
|
+
* The database is encrypted with SQLCipher 4. The encryption key is derived from
|
|
8
|
+
* a hardcoded obfuscated blob.
|
|
9
|
+
*/
|
|
10
|
+
import Database from 'better-sqlite3-multiple-ciphers';
|
|
11
|
+
import { Album, Artist, Artwork, Color, EntityFK, Genre, Key, Label, Playlist, PlaylistEntry, Track } from "../entities";
|
|
12
|
+
import { CueAndLoop } from "../types";
|
|
13
|
+
import { DatabaseAdapter, DatabaseType } from './database-adapter';
|
|
14
|
+
/**
|
|
15
|
+
* Get the SQLCipher encryption key for OneLibrary databases
|
|
16
|
+
*/
|
|
17
|
+
export declare function getEncryptionKey(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Open a OneLibrary database with SQLCipher decryption
|
|
20
|
+
*/
|
|
21
|
+
export declare function openOneLibraryDb(dbPath: string): Database.Database;
|
|
22
|
+
/**
|
|
23
|
+
* Adapter for OneLibrary database that matches the ORM interface.
|
|
24
|
+
* Queries the SQLite file directly instead of hydrating into memory.
|
|
25
|
+
*/
|
|
26
|
+
export declare class OneLibraryAdapter implements DatabaseAdapter {
|
|
27
|
+
#private;
|
|
28
|
+
readonly type: DatabaseType;
|
|
29
|
+
constructor(dbPath: string);
|
|
30
|
+
/**
|
|
31
|
+
* Close the database connection
|
|
32
|
+
*/
|
|
33
|
+
close(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Find a track by ID
|
|
36
|
+
*/
|
|
37
|
+
findTrack(id: number): Track | null;
|
|
38
|
+
/**
|
|
39
|
+
* Find all tracks in the database
|
|
40
|
+
*/
|
|
41
|
+
findAllTracks(): Track[];
|
|
42
|
+
/**
|
|
43
|
+
* Find cue points for a track
|
|
44
|
+
*/
|
|
45
|
+
findCues(trackId: number): CueAndLoop[];
|
|
46
|
+
/**
|
|
47
|
+
* Find a playlist by ID
|
|
48
|
+
*/
|
|
49
|
+
findPlaylistById(playlistId: number): Playlist | null;
|
|
50
|
+
/**
|
|
51
|
+
* Query for a list of {folders, playlists, tracks} given a playlist ID.
|
|
52
|
+
* If no ID is provided the root list is queried.
|
|
53
|
+
*/
|
|
54
|
+
findPlaylist(playlistId?: number): {
|
|
55
|
+
folders: Playlist[];
|
|
56
|
+
playlists: Playlist[];
|
|
57
|
+
trackEntries: PlaylistEntry<EntityFK.WithFKs>[];
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Get track IDs for a playlist in order
|
|
61
|
+
*/
|
|
62
|
+
findPlaylistContents(playlistId: number): number[];
|
|
63
|
+
findArtist(artistId: number): Artist | null;
|
|
64
|
+
findAlbum(albumId: number): Album | null;
|
|
65
|
+
findGenre(genreId: number): Genre | null;
|
|
66
|
+
findKey(keyId: number): Key | null;
|
|
67
|
+
findColor(colorId: number): Color | null;
|
|
68
|
+
findLabel(labelId: number): Label | null;
|
|
69
|
+
findArtwork(imageId: number): Artwork | null;
|
|
70
|
+
/**
|
|
71
|
+
* Find all root-level MyTags (folders and tags with no parent)
|
|
72
|
+
*/
|
|
73
|
+
findMyTags(parentId?: number): {
|
|
74
|
+
folders: MyTag[];
|
|
75
|
+
tags: MyTag[];
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Find a MyTag by ID
|
|
79
|
+
*/
|
|
80
|
+
findMyTagById(myTagId: number): MyTag | null;
|
|
81
|
+
/**
|
|
82
|
+
* Get track IDs for a MyTag
|
|
83
|
+
*/
|
|
84
|
+
findMyTagContents(myTagId: number): number[];
|
|
85
|
+
/**
|
|
86
|
+
* Get all MyTags assigned to a track
|
|
87
|
+
*/
|
|
88
|
+
findMyTagsForTrack(trackId: number): MyTag[];
|
|
89
|
+
/**
|
|
90
|
+
* Find all history sessions
|
|
91
|
+
*/
|
|
92
|
+
findHistorySessions(): HistorySession[];
|
|
93
|
+
/**
|
|
94
|
+
* Get track IDs for a history session in order
|
|
95
|
+
*/
|
|
96
|
+
findHistoryContents(historyId: number): number[];
|
|
97
|
+
/**
|
|
98
|
+
* Find all hot cue bank lists
|
|
99
|
+
*/
|
|
100
|
+
findHotCueBankLists(): HotCueBankList[];
|
|
101
|
+
/**
|
|
102
|
+
* Get cue IDs for a hot cue bank list
|
|
103
|
+
*/
|
|
104
|
+
findHotCueBankListCues(bankListId: number): number[];
|
|
105
|
+
/**
|
|
106
|
+
* Get all menu items (browse categories)
|
|
107
|
+
*/
|
|
108
|
+
findMenuItems(): MenuItem[];
|
|
109
|
+
/**
|
|
110
|
+
* Get visible categories with their menu item info
|
|
111
|
+
*/
|
|
112
|
+
findVisibleCategories(): Category[];
|
|
113
|
+
/**
|
|
114
|
+
* Get visible sort options
|
|
115
|
+
*/
|
|
116
|
+
findVisibleSortOptions(): SortOption[];
|
|
117
|
+
/**
|
|
118
|
+
* Get device properties
|
|
119
|
+
*/
|
|
120
|
+
getProperty(): DeviceProperty | null;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* User-created tag (MyTag)
|
|
124
|
+
*/
|
|
125
|
+
export interface MyTag {
|
|
126
|
+
id: number;
|
|
127
|
+
name: string;
|
|
128
|
+
isFolder: boolean;
|
|
129
|
+
parentId: number | null;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* History session
|
|
133
|
+
*/
|
|
134
|
+
export interface HistorySession {
|
|
135
|
+
id: number;
|
|
136
|
+
name: string;
|
|
137
|
+
parentId: number | null;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Hot cue bank list
|
|
141
|
+
*/
|
|
142
|
+
export interface HotCueBankList {
|
|
143
|
+
id: number;
|
|
144
|
+
name: string;
|
|
145
|
+
parentId: number | null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Menu item for browsing
|
|
149
|
+
*/
|
|
150
|
+
export interface MenuItem {
|
|
151
|
+
id: number;
|
|
152
|
+
kind: number;
|
|
153
|
+
name: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Browse category
|
|
157
|
+
*/
|
|
158
|
+
export interface Category {
|
|
159
|
+
id: number;
|
|
160
|
+
menuItemId: number;
|
|
161
|
+
name: string;
|
|
162
|
+
kind: number;
|
|
163
|
+
isVisible: boolean;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Sort option
|
|
167
|
+
*/
|
|
168
|
+
export interface SortOption {
|
|
169
|
+
id: number;
|
|
170
|
+
menuItemId: number;
|
|
171
|
+
name: string;
|
|
172
|
+
kind: number;
|
|
173
|
+
isVisible: boolean;
|
|
174
|
+
isSelectedAsSubColumn: boolean;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Device property
|
|
178
|
+
*/
|
|
179
|
+
export interface DeviceProperty {
|
|
180
|
+
deviceName: string;
|
|
181
|
+
dbVersion: string;
|
|
182
|
+
numberOfContents: number;
|
|
183
|
+
createdDate: string;
|
|
184
|
+
backgroundColorType: number;
|
|
185
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { EntityFK, Playlist, PlaylistEntry, Track } from "../entities";
|
|
2
|
+
import { DatabaseAdapter, DatabaseType } from './database-adapter';
|
|
3
|
+
/**
|
|
4
|
+
* Table names available
|
|
5
|
+
*/
|
|
6
|
+
export declare enum Table {
|
|
7
|
+
Artist = "artist",
|
|
8
|
+
Album = "album",
|
|
9
|
+
Genre = "genre",
|
|
10
|
+
Color = "color",
|
|
11
|
+
Label = "label",
|
|
12
|
+
Key = "key",
|
|
13
|
+
Artwork = "artwork",
|
|
14
|
+
Playlist = "playlist",
|
|
15
|
+
PlaylistEntry = "playlist_entry",
|
|
16
|
+
Track = "track"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Object Relation Mapper as an abstraction ontop of a local database
|
|
20
|
+
* connection.
|
|
21
|
+
*
|
|
22
|
+
* May be used to populate a metadata database and query objects.
|
|
23
|
+
*/
|
|
24
|
+
export declare class MetadataORM implements DatabaseAdapter {
|
|
25
|
+
#private;
|
|
26
|
+
readonly type: DatabaseType;
|
|
27
|
+
constructor();
|
|
28
|
+
close(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Begin a transaction for bulk inserts. Call commit() when done.
|
|
31
|
+
*/
|
|
32
|
+
beginTransaction(): void;
|
|
33
|
+
/**
|
|
34
|
+
* Commit the current transaction.
|
|
35
|
+
*/
|
|
36
|
+
commit(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Insert a entity object into the database.
|
|
39
|
+
* For bulk inserts, call beginTransaction() first and commit() when done.
|
|
40
|
+
*/
|
|
41
|
+
insertEntity(table: Table, object: Record<string, any>): void;
|
|
42
|
+
/**
|
|
43
|
+
* Locate a track by ID in the database
|
|
44
|
+
*/
|
|
45
|
+
findTrack(id: number): Track | null;
|
|
46
|
+
/**
|
|
47
|
+
* Query for a list of {folders, playlists, tracks} given a playlist ID. If
|
|
48
|
+
* no ID is provided the root list is queried.
|
|
49
|
+
*
|
|
50
|
+
* Note that when tracks are returned there will be no folders or playslists.
|
|
51
|
+
* But the API here is simpler to assume there could be.
|
|
52
|
+
*
|
|
53
|
+
* Tracks are returned in the order they are placed on the playlist.
|
|
54
|
+
*/
|
|
55
|
+
findPlaylist(playlistId?: number): {
|
|
56
|
+
folders: Playlist[];
|
|
57
|
+
playlists: Playlist[];
|
|
58
|
+
trackEntries: PlaylistEntry<EntityFK.WithFKs>[];
|
|
59
|
+
};
|
|
60
|
+
}
|