File size: 1,696 Bytes
8a656d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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