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:
@@ -54,9 +54,8 @@ if ! $TEST_MODE; then
|
|||||||
echo "Error: Failed to retrieve sunrise time."
|
echo "Error: Failed to retrieve sunrise time."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Sunrise (UTC): $sunrise_time"
|
echo "Sunrise (local): $sunrise_time"
|
||||||
sunrise_time_local=$(TZ="$TIMEZONE" date -d "$sunrise_time" +"%H-%M-%S")
|
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 '-' ':')
|
SR_TIME=$(echo "$sunrise_time_local" | cut -d'-' -f1,2 | tr '-' ':')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -111,7 +110,9 @@ if [ "${#images[@]}" -lt 1 ]; then
|
|||||||
echo "No images found."
|
echo "No images found."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
# Concat list with explicit frame duration so each frame represents real elapsed
|
||||||
# time. Without this, all frames collapse to timestamp 0 → one-frame video.
|
# time. Without this, all frames collapse to timestamp 0 → one-frame video.
|
||||||
|
|||||||
@@ -146,6 +146,9 @@ while True:
|
|||||||
continue
|
continue
|
||||||
if not post.get('file_ids'):
|
if not post.get('file_ids'):
|
||||||
continue
|
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:
|
if post['create_at'] >= cutoff_ms:
|
||||||
continue
|
continue
|
||||||
del_r = requests.delete(
|
del_r = requests.delete(
|
||||||
|
|||||||
Reference in New Issue
Block a user