Restructure audio into AUDIO_DIR with per-camera retention
New AUDIO_DIR variable (like BASE_DIR/MOVIES_DIR) is the root for all
audio recordings. Set in .env to put audio on a separate drive.
Directory layout:
AUDIO_DIR/<cam>/YYYY-MM-DD/HH-MM-SS.m4a — ambient recordings
AUDIO_DIR/sunrise/<cam>/YYYY-MM-DD/sunrise-audio.m4a — sunrise clips
sky-cam.conf:
- Add AUDIO_DIR="${AUDIO_DIR:-$BASE_DIR/audio}" in storage section
- Remove AMBIENT_DIR (replaced by AUDIO_DIR)
- Add SUNRISE_AUDIO_RETENTION_DAYS=7 (sunrise clips kept separately from ambient)
- Add per-camera ambient retention examples:
AMBIENT_RETENTION_DAYS_south=60 (keep bird recordings longer)
ambient-record.sh:
- Use AUDIO_DIR instead of AMBIENT_DIR
- Per-camera retention: AMBIENT_RETENTION_DAYS_<cam> overrides global default
sunrise-audio-capture.sh:
- Save clips to AUDIO_DIR/sunrise/<cam>/<date>/sunrise-audio.m4a
- Rolling retention of sunrise clips (SUNRISE_AUDIO_RETENTION_DAYS)
daily_sunrise_video.sh:
- Look for cam_audio in new AUDIO_DIR/sunrise path first, fall back to
old BASE_DIR path so existing recordings keep working
install.sh:
- Pre-create AUDIO_DIR/<cam> and AUDIO_DIR/sunrise/<SUNRISE_CAM> dirs
- Add AUDIO_DIR to .env.example storage section
https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
@@ -64,7 +64,7 @@ if [ "$wait_sec" -gt 0 ]; then
|
||||
fi
|
||||
|
||||
today=$(date +%Y-%m-%d)
|
||||
dir="$BASE_DIR/$CAM/$today"
|
||||
dir="${AUDIO_DIR:-$BASE_DIR/audio}/sunrise/$CAM/$today"
|
||||
mkdir -p "$dir"
|
||||
output="$dir/sunrise-audio.m4a"
|
||||
|
||||
@@ -84,3 +84,11 @@ fi
|
||||
|
||||
size=$(du -h "$output" | cut -f1)
|
||||
echo "Audio capture complete: $output (${record_dur_sec}s, $size)"
|
||||
|
||||
# Rolling retention for sunrise audio clips
|
||||
retain="${SUNRISE_AUDIO_RETENTION_DAYS:-7}"
|
||||
if [ "$retain" -gt 0 ]; then
|
||||
audio_root="${AUDIO_DIR:-$BASE_DIR/audio}/sunrise/$CAM"
|
||||
deleted=$(find "$audio_root" -name "sunrise-audio.m4a" -mtime +"$retain" -print -delete 2>/dev/null | wc -l)
|
||||
[ "$deleted" -gt 0 ] && echo "Retention: deleted $deleted sunrise audio clip(s) older than ${retain}d"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user