Skip to main content

Inofficial Python package for interacting with the library, analysis and export data of Pioneer's Rekordbox DJ software.

Project description

pyrekordbox

Tests python platform license: MIT style: black

PyRekordbox is a Python package for interacting with the library and export data of Pioneer's Rekordbox DJ Software. It currently supports Rekordbox analysis files, MySetting files, XML databases and the main Rekordbox 6 database.

Note: This project is not affiliated with Pioneer Corp. or its related companies in any way and has been written independently!

  1. Installation
  2. Usage
  3. File formats
  4. Contributing
  5. Related Projects
  6. Thank Yous
⚠️ This project is still under heavy development and might contain bugs or have breaking API changes in the future.

Installation

pyrekordbox can be installed via GitHub

pip install git+https://github.com/dylanljones/pyrekordbox.git@VERSION

where VERSION is a release, tag or branch name. The project can also be cloned/forked and installed via

python setup.py install

Some features need additional dependencies (see the Rekordbox 6 database section).

Usage

Read the documentation on ReadTheDocs!

Configuration

pyrekordbox looks for installed Rekordbox versions and sets up the configuration automatically. The configuration can be checked by calling:

from pyrekordbox import show_config

show_config()

which, for example, will print

Pioneer:
   app_dir =      C:\Users\user\AppData\Roaming\Pioneer
   install_dir =  C:\Program Files\Pioneer
Rekordbox 5:
   app_dir =      C:\Users\user\AppData\Roaming\Pioneer\rekordbox
   db_dir =       C:\Users\user\AppData\Roaming\Pioneer\rekordbox
   db_path =      C:\Users\user\AppData\Roaming\Pioneer\rekordbox\datafile.edb
   install_dir =  C:\Program Files\Pioneer\rekordbox 5.8.6
   version =      5.8.6

If for some reason the configuration fails the values can be updated by providing the paths to the directory where Pioneer applications are installed (pioneer_install_dir) and to the directory where Pioneer stores the application data (pioneer_app_dir)

from pyrekordbox.config import update_config

update_config(pioneer_install_dir, pioneer_app_dir)

Alternatively the two paths can be specified in a configuration file under the section rekordbox. Supported configuration files are pyproject.toml, setup.cfg, rekordbox.toml, rekordbox.cfg and rekordbox.yml.

Rekordbox XML

The Rekordbox XML database is used for importing (and exporting) Rekordbox collections including track metadata and playlists. They can also be used to share playlists between two databases. Exporting XML databases was removed in Rekordbox 6.

pyrekordbox can read and write Rekordbox XML databases.

from pyrekordbox.xml import RekordboxXml

xml = RekordboxXml("database.xml")
track = xml.get_track(0)

Rekordbox ANLZ files

Rekordbox stores analysis information of the tracks in the collection in specific files, which also get exported to decives used by Pioneer professional DJ equipment. The files have names like ANLZ0000 and come with the extensions .DAT, .EXT or .2EX. They include waveforms, beat grids (information about the precise time at which each beat occurs), time indices to allow efficient seeking to specific positions inside variable bit-rate audio streams, and lists of memory cues and loop points.

pyrekordbox can parse all three analysis files, although not all the information of the tracks can be extracted yet.

from pyrekordbox.anlz import AnlzFile

anlz = AnlzFile.parse_file("ANLZ0000.DAT")
beat_grid = anlz.getone("beat_grid")

Changing and creating the Rekordbox analysis files is planned as well, but for that the full structure of the analysis files has to be understood.

Rekordbox MySettings

Rekordbox stores the user settings in *SETTING.DAT files, which get exported to USB devices. These files are either in the PIONEERdirectory of a USB drive (device exports), but are also present for on local installations of Rekordbox 6. The setting files store the settings found on the "DJ System" > "My Settings" page of the Rekordbox preferences. These include language, LCD brightness, tempo fader range, crossfader curve and other settings for Pioneer professional DJ equipment.

pyrekordbox supports both parsing and writing MySetting files.

from pyrekordbox.mysettings import read_mysetting_file

mysett = read_mysetting_file("MYSETTINGS.DAT")
sync = mysett.get("sync")
quant = mysett.get("quantize")

