Spaces:
Running
Running
| import os | |
| from typing import Dict, Optional, Tuple | |
| def get_cached_content(app_name: str) -> Optional[Tuple[str, Dict]]: | |
| """ | |
| Get cached video path and script for predefined apps | |
| """ | |
| # Use relative paths for outputs | |
| video_path = os.path.join('outputs', 'sizzle_reel', 'final') | |
| script_path = os.path.join('outputs', 'sizzle_reel', 'scripts') | |
| # Create directories if they don't exist | |
| os.makedirs(video_path, exist_ok=True) | |
| os.makedirs(script_path, exist_ok=True) | |
| cached_videos = { | |
| "BloomBuddy": "BloomBuddy_sizzle_reel_HQ.mp4", | |
| "FitFlow AI": "FitFlowAI_sizzle_reel_HQ.mp4", | |
| "LingoPal": "LingoPal_sizzle_reel_HQ.mp4", | |
| "MindMate": "MindMate_sizzle_reel_HQ.mp4", | |
| "EcoCart": "EcoCart_sizzle_reel_HQ.mp4", | |
| "ChefSync": "ChefSync_sizzle_reel_HQ.mp4", | |
| "WanderWise": "WanderWise_sizzle_reel_HQ.mp4", | |
| "SkillShare+": "SkillShare__sizzle_reel_HQ.mp4" | |
| } | |
| if app_name not in cached_videos: | |
| return None | |
| # Remove spaces from app name for file paths | |
| sanitized_name = app_name.strip().replace(" ", "") | |
| video_file = os.path.join(video_path, cached_videos[app_name.strip()]) | |
| script_file = os.path.join(script_path, f"{sanitized_name.lower()}.json") | |
| # Add debug print to check paths | |
| print(f"Looking for video at: {video_file}") | |
| print(f"Looking for script at: {script_file}") | |
| if not os.path.exists(video_file) or not os.path.exists(script_file): | |
| print("Script or video not found... Try again.") | |
| return None | |
| with open(script_file, 'r') as f: | |
| script = f.read() | |
| return video_file, script | |