Giter Site home page Giter Site logo

rekordbox-parser's Introduction

rekordbox-parser

Build Status NPM

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.

rekordbox-parser's People

Contributors

evanpurkhiser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.