Remove all hardcoded deployment values; read from sky-cam.conf
- sunrise_video.10s.sh: use $TIMEZONE (was hardcoded America/New_York), $SUNRISE_PRE_MIN/$SUNRISE_POST_MIN for capture window, $SUNRISE_TARGET_SECS for output duration (was wrong value 8 in a script named 10s) - fullday-video.sh: remove hardcoded FULLDAY_FPS/RETENTION_DAYS; both now come from sky-cam.conf - 4-seasons.sh, montage-mvt.sh: export TIMEZONE after sourcing conf so season_info.py subprocess picks it up via env rather than falling back to its hardcoded America/New_York default - sky-cam.conf: add SUNRISE_PRE_MIN, SUNRISE_POST_MIN, SUNRISE_TARGET_SECS, FULLDAY_FPS, RETENTION_DAYS https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
@@ -12,6 +12,7 @@ set -x
|
||||
|
||||
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
||||
source "$SCRIPT_DIR/sky-cam.conf"
|
||||
export TIMEZONE # make it visible to season_info.py subprocess
|
||||
|
||||
# ── Configuration ──────────────────────────────────────────────────────────────
|
||||
base_dir="$BASE_DIR"
|
||||
|
||||
+1
-2
@@ -12,8 +12,7 @@ source "$SCRIPT_DIR/sky-cam.conf"
|
||||
|
||||
# ── Configuration ──────────────────────────────────────────────────────────────
|
||||
base_dir="$BASE_DIR"
|
||||
FULLDAY_FPS=5 # timelapse frame rate — adjust to taste
|
||||
RETENTION_DAYS=10 # full-day videos older than this are deleted
|
||||
# FULLDAY_FPS and RETENTION_DAYS come from sky-cam.conf
|
||||
|
||||
# ── Date / paths ──────────────────────────────────────────────────────────────
|
||||
yesterday=$(date --date="yesterday" +%Y-%m-%d)
|
||||
|
||||
@@ -20,6 +20,7 @@ set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
||||
source "$SCRIPT_DIR/sky-cam.conf"
|
||||
export TIMEZONE # make it visible to season_info.py subprocess
|
||||
|
||||
# ── Configuration ──────────────────────────────────────────────────────────────
|
||||
base_dir="$BASE_DIR"
|
||||
|
||||
@@ -96,6 +96,17 @@ LATITUDE=38.123456
|
||||
LONGITUDE=-97.654321
|
||||
TIMEZONE=America/New_York
|
||||
|
||||
# ── Sunrise video tuning ──────────────────────────────────────────────────────
|
||||
# How many minutes before/after sunrise to include in the daily clip.
|
||||
SUNRISE_PRE_MIN=70
|
||||
SUNRISE_POST_MIN=10
|
||||
# Target duration (seconds) for the speed-adjusted sunrise video.
|
||||
SUNRISE_TARGET_SECS=10
|
||||
|
||||
# ── Full-day timelapse tuning ─────────────────────────────────────────────────
|
||||
FULLDAY_FPS=5 # frame rate of the timelapse video
|
||||
RETENTION_DAYS=10 # delete full-day videos older than this many days
|
||||
|
||||
# ── Mattermost — daily sunrise upload ─────────────────────────────────────────
|
||||
mattermost_url=https://your-mattermost-server.example.com
|
||||
access_token=your-access-token-here
|
||||
|
||||
@@ -28,11 +28,11 @@ fi
|
||||
# Output the sunrise time in UTC
|
||||
echo "Sunrise time (UTC): $sunrise_time"
|
||||
|
||||
# Set the time zone to Eastern US time (America/New_York)
|
||||
export TZ="America/New_York"
|
||||
# Export timezone so date and subprocesses use the configured local time.
|
||||
export TZ="$TIMEZONE"
|
||||
|
||||
# Convert sunrise time from UTC to Eastern Time (ET)
|
||||
sunrise_time_et=$(TZ="America/New_York" date -d "$sunrise_time" +"%H-%M-%S")
|
||||
# Convert sunrise time from UTC to local time.
|
||||
sunrise_time_et=$(TZ="$TIMEZONE" date -d "$sunrise_time" +"%H-%M-%S")
|
||||
|
||||
# Output the converted sunrise time in Eastern Time
|
||||
echo "Sunrise time (Eastern Time): $sunrise_time_et"
|
||||
@@ -46,9 +46,9 @@ time_to_seconds() {
|
||||
# Convert sunrise time (in Eastern Time) to seconds since midnight
|
||||
sunrise_seconds=$(time_to_seconds "$sunrise_time_et")
|
||||
|
||||
# Calculate the start and end times (60 minutes before sunrise and 15 minutes after sunrise)
|
||||
start_seconds=$((sunrise_seconds - 70 * 60)) # 60 minutes before sunrise
|
||||
end_seconds=$((sunrise_seconds + 10 * 60)) # 20 minutes after sunrise
|
||||
# Calculate the capture window around sunrise.
|
||||
start_seconds=$((sunrise_seconds - SUNRISE_PRE_MIN * 60))
|
||||
end_seconds=$((sunrise_seconds + SUNRISE_POST_MIN * 60))
|
||||
|
||||
# Output the start and end times in seconds for debugging
|
||||
echo "Start seconds: $start_seconds"
|
||||
@@ -110,8 +110,7 @@ echo "Initial video duration: $video_duration"
|
||||
IFS=':' read -r hours minutes seconds <<< $(echo $video_duration | cut -d '.' -f1) # Extract time
|
||||
total_seconds=$(($hours * 3600 + $minutes * 60 + $seconds)) # Convert to total seconds
|
||||
|
||||
# Target video duration: 10 seconds
|
||||
target_duration=8
|
||||
target_duration=$SUNRISE_TARGET_SECS
|
||||
|
||||
# Calculate the speed-up factor to make the video fit into the target duration of 10 seconds
|
||||
speed_up_factor=$(echo "scale=3; $total_seconds / $target_duration" | bc)
|
||||
|
||||
Reference in New Issue
Block a user