Rekordbox 6 database

Rekordbox 6 now uses a SQLite database for storing the collection content. The old DeviceSQL of Rekordbox 5 was probably too old for Pioneer to keep using adequately, especially with the Rekordbox Agent. Unfortunatly, the new master.db SQLite database is encrypted using SQLCipher, which means it can't be used without the encryption key. Pioneer did this because they prefer that no one outside of Pioneer touches it. However, since your data is stored and used locally, the key must be present on the machine running Rekordbox.

pyrekordbox can unlock the new Rekordbox master.db SQLite database and provides an easy interface for accessing the data stored in it:

from pyrekordbox import Rekordbox6Database

db = Rekordbox6Database()
track_items = db.get_content()
cid = track_items[0]["ID"]
artist = db.get_artist_name(content_id=cid)

Changing entries of the database is not supported yet since it is not guaranteed that the database could be corrupted from writing to it. However, this feature will by added after some testing.

Dependencies

Unlocking the new Rekordbox 6 master.db database file requires SQLCipher.

So far I did not find a reliable dependency for using SQLCipher with Python on Windows. For now, SQLCipher can be used with the included DLL's by replacing the Python SQLite DLL's:

  1. rename sqlcipher.dll to sqlite3.dll and replace the existing file in the Python DLLs folder with it
  2. copy libcrypto-1_1.dll into the Python DLLs folder (optional, should work without)
  3. copy libssl-1_1.dll into the Python DLLs folder (optional, should work without)

After that SQLCipher-databases can be unlocked via the normal sqlite3 package by providing the key via the PRAGMA key='db-key' SQL statement.

The included DLL's only work with Python 3.8! For other platforms and Python versions (specificly the version of the included SQLite3 libary) the DLL's have to be built from source.

On macOS there is the pysqlcipher3 package, which simplifies the installation. This will be implemented in a future version.

File formats

A summary of the Rekordbox file formats can be cound in the documentation:

Contributing

If you encounter an issue or want to contribute to pyrekordbox, please feel free to get in touch, open an issue or open a pull request!

pyrekordbox is tested on Windows and MacOS, however some features can't be tested in the CI setup since it requires a working Rekordbox installation. The auto-configuration (discovering Rekordbox file locations) is tested on Windows, but help would be appreciated on MacOS.

To Do

  • Complete ANLZ file support
    • PCOB
    • PCO2
    • PSSI
    • PWV6
    • PWV7
    • PWVC
  • ANLZ tests
  • Improve Rekordbox 6 master.db database parsing
  • Rekordbox 6 master.db database tests
  • Add Rekordbox 5 .edb database suppport
  • Add USB export database support (.pdb)
  • Add MySettings support
  • MySetting tests

Related Projects

  • crate-digger: Java library for fetching and parsing rekordbox exports and track analysis files.
  • rekordcrate: Library for parsing Pioneer Rekordbox device exports
  • supbox: Get the currently playing track from Rekordbox v6 as Audio Hijack Shoutcast/Icecast metadata, display in your OBS video broadcast or export as JSON.

Thank Yous

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrekordbox-0.0.0.tar.gz (4.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrekordbox-0.0.0-py2.py3-none-any.whl (35.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyrekordbox-0.0.0.tar.gz.

File metadata

  • Download URL: pyrekordbox-0.0.0.tar.gz
  • Upload date:
  • Size: 4.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pyrekordbox-0.0.0.tar.gz
Algorithm Hash digest
SHA256 b9ed1956a24b9aefaa042c47d92842310305218de89c43dc87076eddb0e142a8
MD5 379d09804ad4f1c32bf9612abd338f5b
BLAKE2b-256 600b2dfecadbf274ff8b50e3242b6926654e1fa5fde76769544dac5ca0c3f581

See more details on using hashes here.

File details

Details for the file pyrekordbox-0.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pyrekordbox-0.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for pyrekordbox-0.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9a821ad46e52afcfb4438e714f0222dc098f9b815de494bc770177fd944c8179
MD5 a2962bd36c4aaf1c7712a39e503251b3
BLAKE2b-256 70289f197ddfeb0958e3342091ec6ef7aebc18de49c146d2551d91aa8f14ad88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page