From d20a0d94ae436708a6469e03cf7b67c0d0a80d8f Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Apr 2026 00:19:59 +0000 Subject: [PATCH] Fix sunrise output filename to reflect SUNRISE_TARGET_SECS from conf The output video was always named -sunrise-10s.mp4 regardless of the configured duration. Both sunrise_video.10s.sh and sunrise2mm.py now derive the filename from SUNRISE_TARGET_SECS so changing it in conf produces correctly named files that the uploader still finds. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- sunrise2mm.py | 4 ++-- sunrise_video.10s.sh | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sunrise2mm.py b/sunrise2mm.py index 9bafcfe..9f6240d 100644 --- a/sunrise2mm.py +++ b/sunrise2mm.py @@ -53,8 +53,8 @@ if not os.path.isdir(output_dir): print(f"Error: The directory {output_dir} does not exist. The video may not have been created yet.") exit(1) -# Find the sunrise video file for today (e.g., 2024-11-05-sunrise-10s.mp4) -final_video_file = os.path.join(output_dir, f"{today_date_str}-sunrise-10s.mp4") +target_secs = config.get('SUNRISE_TARGET_SECS', '10') +final_video_file = os.path.join(output_dir, f"{today_date_str}-sunrise-{target_secs}s.mp4") # Debugging: print the full path of the video file to make sure it's correct print(f"Looking for video file: {final_video_file}") diff --git a/sunrise_video.10s.sh b/sunrise_video.10s.sh index 2119670..70b9485 100644 --- a/sunrise_video.10s.sh +++ b/sunrise_video.10s.sh @@ -112,15 +112,14 @@ total_seconds=$(($hours * 3600 + $minutes * 60 + $seconds)) # Convert to total 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) echo "Calculated speed-up factor: $speed_up_factor" # Output filename for the second movie (speed-adjusted) -final_video="$output_dir/$current_date-sunrise-10s.mp4" +final_video="$output_dir/$current_date-sunrise-${SUNRISE_TARGET_SECS}s.mp4" # Apply the speed adjustment using the setpts filter -echo "Adjusting video speed to target duration of 10 seconds..." +echo "Adjusting video speed to ${SUNRISE_TARGET_SECS}s..." ffmpeg -i "$first_movie" -filter:v "setpts=PTS/$speed_up_factor" -y "$final_video" # Check the duration of the adjusted video