rbox-js
Version:
Javascript library for interacting with the local and export data of Pioneers Rekordbox DJ software
377 lines (367 loc) • 13 kB
JavaScript
/* tslint:disable */
/* eslint-disable */
/* prettier-ignore */
/* auto-generated by NAPI-RS */
const { existsSync, readFileSync } = require('fs')
const { join } = require('path')
const { platform, arch } = process
let nativeBinding = null
let localFileExisted = false
let loadError = null
function isMusl() {
// For Node 10
if (!process.report || typeof process.report.getReport !== 'function') {
try {
const lddPath = require('child_process').execSync('which ldd').toString().trim()
return readFileSync(lddPath, 'utf8').includes('musl')
} catch (e) {
return true
}
} else {
const { glibcVersionRuntime } = process.report.getReport().header
return !glibcVersionRuntime
}
}
switch (platform) {
case 'android':
switch (arch) {
case 'arm64':
localFileExisted = existsSync(join(__dirname, 'rbox-js.android-arm64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.android-arm64.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-android-arm64')
}
} catch (e) {
loadError = e
}
break
case 'arm':
localFileExisted = existsSync(join(__dirname, 'rbox-js.android-arm-eabi.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.android-arm-eabi.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-android-arm-eabi')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Android ${arch}`)
}
break
case 'win32':
switch (arch) {
case 'x64':
localFileExisted = existsSync(
join(__dirname, 'rbox-js.win32-x64-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.win32-x64-msvc.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-win32-x64-msvc')
}
} catch (e) {
loadError = e
}
break
case 'ia32':
localFileExisted = existsSync(
join(__dirname, 'rbox-js.win32-ia32-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.win32-ia32-msvc.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-win32-ia32-msvc')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'rbox-js.win32-arm64-msvc.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.win32-arm64-msvc.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-win32-arm64-msvc')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Windows: ${arch}`)
}
break
case 'darwin':
localFileExisted = existsSync(join(__dirname, 'rbox-js.darwin-universal.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.darwin-universal.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-darwin-universal')
}
break
} catch {}
switch (arch) {
case 'x64':
localFileExisted = existsSync(join(__dirname, 'rbox-js.darwin-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.darwin-x64.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-darwin-x64')
}
} catch (e) {
loadError = e
}
break
case 'arm64':
localFileExisted = existsSync(
join(__dirname, 'rbox-js.darwin-arm64.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.darwin-arm64.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-darwin-arm64')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on macOS: ${arch}`)
}
break
case 'freebsd':
if (arch !== 'x64') {
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
}
localFileExisted = existsSync(join(__dirname, 'rbox-js.freebsd-x64.node'))
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.freebsd-x64.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-freebsd-x64')
}
} catch (e) {
loadError = e
}
break
case 'linux':
switch (arch) {
case 'x64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-x64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-x64-musl.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-x64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-x64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-x64-gnu.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-x64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-arm64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-arm64-musl.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-arm64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-arm64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-arm64-gnu.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-arm64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 'arm':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-arm-musleabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-arm-musleabihf.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-arm-musleabihf')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-arm-gnueabihf.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-arm-gnueabihf.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-arm-gnueabihf')
}
} catch (e) {
loadError = e
}
}
break
case 'riscv64':
if (isMusl()) {
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-riscv64-musl.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-riscv64-musl.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-riscv64-musl')
}
} catch (e) {
loadError = e
}
} else {
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-riscv64-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-riscv64-gnu.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-riscv64-gnu')
}
} catch (e) {
loadError = e
}
}
break
case 's390x':
localFileExisted = existsSync(
join(__dirname, 'rbox-js.linux-s390x-gnu.node')
)
try {
if (localFileExisted) {
nativeBinding = require('./rbox-js.linux-s390x-gnu.node')
} else {
nativeBinding = require('@dylanljones/rbox-js-linux-s390x-gnu')
}
} catch (e) {
loadError = e
}
break
default:
throw new Error(`Unsupported architecture on Linux: ${arch}`)
}
break
default:
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
}
if (!nativeBinding) {
if (loadError) {
throw loadError
}
throw new Error(`Failed to load native binding`)
}
const { CueType, CueListType, CueStatus, Mood, Bank, Anlz, MasterDb, RekordboxOptions, OnAirDisplay, LCDBrightness, Quantize, AutoCueLevel, Language, JogRingBrightness, JogRingIndicator, SlipFlashing, DiscSlotIllumination, EjectLock, Sync, PlayMode, QuantizeBeatValue, HotCueAutoLoad, HotCueColor, NeedleLock, TimeMode, JogMode, AutoCue, MasterTempo, TempoRange, PhaseMeter, VinylSpeedAdjust, JogDisplayMode, PadButtonBrightness, JogLCDBrightness, WaveformDivisions, Waveform, BeatJumpBeatValue, ChannelFaderCurve, CrossfaderCurve, HeadphonesPreEQ, HeadphonesMonoSplit, BeatFXQuantize, MicLowCut, TalkOverMode, TalkOverLevel, MidiChannel, MidiButtonType, MixerDisplayBrightness, MixerIndicatorBrightness, ChannelFaderCurveLongFader, OverviewWaveformType, WaveformColor, KeyDisplayFormat, WaveformCurrentPosition, Setting, getRekordboxAppDirPath, getRekordboxSharePath, getMasterDbPath, isRekordboxRunning, PlaylistNodeType, PlaylistKeyType, RekordboxXml } = nativeBinding
module.exports.CueType = CueType
module.exports.CueListType = CueListType
module.exports.CueStatus = CueStatus
module.exports.Mood = Mood
module.exports.Bank = Bank
module.exports.Anlz = Anlz
module.exports.MasterDb = MasterDb
module.exports.RekordboxOptions = RekordboxOptions
module.exports.OnAirDisplay = OnAirDisplay
module.exports.LCDBrightness = LCDBrightness
module.exports.Quantize = Quantize
module.exports.AutoCueLevel = AutoCueLevel
module.exports.Language = Language
module.exports.JogRingBrightness = JogRingBrightness
module.exports.JogRingIndicator = JogRingIndicator
module.exports.SlipFlashing = SlipFlashing
module.exports.DiscSlotIllumination = DiscSlotIllumination
module.exports.EjectLock = EjectLock
module.exports.Sync = Sync
module.exports.PlayMode = PlayMode
module.exports.QuantizeBeatValue = QuantizeBeatValue
module.exports.HotCueAutoLoad = HotCueAutoLoad
module.exports.HotCueColor = HotCueColor
module.exports.NeedleLock = NeedleLock
module.exports.TimeMode = TimeMode
module.exports.JogMode = JogMode
module.exports.AutoCue = AutoCue
module.exports.MasterTempo = MasterTempo
module.exports.TempoRange = TempoRange
module.exports.PhaseMeter = PhaseMeter
module.exports.VinylSpeedAdjust = VinylSpeedAdjust
module.exports.JogDisplayMode = JogDisplayMode
module.exports.PadButtonBrightness = PadButtonBrightness
module.exports.JogLCDBrightness = JogLCDBrightness
module.exports.WaveformDivisions = WaveformDivisions
module.exports.Waveform = Waveform
module.exports.BeatJumpBeatValue = BeatJumpBeatValue
module.exports.ChannelFaderCurve = ChannelFaderCurve
module.exports.CrossfaderCurve = CrossfaderCurve
module.exports.HeadphonesPreEQ = HeadphonesPreEQ
module.exports.HeadphonesMonoSplit = HeadphonesMonoSplit
module.exports.BeatFXQuantize = BeatFXQuantize
module.exports.MicLowCut = MicLowCut
module.exports.TalkOverMode = TalkOverMode
module.exports.TalkOverLevel = TalkOverLevel
module.exports.MidiChannel = MidiChannel
module.exports.MidiButtonType = MidiButtonType
module.exports.MixerDisplayBrightness = MixerDisplayBrightness
module.exports.MixerIndicatorBrightness = MixerIndicatorBrightness
module.exports.ChannelFaderCurveLongFader = ChannelFaderCurveLongFader
module.exports.OverviewWaveformType = OverviewWaveformType
module.exports.WaveformColor = WaveformColor
module.exports.KeyDisplayFormat = KeyDisplayFormat
module.exports.WaveformCurrentPosition = WaveformCurrentPosition
module.exports.Setting = Setting
module.exports.getRekordboxAppDirPath = getRekordboxAppDirPath
module.exports.getRekordboxSharePath = getRekordboxSharePath
module.exports.getMasterDbPath = getMasterDbPath
module.exports.isRekordboxRunning = isRekordboxRunning
module.exports.PlaylistNodeType = PlaylistNodeType
module.exports.PlaylistKeyType = PlaylistKeyType
module.exports.RekordboxXml = RekordboxXml