Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

rekordbox-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rekordbox-parser

[![Build Status](https://github.com/evanpurkhiser/rekordbox-parser/workflows/build/badge.svg)](https://github.com/evanpurkhiser/rekordbox-parser/actions?query=workflow%3Abuild) [![NPM Package](https://img.shields.io/npm/v/rekordbox-parser)](https://www.np

latest
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

rekordbox-parser

Build Status NPM Package

This is a JavaScript / Typescript library that provides a simple API for parsing Pioneer Rekordbox PDB and ANLZ files. This library is a wrapper around the Kaitai Struct files available in crate-digger, which describes the database format.

Thank you @brunchboy for making these files available!

Current crate-digger version: v0.1.6

Library usage

Parsing PDB files

import {parsePdb, RekordboxPdb, tableRows} from 'rekordbox-parser';
import fs from 'fs';

const {PageType} = RekordboxPdb;

// The object passed to parsePdb must be a Buffer
const pdbFile = await fs.promises.readFile('./export.pdb');
const db = parsePdb(pdbFile);

const tracksTable = db.tables.find(table => table.type === PageType.TRACKS);

// Iterate tables using the `tableRows` generator helper
for (const row of tableRows(tracksTable)) {
  console.log('==> Track ID', row.id);
  console.log(' -> ', row.title.body.text);
  console.log(' -> ', row.trackNumber);
  console.log(' -> ', row.discNumber);
  console.log(' -> ', row.duration);
  console.log(' -> ', row.sampleRate);
  console.log(' -> ', row.sampleDepth);
  console.log(' -> ', row.bitrate);
  console.log(' -> ', row.tempo / 100);
  console.log(' -> ', row.playCount);
  console.log(' -> ', row.year);
  console.log(' -> ', row.rating);
  console.log(' -> ', row.mixName.body.text);
  console.log(' -> ', row.comment.body.text);
  console.log(' -> ', row.autoloadHotcues.body.text === 'ON');
  console.log(' -> ', row.kuvoPublic.body.text === 'ON');
  console.log(' -> ', row.filePath.body.text);
  console.log(' -> ', row.filename.body.text);
  console.log(' -> ', row.fileSize);
  console.log(' -> ', row.releaseDate.body.text);
  console.log(' -> ', new Date(row.analyzeDate.body.text));
  console.log(' -> ', new Date(row.dateAdded.body.text));
  console.log('');
  console.log(' => Foreign keys');
  console.log(' -> ', row.artworkId || null);
  console.log(' -> ', row.artistId || null);
  console.log(' -> ', row.originalArtistId || null);
  console.log(' -> ', row.remixerId || null);
  console.log(' -> ', row.composerId || null);
  console.log(' -> ', row.albumId || null);
  console.log(' -> ', row.labelId || null);
  console.log(' -> ', row.genreId || null);
  console.log(' -> ', row.colorId || null);
  console.log(' -> ', row.keyId || null);
  console.log('');
}

Parsing ANLZ files

import {parseAnlz, RekordboxAnlz} from 'rekordbox-parser';
import fs from 'fs';

const {SectionTags} = RekordboxAnlz;

// The object passed to parsePdb must be a Buffer
const anlzFile = await fs.promises.readFile('./ANLZ0000.DAT');
const anlz = parseAnlz(anlzFile);

const beatGrid = anlz.sections.find(section => section.fourcc === SectionTags.BEAT_GRID);

console.log('==> Beat Grid');
console.log(beatGrid.body.beats);

const cues = anlz.sections.find(section => section.fourcc === SectionTags.CUES);

console.log('==> Cues');
console.log(cues.body.cues);

// NOTE: The are additional SectionTags that are not documented here

Limitations

  • The DeviceSQL file format that Pioneer uses is still not fully understood. Some data may be missing.

  • The Typescript types are completely lacking for the result. When Katai Struct gains support for Typescript the result will be much better.

Keywords

CDJ

FAQs

Package last updated on 30 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts