diff --git a/4-seasons.sh b/4-seasons.sh index 0109c1f..8502960 100755 --- a/4-seasons.sh +++ b/4-seasons.sh @@ -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" diff --git a/fullday-video.sh b/fullday-video.sh index 25d0ac6..e3bb633 100755 --- a/fullday-video.sh +++ b/fullday-video.sh @@ -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) diff --git a/montage-mvt.sh b/montage-mvt.sh index 5885ff5..eac3436 100755 --- a/montage-mvt.sh +++ b/montage-mvt.sh @@ -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" diff --git a/sky-cam.conf b/sky-cam.conf index 85df032..447b594 100644 --- a/sky-cam.conf +++ b/sky-cam.conf @@ -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 diff --git a/sunrise_video.10s.sh b/sunrise_video.10s.sh index 0ed4db0..2119670 100644 --- a/sunrise_video.10s.sh +++ b/sunrise_video.10s.sh @@ -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)