Package: pyrekordbox
Disclaimer: This project isnotaffiliated with Pioneer Corp. or its related companies
in any way and has been written independently! Pyrekordbox is licensed under theMIT license. The maintainers of the project are not liable for any damages to your Rekordbox library.Pyrekordbox is a Python package for interacting with the library and export data of
Pioneers Rekordbox DJ Software. It currently supportsRekordbox v6 master.db databaseRekordbox XML databaseAnalysis files (ANLZ)My-Setting filesTested Rekordbox versions:5.8.6 | 6.5.3 | 6.7.7⚠️This project is still under development and might contain bugs or have breaking API changes in the future. Check thechangelogfor recent changes!🔧 InstallationPyrekordbox is available onPyPI:pip install pyrekordboxAlternatively, it can be installed viaGitHubpip install git+https://github.com/dylanljones/pyrekordbox.git@VERSIONwhereVERSIONis a release, tag or branch name.DependenciesUnlocking the new Rekordbox 6master.dbdatabase file requiresSQLCipher.
Pyrekordbox makes no attempt to download/install SQLCipher, as it is a
pure Python package - whereas the SQLCipher/sqlcipher3 installation is
platform-dependent and can not be installed viapip.WindowsSQLCipher can be used by building the libary against an amalgamation withsqlcipher3.
For a detailed instruction, see theinstallation guide.MacOSFor MacOS follow these steps:InstallHomebrewif you do not have it on your machine.Install SQLCipher withbrew install SQLCipher.With the python environment you are using to run pyrekordbox active execute the following:gitclonehttps://github.com/coleifer/sqlcipher3cdsqlcipher3SQLCIPHER_PATH=$(brewinfosqlcipher|awk'NR==4 {print $1; exit}');C_INCLUDE_PATH="$SQLCIPHER_PATH"/includeLIBRARY_PATH="$SQLCIPHER_PATH"/libpythonsetup.pybuildSQLCIPHER_PATH=$(brewinfosqlcipher|awk'NR==4 {print $1; exit}');C_INCLUDE_PATH="$SQLCIPHER_PATH"/includeLIBRARY_PATH="$SQLCIPHER_PATH"/libpythonsetup.pyinstallMake sure theC_INCLUDEandLIBRARY_PATHpoint to the installed SQLCipher path. It may differ on your machine.
If you are having issues installingsqlcipher3on M1 Macs please refer to theinstallation guide.🚀 Quick-StartRead the full documentation on ReadTheDocs!❗Please make sure to back up your Rekordbox collection before making changes with pyrekordbox or developing/testing new features. The backup dialog can be found under "File" > "Library" > "Backup Library"ConfigurationPyrekordbox looks for installed Rekordbox versions and sets up the configuration
automatically. The configuration can be checked by calling:frompyrekordboximportshow_configshow_config()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)frompyrekordbox.configimportupdate_configupdate_config("<pioneer_install_dir>","<pioneer_app_dir>")Alternatively the two paths can be specified in a configuration file under the sectionrekordbox. Supported configuration files are pyproject.toml, setup.cfg, pyrekordbox.toml,
pyrekordbox.cfg and pyrekordbox.yaml.Rekordbox 6 databaseRekordbox 6 now uses a SQLite database for storing the collection content.
Unfortunatly, the newmaster.dbSQLite database is encrypted usingSQLCipher, which means it can't be used without the encryption key.
However, since your data is stored and used locally, the key must be present on the
machine running Rekordbox.Pyrekordbox can unlock the new Rekordboxmaster.dbSQLite database and provides
an easy interface for accessing the data stored in it:frompyrekordboximportRekordbox6Databasedb=Rekordbox6Database()forcontentindb.get_content():print(content.Title,content.Artist.Name)playlist=db.get_playlist()[0]forsonginplaylist.Songs:content=song.Contentprint(content.Title,content.Artist.Name)Fields in the Rekordbox database that are stored without linking to other tables
can be changed via the corresponding property of the object:content=db.get_content()[0]content.Title="New Title"Some fields are stored as references to other tables, for example the artist of a track.
Check thedocumentationof the corresponding object for more information.
So far only a few tables support adding or deleting entries:DjmdPlaylist: Playlists/Playlist FoldersDjmdSongPlaylist: Songs in a playlistDjmdAlbum: AlbumsDjmdArtist: ArtistsDjmdGenre: GenresDjmdLabel: LabelsIf the automatic key extraction fails the command line interface ofpyrekordboxprovides a command for downloading the key from known sources and writing it to the
cache file:python-mpyrekordboxdownload-keyOnce the key is cached the database can be opened without providing the key.
The key can also be provided manually:db=Rekordbox6Database(key="<insert key here>")Rekordbox XMLThe 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.Pyrekordbox can read and write Rekordbox XML databases.frompyrekordbox.rbxmlimportRekordboxXmlxml=RekordboxXml("database.xml")track=xml.get_track(0)# Get track by index (or TrackID)track_id=track.TrackID# Access via attributename=track["Name"]# or dictionary syntaxpath="/path/to/file.mp3"track=xml.add_track(path)# Add new tracktrack["Name"]="Title"# Add attributes to new tracktrack["TrackID"]=10# Types are handled automatically# Get playlist (folder) by pathpl=xml.get_playlist("Folder","Sub Playlist")keys=pl.get_tracks()# Get keys of tracks in playlistktype=pl.key_type# Key can either be TrackID or Location# Add tracks and sub-playlists (folders)pl.add_track(track.TrackID)pl.add_playlist("Sub Sub Playlist")Rekordbox ANLZ filesRekordbox 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 likeANLZ0000and come with the extensions.DAT,.EXTor.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.frompyrekordbox.anlzimportAnlzFileanlz=AnlzFile.parse_file("ANLZ0000.DAT")beat_grid=anlz.get("beat_grid")path_tags=anlz.getall_tags("path")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.Unsupported ANLZ tags:PCOBPCO2PSSIPWV6PWV7PWVCRekordbox My-SettingsRekordbox stores the user settings in*SETTING.DATfiles, which get exported to USB
devices. These files are either in thePIONEERdirectory 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 My-Setting files.frompyrekordbox.mysettingsimportread_mysetting_filemysett=read_mysetting_file("MYSETTINGS.DAT")sync=mysett.get("sync")quant=mysett.get("quantize")TheDEVSETTING.DATfile is still not supported💡 File formatsA summary of the Rekordbox file formats can be found in thedocumentation:Rekordbox XML formatANLZ file formatMy-Setting file formatRekordbox 6 database💻 DevelopmentIf you encounter an issue or want to contribute to pyrekordbox, please feel free to get in touch,open an issueor create a new pull request! A guide for contributing topyrekordboxand the commit-message style can be found inCONTRIBUTING.For general questions or discussions about Rekordbox, please useGitHub Discussionsinstead of opening an issue.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.🔗 Related Projects and Referencescrate-digger: Java library for fetching and parsing rekordbox exports and track analysis files.rekordcrate: Library for parsing Pioneer Rekordbox device exportssupbox: Get the currently playing track from Rekordbox v6 as Audio Hijack Shoutcast/Icecast metadata, display in your OBS video broadcast or export as JSON.Deep Symmetry has an extensive analysis of Rekordbox's ANLZ and .edb export file formatshttps://djl-analysis.deepsymmetry.org/djl-analysisrekordcrate reverse engineered the format of the Rekordbox MySetting fileshttps://holzhaus.github.io/rekordcrate/rekordcrate/setting/index.htmlrekordcloud went into detail about the internals of Rekordbox 6https://rekord.cloud/blog/technical-inspection-of-rekordbox-6-and-its-new-internals.supbox has a nice implementation on finding the Rekordbox 6 database keyhttps://github.com/gabek/supbox