evanpurkhiser/prolink-connect

GitHub: evanpurkhiser/prolink-connect

一个 TypeScript/JavaScript 库,实现了 Pioneer PRO DJ LINK 协议,可获取 CDJ 播放器状态和 Rekordbox 曲目元数据。

Stars: 91 | Forks: 17

prolink-connect

Pioneer 的 PRO DJ LINK 协议,已解锁。
获取 CDJ 状态 + 检索完整的音轨元数据。

build npm

本库实现了 Pioneer PROLINK 网络协议以及用于与 prolink 网络交互的附加功能。本库被用作 [Prolink Tools](https://prolink.tools/) 的一部分。 Prolink 协议的替代实现:[Java](https://github.com/Deep-Symmetry/beat-link),[golang](https://github.com/evanpurkhiser/prolink-go)。 感谢 [@brunchboy](https://github.com/brunchboy) 在 [dysentery](https://github.com/brunchboy/dysentery) 上的工作。 ## 功能 - **使用 Typescript 编写** - 准确的类型定义使实现变得轻而易举。让你的 DJ 工具自动补全到极致。 - **CDJ 状态** - 接收网络上每个 CDJ 的播放器状态详情。状态报告为 [`CDJStatus.State`](https://connect.prolink.tools/modules/_src_status_types_.html)。 - **元数据库** - 访问连接的 Rekordbox 格式 USB / SD 设备中存储的当前正在播放(或未播放!)音轨的元数据,或通过 Rekordbox link 访问。 ## 库用法 ### 连接到网络 要与网络上的 Prolink 设备通信,您首先需要... 1. 启动网络 2. 配置要连接的网络 3. 连接到网络上的设备 ``` import {bringOnline} from 'prolink-connect'; async function main() { // Bring the prolink network online. // // This will begin listening for prolink devices on the network that send // regular announcement packets over UDP. // // This will FAIL if Rekordbox is running on the same computer, or a second // instance of the prolink-connect library is running on the same machine. console.info('Bringing the network online'); const network = await bringOnline(); // Once online we can listen for appearing on the network network.deviceManager.on('connected', device => console.log('New device on network:', device), ); // To configure the online network to be "connected" we must need to specify // what network device to use to announce ourselves as a "virtual" device // onto the network, and what ID we want to announce ourselves as. By // announcing ourselves this will cause other devices to send us more detailed // information. // // There are two ways to configure the network: // // 1. Automatically - You can ask prolink-connect to wait for a device to // appear on the network to determine what network interface devices exist // on. Device ID 5 will be used in auto configure mode. // // 2. Manually - In this case you will need to manually specify the network // device and device ID. // // NOTES on the Device ID: // // It's recommended that you use a Device ID of `5` for the virtual device. // Using a ID between 1 - 6 will take up ONE SLOT on the network that normally // a CDJ would occupy. When a 1-6 ID is used You may ONLY HAVE 5 CDJs on the // network. Attempting to connect a 6th CDJ will conflict with the virtual // device announced on the network by prolink-connect. (On models older than // 2000s the rande is 1-4.) // // There are some cases where you may want your virtual device to announce // itself with "real" device ID, but this library does not currently support // the scenarios that would requrie that (Becoming master and sending a master // tempo) // 1. AUTO CONFIGURATION console.info('Auto configuring the network'); await network.autoconfigFromPeers(); // 2. MANUAL CONFIGURATION // // const configuredIface = getNetworkInterfaceInfoIPv4() // network.configure({vcdjId: 2, iface: configuredIface}) // We can now connect to the network. // // This will begin announcing ourself on the network, as well as enable various // services on the network service object. console.info('Connecting to the network'); await network.connect(); // If you're using trypescript, you can now type guard [0] to coerce the type // to ProlinkNetworkConnected, marking all services as non-null. // // [0]: https://www.typescriptlang.org/docs/handbook/advanced-types.html#using-type-predicates // // You don't need to do this if you're not using trypescript if (!network.isConnected()) { console.error('Failed to connect to the network'); return; } } ```
标签:CDJ状态监控, CMS安全, DJ设备通信, GNU通用公共许可证, HTTP工具, JavaScript, MITM代理, Node.js, Pioneer DJ, PRO DJ LINK, prolink-connect, Rekordbox, Typescript, UDP通信, 内核驱动, 开源库, 插件系统, 搜索引擎爬虫, 数据可视化, 网络协议, 自动化攻击, 音乐元数据, 音频技术