108 lines
5.6 KiB
Python
108 lines
5.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Add sample summaries to the database for testing."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
from datetime import datetime, timedelta
|
|
import random
|
|
|
|
# Add parent directory to path
|
|
sys.path.append(str(Path(__file__).parent.parent))
|
|
|
|
from backend.cli import SummaryManager
|
|
|
|
def add_sample_summaries():
|
|
"""Add sample summaries to the database."""
|
|
manager = SummaryManager()
|
|
|
|
sample_data = [
|
|
{
|
|
'video_id': 'dQw4w9WgXcQ',
|
|
'video_url': 'https://youtube.com/watch?v=dQw4w9WgXcQ',
|
|
'video_title': 'Rick Astley - Never Gonna Give You Up',
|
|
'transcript': 'We\'re no strangers to love. You know the rules and so do I...',
|
|
'summary': 'A classic 1987 pop song by Rick Astley that became an internet meme phenomenon known as "Rickrolling". The song features upbeat tempo and memorable lyrics about eternal commitment.',
|
|
'key_points': ['Classic 80s pop hit', 'Internet meme phenomenon', 'Message of loyalty and commitment'],
|
|
'main_themes': ['Music', 'Pop Culture', 'Internet Memes'],
|
|
'model_used': 'deepseek',
|
|
'processing_time': 3.4,
|
|
'quality_score': 9.2,
|
|
'summary_length': 'brief'
|
|
# 'source' field temporarily disabled until database migration
|
|
},
|
|
{
|
|
'video_id': 'jNQXAC9IVRw',
|
|
'video_url': 'https://youtube.com/watch?v=jNQXAC9IVRw',
|
|
'video_title': 'Me at the zoo',
|
|
'transcript': 'All right, so here we are in front of the elephants...',
|
|
'summary': 'The first video ever uploaded to YouTube on April 23, 2005. Features co-founder Jawed Karim at the San Diego Zoo discussing elephants. A historic piece of internet history marking the beginning of the YouTube platform.',
|
|
'key_points': ['First YouTube video', 'Uploaded April 23, 2005', 'Features Jawed Karim at San Diego Zoo', 'Discussion about elephants'],
|
|
'main_themes': ['Internet History', 'YouTube', 'Technology Milestones'],
|
|
'model_used': 'anthropic',
|
|
'processing_time': 2.1,
|
|
'quality_score': 8.7,
|
|
'summary_length': 'standard'
|
|
},
|
|
{
|
|
'video_id': 'kJQP7kiw5Fk',
|
|
'video_url': 'https://youtube.com/watch?v=kJQP7kiw5Fk',
|
|
'video_title': 'Luis Fonsi - Despacito ft. Daddy Yankee',
|
|
'transcript': 'Sí, sabes que ya llevo un rato mirándote...',
|
|
'summary': 'The 2017 reggaeton-pop hit that became the most-viewed YouTube video for several years. Features Puerto Rican artists Luis Fonsi and Daddy Yankee, with lyrics about romance and attraction. The song achieved global success and broke numerous streaming records.',
|
|
'key_points': ['Most-viewed YouTube video (2017-2020)', 'Reggaeton-pop fusion', 'Global chart success', 'Spanish-language breakthrough'],
|
|
'main_themes': ['Music', 'Latin Pop', 'Cultural Phenomenon'],
|
|
'model_used': 'openai',
|
|
'processing_time': 4.8,
|
|
'quality_score': 9.5,
|
|
'summary_length': 'detailed'
|
|
},
|
|
{
|
|
'video_id': '9bZkp7q19f0',
|
|
'video_url': 'https://youtube.com/watch?v=9bZkp7q19f0',
|
|
'video_title': 'PSY - GANGNAM STYLE',
|
|
'transcript': 'Oppa Gangnam style...',
|
|
'summary': 'The 2012 K-pop sensation that became the first YouTube video to reach 1 billion views. Features South Korean artist PSY performing the iconic horse dance. The song satirizes the lifestyle of Seoul\'s Gangnam District and sparked a global dance craze.',
|
|
'key_points': ['First video to reach 1 billion views', 'K-pop breakthrough in Western markets', 'Iconic horse dance', 'Cultural satire of Gangnam lifestyle'],
|
|
'main_themes': ['K-pop', 'Viral Dance', 'Cultural Commentary'],
|
|
'model_used': 'gemini',
|
|
'processing_time': 5.2,
|
|
'quality_score': 9.0,
|
|
'summary_length': 'standard'
|
|
},
|
|
{
|
|
'video_id': 'OPf0YbXqDm0',
|
|
'video_url': 'https://youtube.com/watch?v=OPf0YbXqDm0',
|
|
'video_title': 'Mark Ronson - Uptown Funk ft. Bruno Mars',
|
|
'transcript': 'This hit, that ice cold...',
|
|
'summary': 'The 2014 funk-pop collaboration between Mark Ronson and Bruno Mars. A retro-inspired dance anthem that dominated charts worldwide with its infectious groove and energetic performance. The music video features synchronized choreography and vintage aesthetics.',
|
|
'key_points': ['Retro funk revival', 'Chart-topping success', 'Collaboration hit', 'Dance anthem of 2014-2015'],
|
|
'main_themes': ['Funk Music', 'Pop', 'Dance'],
|
|
'model_used': 'deepseek',
|
|
'processing_time': 3.9,
|
|
'quality_score': 9.3,
|
|
'summary_length': 'standard'
|
|
}
|
|
]
|
|
|
|
print("Adding sample summaries to database...")
|
|
for i, data in enumerate(sample_data):
|
|
# Randomize creation time for variety
|
|
hours_ago = random.randint(1, 168) # Last week
|
|
data['created_at'] = datetime.utcnow() - timedelta(hours=hours_ago)
|
|
|
|
try:
|
|
saved = manager.save_summary(data)
|
|
print(f"✓ Added: {data['video_title'][:50]}")
|
|
except Exception as e:
|
|
print(f"✗ Failed to add {data['video_title']}: {e}")
|
|
|
|
# List all summaries
|
|
print("\nCurrent summaries in database:")
|
|
summaries = manager.list_summaries(limit=20)
|
|
for s in summaries:
|
|
print(f"- [{s.model_used:10}] {s.video_title[:60]}")
|
|
|
|
print(f"\nTotal: {len(summaries)} summaries")
|
|
|
|
if __name__ == "__main__":
|
|
add_sample_summaries() |