Files
sonos-aux-recordplayer-pi/03-darkice-wrapper.sh
Geert Rademakers 9529f1b0e1 Add one-command install script and stability fixes
- Add install.sh for automated setup
- Add all component files (wrapper, service, config, verify)
- Add stability fixes section (WiFi PowerSave disable + Watchdog)
- Update README with new installation instructions
2026-02-17 23:17:38 +01:00

25 lines
552 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
MAX_WAIT_SEC=90
SLEEP_STEP=2
DARKICE_CMD="/usr/bin/darkice -c /home/pi/darkice.cfg"
log() { echo "[$(date '+%H:%M:%S')] $*" >&2; }
log "⏳ Waiting for ALSA card 0 (USB audio)..."
elapsed=0
while ! arecord -l 2>/dev/null | grep -q "^card 0:"; do
if (( elapsed >= MAX_WAIT_SEC )); then
log "💥 FATAL: No card 0 after ${MAX_WAIT_SEC}s"
arecord -l || true
exit 1
fi
sleep "${SLEEP_STEP}"
elapsed=$((elapsed + SLEEP_STEP))
done
log "✅ Card 0 ready! Launching DarkIce."
exec ${DARKICE_CMD}