Fix sunrise window logging and Mattermost cleanup scope

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
This commit is contained in:
Claude
2026-04-22 14:16:15 +00:00
parent 1cf51eaa26
commit 9fefe698cb
2 changed files with 7 additions and 3 deletions
+4 -3
View File
@@ -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.
+3
View File
@@ -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(