From e4d4a6c15f4e5952a2c18ead2ed66a60d34b7e1d Mon Sep 17 00:00:00 2001 From: Gramps Date: Fri, 25 Jul 2025 19:32:11 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=A0=20Integrate=20notes.txt=20for=20dy?= =?UTF-8?q?namic=20thumbnail=20prompt=20generation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added generate_thumbnail_prompt(notes) to thumbnail_utils.py - yt_poster.py now reads notes.txt (if present) from the clip directory - Uses content to generate brand-aligned OpenAI prompt for future AI thumbnail generation - Fallback: generic description if notes.txt is missing - Prompt is printed for now; image generation hook is pending --- modules/yt_poster.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/yt_poster.py b/modules/yt_poster.py index 3cd99c1..1259262 100644 --- a/modules/yt_poster.py +++ b/modules/yt_poster.py @@ -18,7 +18,7 @@ from googleapiclient.errors import HttpError from googleapiclient.http import MediaFileUpload from modules.title_utils import generate_montage_title from modules.description_utils import generate_montage_description -from modules.thumbnail_utils import generate_thumbnail +from modules.thumbnail_utils import generate_thumbnail, generate_thumbnail_prompt from modules.config import DEBUG from dotenv import load_dotenv from datetime import datetime @@ -85,9 +85,22 @@ def upload_video(file_path: Path, is_vertical: bool, stream_date: str, descripti video_url = f"https://youtu.be/{video_id}" print(f"✅ Upload complete: {video_url}") - # ✅ Thumbnail upload (widescreen only) + # ✅ Generate thumbnail if widescreen if not is_vertical: - thumbnail_path = generate_thumbnail(file_path) + # Load notes.txt if present + notes_file = file_path.with_name("notes.txt") + if notes_file.exists(): + with open(notes_file, "r", encoding="utf-8") as f: + notes_text = f.read().strip() + else: + notes_text = "A funny Fortnite moment with Gramps." + + # Build prompt (future use for AI image generation) + thumbnail_prompt = generate_thumbnail_prompt(notes_text) + print(f"🧠 Thumbnail prompt: {thumbnail_prompt}") + + # Generate local thumbnail via ffmpeg + thumbnail_path = generate_thumbnail(file_path, output_path=f"{file_path.stem}_thumb.jpg") if thumbnail_path: youtube.thumbnails().set( videoId=video_id,