- Zig 56.9%
- Rust 36.4%
- JavaScript 2.1%
- C 1.7%
- Swift 1.6%
- Other 1.3%
Record the older Pi 5 worktree line as integrated after cherry-picking its current appliance scaffold onto main, without replaying the superseded earlier tree state. |
||
|---|---|---|
| deps/zig-xml | ||
| docs | ||
| ghidra | ||
| nixos/pi5-cdj | ||
| rekordcrate | ||
| scripts | ||
| src | ||
| .gitignore | ||
| auth_manager.jsc | ||
| build.zig | ||
| build.zig.zon | ||
| flake.lock | ||
| flake.nix | ||
| login.jsc | ||
| README.md | ||
rekordzig
rekordzig is a Zig rewrite scaffold for Holzhaus/rekordcrate rooted in a Nix flake and verified against the upstream binary fixture corpus.
Current coverage:
- Full
*SETTING.DATparsing and byte-for-byte roundtrip verification across upstream fixtures. - High-level typed write APIs for settings bundles, Rekordbox XML documents, and export-tree layout emission.
- PDB header/table/page-chain scanning with known row-count assertions from the upstream
num_rowsfixture. - Typed plain-PDB data-page decoding for
tracks,artists,albums,colors,keys,columns,playlist_tree,playlist_entries,genres,labels,artwork,history_*,history,menu, andmenu_column_mappings, with fixture-backed assertions and row dumps from realexport.pdbpages. - Typed
exportExt.pdbdecoding fortag,track_tag, and the singletondb_property_optionrow, including structural decoding of aDBPropertyOption/drive-info-shapedu32key plus five string slots. - Full USB export tree ingestion for upstream
complete_exportdumps, including byte-for-byte fixture roundtrip of completePIONEER/trees. - Typed
USBANLZ/ANLZ*.DAT,.EXT, and.2EXsection framing with byte-for-byte roundtrip verification and per-section summaries. - Decrypted
PSSIsong-structure phrase decoding with human-readable labels and a CLI for inspecting real phrase streams from dumps. - iPod-oriented storage scaffolding with a raw block-device layer, mounted-volume detection for
iPod_ControlandiTunes_Control, safeiTunesDBextraction and rewrite commands, and libgpod-backed library read/write plus stable-ID-preserving incremental sync on mounted volumes. - SQLite-backed superlibrary import with a content-addressed local-fs blob store, normalized iTunes/Music snapshot ingestion, and idempotent source-library upserts for exported XML and native macOS Music libraries.
- Configurable Bandcamp sales-report import that normalizes official Bandcamp API responses into the same SQLite/blob superlibrary, with optional local media mapping for seller-owned downloads.
- A Zig-first AirPlay legacy sender stack ported from
node_airtunes2concepts: PCM ring buffering, 352-frame pacing, RTP packet framing, ALAC packetization, legacy AES payload encryption, shared UDP timing/control/audio sockets, and legacy RTSPOPTIONS -> ANNOUNCE -> SETUP -> RECORDnegotiation with digest auth. - Native AirPlay discovery and AP2 groundwork: best-effort mDNS browse for
_raop._tcpand_airplay._tcp, TXT/feature/status parsing, HomeKit TLV codecs, HAP SRP pair-setup, stored-credential pair-verify, encrypted control-channel framing, typed AP2 binary-plist builders/parsers, and a live transient AP2 setup probe that completesSETUP_AP2_1 -> SETPEERS -> SETUP_AP2_2against real targets. - LG webOS TV discovery and DMR probe groundwork: local SSDP scanning for likely webOS and DMR targets, plus a live AVTransport URL-launch probe for DLNA-style local playback handoff to real TVs, including DLNA-aware
protocolInfoadvertising for picky renderers. - Secure LG webOS remote-control groundwork: prompt-based pairing over the native
wss://<tv>:3001SSAP channel, persisted client keys, pointer-input commands, and best-effort screenshot capture through the TV's local control surface. - Samsung Tizen TV groundwork: native Zig device-info probes over
/api/v2/, secure token-based pairing onwss://<tv>:8002/api/v2/channels/samsung.remote.control, basic remote-key input, installed-app listing, and app launch scaffolding for local control of Frame-class sets. - Rclone-backed superlibrary snapshot/push/pull commands that publish SQLite plus blobs to a remote root, consume a manifest on pull, and verify DB hashes on restore.
- A headless Ghidra harness for deeper Rekordbox reverse engineering when format coverage needs to expand.
- An installed-Rekordbox verification harness that launches
rekordboxAgentin an isolated temp root and probes its SQLite/API bootstrap behavior. - A live-Rekordbox verifier that attaches to the running
rekordboxAgent, derives the active local API token through the Node inspector, and proves authenticated/api/v1/agent/*requests outside-in without printing the token.
Nix-first workflow
The root flake uses mitchellh/zig-overlay and selects packages.master, so the project always builds with the latest Zig master pinned in flake.lock.
Commands:
nix develop
zig build test
zig build verify
nix flake check
Useful CLI entrypoints:
zig build run -- dump-setting rekordcrate/data/complete_export/empty/PIONEER/MYSETTING.DAT
zig build run -- dump-pdb-summary rekordcrate/data/pdb/num_rows/export.pdb
zig build run -- dump-pdb-page rekordcrate/data/pdb/unit_tests/colors_page.bin
zig build run -- dump-pdb-page rekordcrate/data/pdb/num_rows/export.pdb 14
zig build run -- dump-pdb-page rekordcrate/data/pdb/num_rows/export.pdb 40
zig build run -- dump-pdb-page rekordcrate/data/complete_export/demo_tracks/PIONEER/rekordbox/exportExt.pdb 16
zig build run -- dump-anlz-summary rekordcrate/data/complete_export/demo_tracks/PIONEER/USBANLZ/P016/0000875E/ANLZ0000.DAT
zig build run -- dump-anlz-phrases rekordcrate/data/complete_export/demo_tracks/PIONEER/USBANLZ/P016/0000875E/ANLZ0000.EXT
zig build run -- write-empty-export /tmp/rekordbox-export
zig build run -- analyze-usb-export rekordcrate/data/complete_export/demo_tracks
zig build run -- rewrite-usb-export rekordcrate/data/complete_export/demo_tracks /tmp/demo-tracks-roundtrip
zig build run -- analyze-ipod-volume /Volumes/IPOD
zig build run -- read-ipod-db /Volumes/IPOD /tmp/iTunesDB
zig build run -- write-ipod-db /Volumes/IPOD /tmp/iTunesDB
zig build run -- read-ipod-library /Volumes/IPOD /tmp/ipod-library.json
zig build run -- write-ipod-library /Volumes/IPOD /tmp/ipod-library.json [MODEL]
zig build run -- sync-ipod-library /Volumes/IPOD /tmp/ipod-library.json [MODEL]
zig build run -- write-itunes-native-snapshot /tmp/native-itunes.json [SOURCE_ID]
zig build run -- write-itunes-xml-snapshot /path/to/iTunes Music Library.xml /tmp/itunes.xml.json [SOURCE_ID]
zig build run -- import-itunes-snapshot /tmp/library.sqlite /tmp/blobs /tmp/itunes.xml.json
zig build run -- import-itunes-native /tmp/library.sqlite /tmp/blobs [SOURCE_ID]
zig build run -- import-itunes-xml /tmp/library.sqlite /tmp/blobs /path/to/iTunes Music Library.xml [SOURCE_ID]
zig build run -- write-bandcamp-snapshot /tmp/bandcamp-config.json /tmp/bandcamp.json
zig build run -- import-bandcamp /tmp/library.sqlite /tmp/blobs /tmp/bandcamp-config.json
zig build run -- scan-airplay [timeout_ms]
zig build run -- scan-lg-tv [timeout_ms]
zig build run -- probe-lg-tv-url <host> <url> [stop_after_seconds]
zig build run -- stop-lg-tv <host>
zig build run -- pair-lg-tv <host>
zig build run -- press-lg-tv-button <host> <button>
zig build run -- click-lg-tv-pointer <host>
zig build run -- move-lg-tv-pointer <host> <dx> <dy> [down]
zig build run -- screenshot-lg-tv <host> <output_path>
zig build run -- probe-samsung-tv <host>
zig build run -- pair-samsung-tv <host>
zig build run -- press-samsung-tv-button <host> <button>
zig build run -- list-samsung-tv-apps <host>
zig build run -- launch-samsung-tv-app <host> <app_id> [app_type] [meta_tag]
zig build run -- probe-airplay-pair-setup <host> [port]
zig build run -- probe-airplay-ap2 <host> [port]
zig build run -- dump-superlibrary-summary /tmp/library.sqlite
zig build run -- export-superlibrary-snapshot /tmp/library.sqlite /tmp/library.snapshot.sqlite
zig build run -- push-superlibrary /tmp/library.sqlite /tmp/blobs /tmp/remote-store
zig build run -- pull-superlibrary /tmp/restored.sqlite /tmp/restored-blobs /tmp/remote-store
zig build run -- clone-block-device /dev/disk4 /tmp/ipod.img
zig build run -- verify-settings
zig build run -- verify-pdb
zig build run -- verify-anlz
zig build run -- verify-usb-exports
zig build run -- verify-rekordbox-agent
zig build verify-rekordbox-live-agent-auth
scripts/inspect-rekordbox-agent-models.sh
scripts/inspect-rekordbox-native-property-strings.sh
scripts/run-ghidra-headless.sh --noanalysis '/Applications/rekordbox 7/rekordbox.app/Contents/MacOS/rekordbox'
scripts/run-ghidra-headless.sh '/Applications/rekordbox 7/rekordbox.app/Contents/MacOS/rekordbox'
node scripts/inspect-rekordbox-live-property.js
Public API entrypoints currently exposed from src/root.zig:
rekordzig.setting: low-level setting parse/write plussetting.Bundlefor emitting a fullPIONEER/*SETTING.DATsetrekordzig.anlz: typed ANLZ reader/writer with section summaries, cue and song-structure decoding, phrase labels, and byte-for-byte roundtrip verificationrekordzig.airplay: Zig-first AirPlay sender core with PCM buffering, RTP/ALAC/AES packetization, resend history, and shared UDP timing/control/audio socket helpersrekordzig.airplay_ap2: typed AP2 RTSP request builders plus binary-plist request/response codecs forSETUP_AP2_1,SETPEERS, andSETUP_AP2_2rekordzig.airplay_ap2_session: transient AP2 runtime handshake that drives encryptedSETUP_AP2_1 -> SETPEERS -> SETUP_AP2_2and reports the negotiated ports and control keysrekordzig.airplay_homekit: HomeKit TLV, HAP SRP pair-setup, stored-credential pair-verify flow, and encrypted control-channel framing for AP2-class sessionsrekordzig.airplay_mdns: native mDNS query/response parsing plus best-effort_raop._tcp/_airplay._tcpdiscovery and capability extractionrekordzig.airplay_probe: hardware-facing transient pair-setup probe for validating AP2 HomeKit handshakes against real AirPlay targetsrekordzig.airplay_rtsp: legacy RAOP/AirPlay 1 RTSP client andPlaybackSessionwrapper for digest-auth negotiation plus shared-socket sender startup; AirPlay 2 pairing still sits above this layerrekordzig.airplay_srp: native HAP SRP client/server math used by HomeKit pair-setuprekordzig.bplist: minimal binary-plist encoder/decoder for AP2 control payloadsrekordzig.pdb: PDB header/page-chain scanner plus typedexport.pdbrow decoding, typedhistorysync-record decoding, typedexportExt.pdbtag/track_tag/db_property_optionrows, and raw/index inspection APIs for unsupported page kindsrekordzig.pdb_rows: low-level DeviceSQL and row-payload codecs for plain PDB table rowsrekordzig.rekordbox_xml: typed Rekordbox XML writer built onianprime0509/zig-xmlrekordzig.device:DeviceExportwriter for materializing export trees with settings,database.xml, and arbitrary extra assetsrekordzig.usb_export: full export-tree reader/writer forPIONEER/dumps, parsing settings and ANLZ files while preserving whole-tree byte identityrekordzig.ipod: direct iPod storage scaffolding split intoblock_devicefor whole-image cloning,volumefor mountediTunesDBandSysInfoaccess, andlibraryfor libgpod-backed library import/export on mounted iPodsrekordzig.library: target-neutral collection model for syncing one logical library into CDJ USB, iPod, and later targetsrekordzig.library_rekordbox: adapter from the canonical library model intorekordbox_xml.Documentrekordzig.lg_tv: SSDP-based LG TV discovery plus DMR/AVTransport URL-launch helpers for first local playback/control probesrekordzig.lg_tv_remote: secure webOS SSAP pairing, persisted client-key handling, pointer/button remote commands, and best-effort screenshot capturerekordzig.samsung_tv: secure Tizen token pairing, remote-key commands, installed-app enumeration, and app-launch helpers backed by the native/api/v2/andsamsung.remote.controlsurfacesrekordzig.superlibrary_db: SQLite-backed superlibrary ingest and blob-store maintenance for normalized source snapshotsrekordzig.superlibrary_sync: safe SQLite snapshot export plus rclone-backed push/pull for the canonical SQLite/blob storerekordzig.sync_state: per-target export ID, path, and hash mappings layered beside the canonical library modelrekordzig.rekordbox_agent: installed-app harness for launching an isolatedrekordboxAgent, validating SQLite bootstrap, and probing unauthenticated/api/v1/agent/*endpoints
Live installed-app verification:
node scripts/verify-rekordbox-live-agent.js
node scripts/inspect-rekordbox-live-property.js
This requires Rekordbox to be running. The verifier:
- finds the live
rekordboxAgentprocess and enables the Node inspector withSIGUSR1 - reads the in-memory local API token without printing it
- replays authenticated
GET /api/v1/agent/modeandGET /api/v1/agent/sharedPlaylists/moderequests against the live localhost agent - reports only safe metadata such as token presence/length and HTTP status codes
The live property inspector goes deeper:
- proves the bundled
djmdProperty/djmdDevicemodel shape against the live SQLCipher-backed tables - dumps sampled
djmdProperty/djmdDevicerows without exposing the bearer token - records the current
/api/v1/data/djmdPropertiesprobe result, which on this Rekordbox7.2.12.0344install currently fails because the route expectsdjmdProperty.rb_local_deletedeven though the live table does not have that column
Reverse-engineering workflow notes live in docs/REKORDBOX_RE.md.
iPod-specific notes live in docs/IPOD_USB.md.
AirPlay-specific notes live in docs/AIRPLAY_SENDER.md.
read-ipod-library, write-ipod-library, and sync-ipod-library now preserve iPod voice memos as tracks with kind: "voice_memo" and an ipod_path under /Recordings/..., so a memo recorded on-device can be dumped to JSON and written back onto another mounted iPod volume without being collapsed into Music/Fnn.
Mounted-volume iPod sync now also carries a sidecar at iPod_Control/iTunes/rekordzig-sync-state.json. That state pins canonical stable_id -> ipod_path -> media_sha256_hex, so readback returns your logical stable IDs instead of libgpod-generated device IDs, and sync-ipod-library can rewrite iTunesDB while reusing unchanged media files in place.
When that sidecar is missing, read-ipod-library now bootstraps deterministic ipod:... IDs from the mounted media bytes plus normalized device path, so first-contact imports are stable before the first managed sync.
Board-specific RTOS and adapter notes for FYSETC SD-WIFI-PRO live in docs/SD_WIFI_PRO_RTOS.md.
Canonical multi-target sync notes live in docs/CANONICAL_LIBRARY.md.
iTunes and Music superlibrary import notes live in docs/ITUNES_IMPORT.md.
Bandcamp import notes live in docs/BANDCAMP_IMPORT.md.
Superlibrary sync notes live in docs/SUPERLIBRARY_SYNC.md.
LG TV notes live in docs/LG_TV.md.
Samsung TV notes live in docs/SAMSUNG_TV.md.
write-itunes-native-snapshot, write-itunes-xml-snapshot, import-itunes-snapshot, import-itunes-native, and import-itunes-xml all converge on the same SQLite/blob-store ingest path. Native macOS imports use a small embedded Swift helper via iTunesLibrary.framework; XML imports use the same helper to decode exported library plists into the same normalized snapshot shape before ingest.
write-bandcamp-snapshot and import-bandcamp do the same for Bandcamp seller data. The importer consumes the official Bandcamp Sales Report API, can poll the asynchronous report endpoints for larger libraries, and optionally maps item_url values onto local files so the canonical blob store only ingests media you actually have on disk.
export-superlibrary-snapshot, push-superlibrary, and pull-superlibrary treat the SQLite database and blob tree as the only canonical state. push-superlibrary writes a consistent SQLite snapshot, syncs blobs, then publishes manifest.json last; pull-superlibrary consumes that manifest, restores the DB, and verifies the pulled snapshot hash before accepting it.