Files
wedding-phone/config.example.json
grabowski d07cb82772 Add USB backup system with CRC32 verification
**USB Backup Features:**
- Automatic backup to multiple USB drives
- CRC32 checksum verification for data integrity
- Configurable backup paths in config.json
- Backup on write (recordings and greeting uploads)
- Corrupted backups automatically deleted
- Web interface for monitoring and testing

**Configuration:**
- Added backup section to config.example.json
- enabled: Enable/disable USB backup
- usb_paths: Array of USB mount points
- verify_crc: Enable CRC32 verification
- backup_on_write: Backup immediately after file write

**CRC32 Implementation:**
- calculate_crc32(): Compute file checksum
- 64KB chunk reading for memory efficiency
- Source and destination file verification
- Automatic cleanup of failed copies

**Backup Functions:**
- backup_file_to_usb(): Backup with verification
- get_usb_backup_status(): Check drive status
- Mount detection, write test, free space check
- Preserves directory structure on USB

**Web Interface:**
- USB Backup card with drive status display
- Green/Yellow/Red status indicators
- Free space monitoring
- Test backup button
- Real-time status refresh
- Detailed error reporting

**Integration:**
- Recordings backed up after save
- Greetings backed up after upload
- Backup results logged to console
- Non-blocking backup execution

**API Endpoints:**
- GET /api/backup/status - Drive status
- POST /api/backup/test - Test backup

**Documentation:**
- Complete USB backup guide in README
- Mount instructions for USB drives
- CRC verification explanation
- Backup directory structure
- Web interface usage guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 16:28:32 +07:00

42 lines
836 B
JSON

{
"gpio": {
"hook_pin": 17,
"hook_pressed_state": "LOW",
"extra_button_enabled": true,
"extra_button_pin": 27,
"extra_button_pressed_state": "LOW"
},
"audio": {
"device_index": 1,
"chunk_size": 1024,
"format": "paInt16",
"channels": 1,
"sample_rate": 44100,
"max_record_seconds": 300
},
"paths": {
"base_dir": "./rotary_phone_data",
"recordings_dir": "recordings",
"sounds_dir": "sounds"
},
"backup": {
"enabled": true,
"usb_paths": [
"/media/usb0",
"/media/usb1"
],
"verify_crc": true,
"backup_on_write": true
},
"web": {
"port": 8080,
"max_upload_size_mb": 50
},
"system": {
"active_greeting": "dialtone.wav",
"extra_button_sound": "button_sound.wav",
"greeting_delay_seconds": 0,
"volume": 70
}
}