From 9fefe698cbf55e26c7f0cf82db8c420b53232fc8 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 22 Apr 2026 14:16:15 +0000 Subject: [PATCH] Fix sunrise window logging and Mattermost cleanup scope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit daily_sunrise_video.sh: - Fix "Sunrise (UTC)" label — sunrise.py has always returned local time; now labelled correctly as "Sunrise (local)" - After image selection, log first and last frame timestamps alongside the overlay time so the window can be verified at a glance: Images: 481 (05:22:10 → 06:43:00 overlay: 06:32) sunrise2mm.py: - Cleanup now only deletes posts whose message matches "Sunrise YYYY-MM-DD" (the format this script posts), so other posts with attachments in the channel are never touched https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- daily_sunrise_video.sh | 7 ++++--- sunrise2mm.py | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/daily_sunrise_video.sh b/daily_sunrise_video.sh index e1795d6..0d04d76 100755 --- a/daily_sunrise_video.sh +++ b/daily_sunrise_video.sh @@ -54,9 +54,8 @@ if ! $TEST_MODE; then echo "Error: Failed to retrieve sunrise time." exit 1 fi - echo "Sunrise (UTC): $sunrise_time" + echo "Sunrise (local): $sunrise_time" sunrise_time_local=$(TZ="$TIMEZONE" date -d "$sunrise_time" +"%H-%M-%S") - echo "Sunrise (local): $sunrise_time_local" SR_TIME=$(echo "$sunrise_time_local" | cut -d'-' -f1,2 | tr '-' ':') fi @@ -111,7 +110,9 @@ if [ "${#images[@]}" -lt 1 ]; then echo "No images found." exit 1 fi -echo "Images: ${#images[@]}" +first_t=$(basename "${images[0]}" .jpg | tr '-' ':') +last_t=$(basename "${images[-1]}" .jpg | tr '-' ':') +echo "Images: ${#images[@]} (${first_t} → ${last_t} overlay: ${SR_TIME})" # Concat list with explicit frame duration so each frame represents real elapsed # time. Without this, all frames collapse to timestamp 0 → one-frame video. diff --git a/sunrise2mm.py b/sunrise2mm.py index 5163771..34d50ea 100755 --- a/sunrise2mm.py +++ b/sunrise2mm.py @@ -146,6 +146,9 @@ while True: continue if not post.get('file_ids'): continue + # Only delete posts this script created — message starts with "Sunrise YYYY-MM-DD" + if not re.match(r'^Sunrise \d{4}-\d{2}-\d{2}', post.get('message', '')): + continue if post['create_at'] >= cutoff_ms: continue del_r = requests.delete(