| Crates.io | crabbox |
| lib.rs | crabbox |
| version | 0.2.0 |
| created_at | 2025-12-05 19:53:29.199361+00 |
| updated_at | 2025-12-06 23:01:23.665052+00 |
| description | GPIO & RFID controlled jukebox for RaspberryPi |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1969071 |
| size | 415,778 |
Crabbox is a single-binary RFID & GPIO-controlled jukebox for RaspberryPI
Crabbox is AI-assisted Rust implementation inspired by RPi-Jukebox-RFID.
Several years ago I have built a jukebox for my son based on RPi-Jukebox-RFID.
Unfortunately, when SD card completely died I discovered that the software is stale and doesn't work even on bookworm (it is already Trixie era at the time of the writing). I engaged Codex to recreate the needed functionality from scratch.
I run this on my son's Crabbox I device (see picture below).
Crabbox targets RaspberryPi.
It is developed on Linux x64 and can be compiled for the pi using cross-rs.
The player understands the following commands (case-insensitive). They can be sent from the web UI command box, the control pipe, or mapped to RFID tags/buttons:
PLAY [glob] – rebuilds the queue (ordered) and starts playback. Optional glob filter matches full track paths.PLAYPAUSE [glob] – toggle pause/resume, or start a filtered queue if a glob is provided.SHUFFLE [glob] – rebuilds a shuffled queue (optionally filtered) and starts playback.STOP – stop playback and clear the current track.NEXT / PREV – move within the queue and play the next/previous track.VOLUMEUP / VOLUMEDOWN – adjust volume by the configured step.SHUTDOWN – stop playback, play the shutdown sound if configured, then request system shutdown.To control via a named pipe:
[server].pipe in your config (e.g. pipe = "/tmp/crabbox.pipe"). Crabbox recreates this FIFO on startup.printf "PLAY\n" > /tmp/crabbox.pipeprintf "SHUFFLE chill/*\n" > /tmp/crabbox.pipe[server].web to set the listen address (e.g. 0.0.0.0:8080), then open that URL in a browser.rpi feature and configure [rfid] with your RC522 pins (bus, irq, optional reset).[tags], e.g. 0A1B2C3D = "PLAY", ABCD1234 = "SHUFFLE kids/*".config.toml for an example) and point the service to it. At minimum you need one [[music]] directory and a [server] section.cargo build --release; the service example below assumes the binary lives at target/release/crabbox.[server].web — listen address for the web UI/API.[server].pipe — FIFO path for local command control (set to null to disable).[server].startup_sound / [server].shutdown_sound — optional sounds to play on boot/shutdown.[rfid] — RC522 wiring (requires the rpi feature).[tags] — global tag-to-command mappings (used by RFID or other tag sources).[gpio] — all pins are optional; set the ones you wire (leave unset to disable GPIO input entirely).cargo check, cargo test, and cargo run -- server <config> (see Justfile targets check, test, server).sudo apt-get install libasound2-dev.cargo install --locked cross.cross build --target aarch64-unknown-linux-gnu --features rpi --release (see just build-rpi).target/aarch64-unknown-linux-gnu/release/crabbox.Place a unit file at ~/.config/systemd/user/crabbox.service (create the directory if it does not exist):
[Unit]
Description=Crabbox service
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=crabbox server /home/USER/.config/crabbox/config.toml
WorkingDirectory=/home/USER/crabbox
Restart=always
Environment=RUST_LOG=info
[Install]
WantedBy=default.target
/home/USER/... with the actual paths to your checkout, binary, and config.systemctl --user daemon-reload then systemctl --user enable --now crabbox.service.journalctl --user -u crabbox -f. Stop or restart with systemctl --user stop|restart crabbox.service.loginctl enable-linger $USER.AI-assisted code is welcome, with fiew common caveats:
