pyrekordbox Documentation

repository·master·Indexed 19 days ago

https://github.com/dylanljones/pyrekordbox

An unofficial Python package for interacting with Pioneer Rekordbox DJ software data. It provides tools to interface with the encrypted SQLCipher master database (Rekordbox 6 and 7), import and export Rekordbox XML databases, parse user setting files, and access Device Library Plus databases for devices like OPUS-QUAD, OMNIS-DUO, and XDJ-AZ. The library also includes detailed specifications for the Rekordbox ANLZ analysis file format (.DAT, .EXT, .2EX), covering beat grids, cue lists, song structure, and waveform preview tags.

Tokens
26.9K
Snippets
73
Records
99
Agent score
63%

What's inside pyrekordbox

  1. Overview of Pyrekordbox capabilities

    master

    Pyrekordbox is a Python package designed to interact with the library and export data from Pioneer Rekordbox DJ Software. It allows developers to programmatically access and manipulate various Rekordbox data formats.

    Supported Data Formats:

    • Rekordbox master.db database
    • Rekordbox XML database
    • Analysis files (ANLZ)
    • My-Setting files
    • Device library plus

    Tested Rekordbox Versions:

    • 5.8.6
    • 6.7.7
    • 7.0.9
    WARNING

    This project is not affiliated with Pioneer Corp. or its related companies. Use at your own risk; maintainers are not liable for damages to your Rekordbox library.

  2. Understand the Rekordbox ANLZ analysis file format

    master

    Rekordbox analysis files use the .DAT, .EXT, and .2EX extensions. The format is structured as a file header followed by a series of tagged sections. Each section is identified by a unique four-character code, followed by its own header and content.

    File Header Structure

    • Format Identifier: The file begins with the four-character code PMAI.
    • len_header (Bytes 04-07): A four-byte value specifying the length of the file header in bytes (typically 1c bytes).
    • len_file (Bytes 08-0b): A four-byte value specifying the total length of the entire file in bytes.
  3. Understand the Rekordbox My-Setting file structure

    master

    Rekordbox My-Setting files (DEVSETTING.DAT, DJMMYSETTING.DAT, MYSETTING.DAT, MYSETTING2.DAT) use little-endian data types and consist of a header, a data body, and a footer.

    Header Structure (104 bytes total)

    • len_strings (1 byte): Combined size of string fields (typically 96).
    • Padding (3 bytes): Always zero.
    • brand (32 bytes): ASCII string identifying the brand.
    • software (32 bytes): ASCII string (always "rekordbox").
    • version (32 bytes): ASCII string describing the version.
    • len_data (4 bytes): Size of the data field in bytes.
    • Checksum (2 bytes): Calculated over the data field. Note: For DJMMYSETTING.DAT, the checksum is calculated over all preceding bytes (including length fields) using the CRC16 XMODEM algorithm.
    • Unknown (2 bytes): Always 0x00.
  4. Understand the Rekordbox 6 Database Format

    master

    Rekordbox 6 transitioned from a DeviceSQL database (.edb) to an SQLite3 database. This database is encrypted using SQLCipher4.

    Because the database is encrypted, it cannot be accessed or parsed without the encryption key. The key is believed to be universal across all databases and is not dependent on specific licenses or machines.

  5. What are Rekordbox ANLZ files?

    master

    Rekordbox stores track analysis information in specific files (e.g., ANLZ0000) with extensions like .DAT, .EXT, or .2EX. These files contain critical DJ metadata, including:

    • Waveforms
    • Beat grids (precise beat timing)
    • Time indices (for efficient seeking in variable bit-rate streams)
    • Memory cues and loop points
  6. Understand the Rekordbox Analysis File Tagged Section Structure

    master

    Rekordbox analysis files (.DAT, .EXT, .2EX) are composed of multiple tagged sections. Each section follows a consistent "envelope" structure that allows for easy navigation through the file even if the internal content of a specific tag is unknown.

    Every section begins with:

    1. fourcc: A four-character code identifying the specific structure and content.
    2. len_header: A four-byte value specifying the size of the section header.
    3. len_tag: A four-byte value specifying the total length of the entire tagged section (including the header).

    To find the start of the next tag, add len_tag to the current tag's starting address.

  7. Understand the structure of Playlists and Histories

    master

    In the Rekordbox 6 database, playlist-like objects (such as Playlists and Histories) follow a dual-table pattern:

    1. Metadata Table (djmd<NAME>): Contains information about the playlist or playlist folder itself (e.g., djmdPlaylist). Each entry has a unique ID.
    2. Membership Table (djmdSong<NAME>): Contains the actual tracks within those playlists (e.g., djmdSongPlaylist).

    To reconstruct a playlist, you must link the membership table to the metadata table using the <NAME>ID column, and then link the track to the main collection using the ContentID column which points to the djmdContent table.

  8. Access linked table relationships

    master

    Many tables in the Rekordbox database are linked via foreign keys. The ORM provides relationship attributes to access these linked objects directly. For example, a DjmdContent instance has an Artist attribute that links to the corresponding DjmdArtist entry.

    content = db.get_content(ID=0)
    artist = content.Artist
  9. Understanding the Rekordbox Device Library Plus format

    master

    The Device Library Plus is a library format exported to USB storage or SD cards for newer generation Pioneer DJ devices. As of 2025, this format is supported by the following devices:

    • OPUS-QUAD
    • OMNIS-DUO
    • XDJ-AZ

    Technically, the format is a SQLite database encrypted using the SQLCipher library. The encryption key is not license or machine dependent; all Device Libraries use the same key. The database schema is a subset of the main Rekordbox database (master.db), containing similar tables, columns, and data types.

  10. Understand how playlists and history are structured

    master

    Rekordbox separates the definition of a playlist/folder from the actual tracks contained within it.

    • djmdPlaylist: Stores the metadata for playlists, folders, and smart playlists.
      • Attribute 0: playlist, 1: folder, 4: smart playlist.
    • djmdSongPlaylist: A junction table that links tracks (ContentID) to playlists (PlaylistID).
    • djmdHistory: Stores history playlist metadata (folders or playlists).
    • djmdSongHistory: Links tracks (ContentID) to history entries (HistoryID).
    • djmdRelatedTracks: Stores related track lists. Uses djmdSongRelatedTracks to link tracks.
    • djmdSampler: Stores sampler lists. Uses djmdSongSampler to link samples.
  11. Understand the Rekordbox XML database structure

    master

    The Rekordbox XML format is a hierarchical structure used to represent a DJ's library. It consists of three main sections:

    1. DJ_PLAYLISTS: The root element containing the version.
    2. COLLECTION: A flat list of all TRACK elements. Each track contains metadata and file location information.
    3. PLAYLISTS: A nested structure of NODE elements representing folders and playlists. These nodes reference tracks from the COLLECTION using a Key (usually the TrackID).

    Important: To ensure Rekordbox can successfully save playlists and information, all rows from the second row onwards must strictly follow the supported Rekordbox XML format.

    <?xml version="1.0" encoding="UTF-8" ?>
    
    <DJ_PLAYLISTS Version="1.0.0">
            <PRODUCT Name="rekordbox" Version="5.4.3" Company="Pioneer DJ"/>
            <COLLECTION Entries="1234">
                    <TRACK TrackID="1" Name="NOISE" Location="file://localhost/C:/Users/user/Music/track.wav" ... />
                    <TRACK TrackID="2" Name="SINEWAVE" Location="file://localhost/C:/Users/user/Music/sine.wav" ... />
            </COLLECTION>
            <PLAYLISTS>
                    <NODE Type="0" Name="ROOT" Count="1">
                            <NODE Name="Favourites" Type="1" KeyType="0" Entries="2">
                                    <TRACK Key="1"/>
                                    <TRACK Key="2"/>
                            </NODE>
                    </NODE>
            </PLAYLISTS>
    </DJ_PLAYLISTS>