No description
  • Zig 56.9%
  • Rust 36.4%
  • JavaScript 2.1%
  • C 1.7%
  • Swift 1.6%
  • Other 1.3%
Find a file
Conrad Kramer 0a8278f132 Merge branch 'codex/pi5-builder'
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.
2026-03-29 18:41:32 -07:00
deps/zig-xml Add typed ANLZ support and vendor sources 2026-03-18 22:51:41 -07:00
docs Add Pi 5 CDJ appliance scaffold 2026-03-29 18:41:27 -07:00
ghidra Make local Ghidra harness usable 2026-03-22 19:38:55 -07:00
nixos/pi5-cdj Add Pi 5 CDJ appliance scaffold 2026-03-29 18:41:27 -07:00
rekordcrate Add typed ANLZ support and vendor sources 2026-03-18 22:51:41 -07:00
scripts Add Pi 5 CDJ appliance scaffold 2026-03-29 18:41:27 -07:00
src Merge branch 'codex/ipod-usb' 2026-03-29 18:41:12 -07:00
.gitignore Merge branch 'codex/ipod-usb' 2026-03-29 18:41:12 -07:00
auth_manager.jsc Initial import 2026-03-18 22:44:31 -07:00
build.zig Add AirPlay and local TV providers 2026-03-29 18:19:21 -07:00
build.zig.zon Initial import 2026-03-18 22:44:31 -07:00
flake.lock Initial import 2026-03-18 22:44:31 -07:00
flake.nix Add AirPlay and local TV providers 2026-03-29 18:19:21 -07:00
login.jsc Initial import 2026-03-18 22:44:31 -07:00
README.md Merge branch 'codex/ipod-usb' 2026-03-29 18:41:12 -07:00

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.DAT parsing 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_rows fixture.
  • Typed plain-PDB data-page decoding for tracks, artists, albums, colors, keys, columns, playlist_tree, playlist_entries, genres, labels, artwork, history_*, history, menu, and menu_column_mappings, with fixture-backed assertions and row dumps from real export.pdb pages.
  • Typed exportExt.pdb decoding for tag, track_tag, and the singleton db_property_option row, including structural decoding of a DBPropertyOption/drive-info-shaped u32 key plus five string slots.
  • Full USB export tree ingestion for upstream complete_export dumps, including byte-for-byte fixture roundtrip of complete PIONEER/ trees.
  • Typed USBANLZ/ANLZ*.DAT, .EXT, and .2EX section framing with byte-for-byte roundtrip verification and per-section summaries.
  • Decrypted PSSI song-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_Control and iTunes_Control, safe iTunesDB extraction 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_airtunes2 concepts: PCM ring buffering, 352-frame pacing, RTP packet framing, ALAC packetization, legacy AES payload encryption, shared UDP timing/control/audio sockets, and legacy RTSP OPTIONS -> ANNOUNCE -> SETUP -> RECORD negotiation with digest auth.
  • Native AirPlay discovery and AP2 groundwork: best-effort mDNS browse for _raop._tcp and _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 completes SETUP_AP2_1 -> SETPEERS -> SETUP_AP2_2 against 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 protocolInfo advertising for picky renderers.
  • Secure LG webOS remote-control groundwork: prompt-based pairing over the native wss://<tv>:3001 SSAP 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 on wss://<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 rekordboxAgent in 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 plus setting.Bundle for emitting a full PIONEER/*SETTING.DAT set
  • rekordzig.anlz: typed ANLZ reader/writer with section summaries, cue and song-structure decoding, phrase labels, and byte-for-byte roundtrip verification
  • rekordzig.airplay: Zig-first AirPlay sender core with PCM buffering, RTP/ALAC/AES packetization, resend history, and shared UDP timing/control/audio socket helpers
  • rekordzig.airplay_ap2: typed AP2 RTSP request builders plus binary-plist request/response codecs for SETUP_AP2_1, SETPEERS, and SETUP_AP2_2
  • rekordzig.airplay_ap2_session: transient AP2 runtime handshake that drives encrypted SETUP_AP2_1 -> SETPEERS -> SETUP_AP2_2 and reports the negotiated ports and control keys
  • rekordzig.airplay_homekit: HomeKit TLV, HAP SRP pair-setup, stored-credential pair-verify flow, and encrypted control-channel framing for AP2-class sessions
  • rekordzig.airplay_mdns: native mDNS query/response parsing plus best-effort _raop._tcp / _airplay._tcp discovery and capability extraction
  • rekordzig.airplay_probe: hardware-facing transient pair-setup probe for validating AP2 HomeKit handshakes against real AirPlay targets
  • rekordzig.airplay_rtsp: legacy RAOP/AirPlay 1 RTSP client and PlaybackSession wrapper for digest-auth negotiation plus shared-socket sender startup; AirPlay 2 pairing still sits above this layer
  • rekordzig.airplay_srp: native HAP SRP client/server math used by HomeKit pair-setup
  • rekordzig.bplist: minimal binary-plist encoder/decoder for AP2 control payloads
  • rekordzig.pdb: PDB header/page-chain scanner plus typed export.pdb row decoding, typed history sync-record decoding, typed exportExt.pdb tag / track_tag / db_property_option rows, and raw/index inspection APIs for unsupported page kinds
  • rekordzig.pdb_rows: low-level DeviceSQL and row-payload codecs for plain PDB table rows
  • rekordzig.rekordbox_xml: typed Rekordbox XML writer built on ianprime0509/zig-xml
  • rekordzig.device: DeviceExport writer for materializing export trees with settings, database.xml, and arbitrary extra assets
  • rekordzig.usb_export: full export-tree reader/writer for PIONEER/ dumps, parsing settings and ANLZ files while preserving whole-tree byte identity
  • rekordzig.ipod: direct iPod storage scaffolding split into block_device for whole-image cloning, volume for mounted iTunesDB and SysInfo access, and library for libgpod-backed library import/export on mounted iPods
  • rekordzig.library: target-neutral collection model for syncing one logical library into CDJ USB, iPod, and later targets
  • rekordzig.library_rekordbox: adapter from the canonical library model into rekordbox_xml.Document
  • rekordzig.lg_tv: SSDP-based LG TV discovery plus DMR/AVTransport URL-launch helpers for first local playback/control probes
  • rekordzig.lg_tv_remote: secure webOS SSAP pairing, persisted client-key handling, pointer/button remote commands, and best-effort screenshot capture
  • rekordzig.samsung_tv: secure Tizen token pairing, remote-key commands, installed-app enumeration, and app-launch helpers backed by the native /api/v2/ and samsung.remote.control surfaces
  • rekordzig.superlibrary_db: SQLite-backed superlibrary ingest and blob-store maintenance for normalized source snapshots
  • rekordzig.superlibrary_sync: safe SQLite snapshot export plus rclone-backed push/pull for the canonical SQLite/blob store
  • rekordzig.sync_state: per-target export ID, path, and hash mappings layered beside the canonical library model
  • rekordzig.rekordbox_agent: installed-app harness for launching an isolated rekordboxAgent, 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 rekordboxAgent process and enables the Node inspector with SIGUSR1
  • reads the in-memory local API token without printing it
  • replays authenticated GET /api/v1/agent/mode and GET /api/v1/agent/sharedPlaylists/mode requests 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 / djmdDevice model shape against the live SQLCipher-backed tables
  • dumps sampled djmdProperty / djmdDevice rows without exposing the bearer token
  • records the current /api/v1/data/djmdProperties probe result, which on this Rekordbox 7.2.12.0344 install currently fails because the route expects djmdProperty.rb_local_deleted even 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.