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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2013 Evan Purkhiser
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src=".github/logo.svg" alt="alphatheta-connect" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h3 align="center">
|
|
6
|
+
AlphaTheta's PRO DJ LINK protocol, unlocked.
|
|
7
|
+
<br>
|
|
8
|
+
Consume CDJ states + Retrieve complete track metadata.
|
|
9
|
+
</h3>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<img src="https://github.com/chrisle/alphatheta-connect/workflows/build/badge.svg" alt="build" />
|
|
13
|
+
<a href="https://www.npmjs.com/package/alphatheta-connect"><img alt="npm" src="https://img.shields.io/npm/v/alphatheta-connect"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
This library implements the Pioneer PROLINK network protocol + additional
|
|
19
|
+
functionality to interact with the prolink network. This library is used as
|
|
20
|
+
part of [Prolink Tools](https://prolink.tools/).
|
|
21
|
+
|
|
22
|
+
Alternative implementations of the Prolink protocol: [Java](https://github.com/Deep-Symmetry/beat-link), [golang](https://github.com/evanpurkhiser/prolink-go).
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
- **Support for AlphaTheta Opus Quad, XDJ-RX3, XDJ-RX2, XDJ-RX, and XDJ-XZ** *(new)* -
|
|
27
|
+
Passive mode monitoring via pcap-based packet capture for all-in-one controllers
|
|
28
|
+
where traditional virtual CDJ connection isn't possible.
|
|
29
|
+
See [ALL_IN_ONE_UNITS.md](docs/ALL_IN_ONE_UNITS.md) for details.
|
|
30
|
+
|
|
31
|
+
- **OneLibrary Support** *(new)* - Full support for rekordbox 7.x's new OneLibrary
|
|
32
|
+
format (exportLibrary.db) with SQLCipher encryption, including tracks, playlists,
|
|
33
|
+
cues, hot cue banks, myTags, and history.
|
|
34
|
+
|
|
35
|
+
- **6-Channel On-Air Support** - Full support for 6-channel configurations with
|
|
36
|
+
CDJ-3000, CDJ-3000x, and DJM-V10 mixers.
|
|
37
|
+
See [ON_AIR_CHANNELS.md](docs/ON_AIR_CHANNELS.md) for details.
|
|
38
|
+
|
|
39
|
+
- **Artwork Extraction via NFS** - Extract album artwork directly from audio files
|
|
40
|
+
on connected media via the NFS protocol.
|
|
41
|
+
|
|
42
|
+
- **Configurable Virtual CDJ Name** - Customize the name that appears on the network
|
|
43
|
+
for your virtual CDJ device.
|
|
44
|
+
|
|
45
|
+
- **Optional Full DJ Link Startup Protocol** - Enable the complete startup handshake
|
|
46
|
+
sequence for better compatibility with certain device configurations.
|
|
47
|
+
See [FULL_STARTUP.md](docs/FULL_STARTUP.md) for details.
|
|
48
|
+
|
|
49
|
+
- **Extended ANLZ Support** - Full support for rekordbox analysis files including:
|
|
50
|
+
- Extended cues with RGB colors and comments (PCO2)
|
|
51
|
+
- Song structure / phrase analysis for CDJ-3000 (PSSI)
|
|
52
|
+
- Multiple waveform formats (PWAV, PWV2, PWV3, PWV4, PWV5)
|
|
53
|
+
- See [EXTENDED_ANLZ.md](docs/EXTENDED_ANLZ.md) for details
|
|
54
|
+
|
|
55
|
+
- **CDJ-3000 Features** - Complete support for CDJ-3000 specific features:
|
|
56
|
+
- Absolute position tracking (30ms updates)
|
|
57
|
+
- Compatible startup packets for devices on channels 5-6
|
|
58
|
+
- See [ABSOLUTE_POSITION.md](docs/ABSOLUTE_POSITION.md) for details
|
|
59
|
+
|
|
60
|
+
- **Written in Typescript** - Accurate typings making implementation a breeze.
|
|
61
|
+
Autocompete your DJ tools to completion.
|
|
62
|
+
|
|
63
|
+
- **CDJ Status** - Receive Player state details for each CDJ on the network.
|
|
64
|
+
The status is reported as a [`CDJStatus.State`](https://connect.prolink.tools/modules/_src_status_types_.html).
|
|
65
|
+
|
|
66
|
+
- **Metadata Database** - Access metadata of currently the currently playing
|
|
67
|
+
(or not!) tracks stored in the connected Rekordbox formatted USB / SD
|
|
68
|
+
device, or via Rekordbox link.
|
|
69
|
+
|
|
70
|
+
- **Opt-in Telemetry** - Optional error reporting via Sentry to help improve the
|
|
71
|
+
library (disabled by default, configurable via environment variable).
|
|
72
|
+
|
|
73
|
+
## Library usage
|
|
74
|
+
|
|
75
|
+
### Connecting to the network
|
|
76
|
+
|
|
77
|
+
To talk with Prolink devices on the network you'll first need to...
|
|
78
|
+
|
|
79
|
+
1. Bring the network online
|
|
80
|
+
2. Configure the network to be connected to.
|
|
81
|
+
3. Connect to the devices on the network
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
import {bringOnline} from 'alphatheta-connect';
|
|
85
|
+
|
|
86
|
+
async function main() {
|
|
87
|
+
// Bring the prolink network online.
|
|
88
|
+
//
|
|
89
|
+
// This will begin listening for prolink devices on the network that send
|
|
90
|
+
// regular announcement packets over UDP.
|
|
91
|
+
//
|
|
92
|
+
// This will FAIL if Rekordbox is running on the same computer, or a second
|
|
93
|
+
// instance of the alphatheta-connect library is running on the same machine.
|
|
94
|
+
console.info('Bringing the network online');
|
|
95
|
+
const network = await bringOnline();
|
|
96
|
+
|
|
97
|
+
// Once online we can listen for appearing on the network
|
|
98
|
+
network.deviceManager.on('connected', device =>
|
|
99
|
+
console.log('New device on network:', device)
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
// To configure the online network to be "connected" we must need to specify
|
|
103
|
+
// what network device to use to announce ourselves as a "virtual" device
|
|
104
|
+
// onto the network, and what ID we want to announce ourselves as. By
|
|
105
|
+
// announcing ourselves this will cause other devices to send us more detailed
|
|
106
|
+
// information.
|
|
107
|
+
//
|
|
108
|
+
// There are two ways to configure the network:
|
|
109
|
+
//
|
|
110
|
+
// 1. Automatically - You can ask alphatheta-connect to wait for a device to
|
|
111
|
+
// appear on the network to determine what network interface devices exist
|
|
112
|
+
// on. Device ID 5 will be used in auto configure mode.
|
|
113
|
+
//
|
|
114
|
+
// 2. Manually - In this case you will need to manually specify the network
|
|
115
|
+
// device and device ID.
|
|
116
|
+
//
|
|
117
|
+
// NOTES on the Device ID:
|
|
118
|
+
//
|
|
119
|
+
// It's recommended that you use a Device ID of `5` for the virtual device.
|
|
120
|
+
// Using a ID between 1 - 6 will take up ONE SLOT on the network that normally
|
|
121
|
+
// a CDJ would occupy. When a 1-6 ID is used You may ONLY HAVE 5 CDJs on the
|
|
122
|
+
// network. Attempting to connect a 6th CDJ will conflict with the virtual
|
|
123
|
+
// device announced on the network by alphatheta-connect. (On models older than
|
|
124
|
+
// 2000s the rande is 1-4.)
|
|
125
|
+
//
|
|
126
|
+
// There are some cases where you may want your virtual device to announce
|
|
127
|
+
// itself with "real" device ID, but this library does not currently support
|
|
128
|
+
// the scenarios that would requrie that (Becoming master and sending a master
|
|
129
|
+
// tempo)
|
|
130
|
+
|
|
131
|
+
// 1. AUTO CONFIGURATION
|
|
132
|
+
console.info('Auto configuring the network');
|
|
133
|
+
await network.autoconfigFromPeers();
|
|
134
|
+
|
|
135
|
+
// 2. MANUAL CONFIGURATION
|
|
136
|
+
//
|
|
137
|
+
// const configuredIface = getNetworkInterfaceInfoIPv4()
|
|
138
|
+
// network.configure({vcdjId: 2, iface: configuredIface})
|
|
139
|
+
|
|
140
|
+
// We can now connect to the network.
|
|
141
|
+
//
|
|
142
|
+
// This will begin announcing ourself on the network, as well as enable various
|
|
143
|
+
// services on the network service object.
|
|
144
|
+
console.info('Connecting to the network');
|
|
145
|
+
await network.connect();
|
|
146
|
+
|
|
147
|
+
// If you're using trypescript, you can now type guard [0] to coerce the type
|
|
148
|
+
// to ProlinkNetworkConnected, marking all services as non-null.
|
|
149
|
+
//
|
|
150
|
+
// [0]: https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates
|
|
151
|
+
//
|
|
152
|
+
// You don't need to do this if you're not using trypescript
|
|
153
|
+
if (!network.isConnected()) {
|
|
154
|
+
console.error('Failed to connect to the network');
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Thanks To
|
|
161
|
+
|
|
162
|
+
- [@evanpurkhiser](https://github.com/evanpurkhiser) - Original author of alphatheta-connect (formerly prolink-connect) and [Prolink Tools](https://prolink.tools/)
|
|
163
|
+
- [@brunchboy](https://github.com/brunchboy) - For his incredible work on [dysentery](https://github.com/brunchboy/dysentery) reverse engineering the Pro DJ Link protocol and [beat-link](https://github.com/Deep-Symmetry/beat-link) Java implementation
|
|
164
|
+
- [Deep Symmetry](https://github.com/Deep-Symmetry) - For [crate-digger](https://github.com/Deep-Symmetry/crate-digger) and maintaining comprehensive Pro DJ Link protocol documentation
|
|
165
|
+
- [@henrybetts](https://github.com/henrybetts) and [@flesniak](https://github.com/flesniak) - For reverse-engineering the rekordbox database format
|
|
166
|
+
- [@GreyCat](https://github.com/GreyCat) - For Kaitai Struct expertise and guidance
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NfsMediaSlot } from "../nfs";
|
|
2
|
+
import { Device } from "../types";
|
|
3
|
+
import { ExtractedArtwork, FileReader } from './types';
|
|
4
|
+
export { createBufferReader, createNfsFileReader, createNfsFileReaderWithInfo, } from './reader';
|
|
5
|
+
export type { ExtractedArtwork, FileReader } from './types';
|
|
6
|
+
export { PictureType } from './types';
|
|
7
|
+
export declare function isArtworkExtractionSupported(extension: string): boolean;
|
|
8
|
+
export declare function extractArtwork(reader: FileReader): Promise<ExtractedArtwork | null>;
|
|
9
|
+
export declare function extractArtworkFromDevice(device: Device, slot: NfsMediaSlot, filePath: string): Promise<ExtractedArtwork | null>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NfsMediaSlot } from "../nfs";
|
|
2
|
+
import { Device } from "../types";
|
|
3
|
+
import { FileReader } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Create a FileReader backed by NFS that reads from a device's media slot.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createNfsFileReader(device: Device, slot: NfsMediaSlot, path: string, fileSize: number): FileReader;
|
|
8
|
+
/**
|
|
9
|
+
* Create a FileReader backed by NFS, automatically fetching file size.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createNfsFileReaderWithInfo(device: Device, slot: NfsMediaSlot, path: string): Promise<FileReader>;
|
|
12
|
+
/**
|
|
13
|
+
* Create a FileReader from a Buffer (for testing).
|
|
14
|
+
*/
|
|
15
|
+
export declare function createBufferReader(buffer: Buffer, extension: string): FileReader;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracted artwork from an audio file
|
|
3
|
+
*/
|
|
4
|
+
export interface ExtractedArtwork {
|
|
5
|
+
data: Buffer;
|
|
6
|
+
mimeType: 'image/jpeg' | 'image/png' | 'image/gif';
|
|
7
|
+
width?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
pictureType?: PictureType;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Standard picture types from ID3v2 / FLAC specs
|
|
13
|
+
*/
|
|
14
|
+
export declare enum PictureType {
|
|
15
|
+
Other = 0,
|
|
16
|
+
FileIcon32x32 = 1,
|
|
17
|
+
OtherFileIcon = 2,
|
|
18
|
+
FrontCover = 3,
|
|
19
|
+
BackCover = 4,
|
|
20
|
+
LeafletPage = 5,
|
|
21
|
+
Media = 6,
|
|
22
|
+
LeadArtist = 7,
|
|
23
|
+
Artist = 8,
|
|
24
|
+
Conductor = 9,
|
|
25
|
+
Band = 10,
|
|
26
|
+
Composer = 11,
|
|
27
|
+
Lyricist = 12,
|
|
28
|
+
RecordingLocation = 13,
|
|
29
|
+
DuringRecording = 14,
|
|
30
|
+
DuringPerformance = 15,
|
|
31
|
+
MovieScreenCapture = 16,
|
|
32
|
+
BrightColoredFish = 17,
|
|
33
|
+
Illustration = 18,
|
|
34
|
+
BandLogotype = 19,
|
|
35
|
+
PublisherLogotype = 20
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Interface for reading file data at arbitrary offsets.
|
|
39
|
+
*/
|
|
40
|
+
export interface FileReader {
|
|
41
|
+
readonly size: number;
|
|
42
|
+
readonly extension: string;
|
|
43
|
+
read(offset: number, length: number): Promise<Buffer>;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|