-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreview_formats.py
More file actions
29 lines (25 loc) · 996 Bytes
/
Copy pathpreview_formats.py
File metadata and controls
29 lines (25 loc) · 996 Bytes
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
import json
from pathlib import Path
from dotenv import load_dotenv
from quiz_generator import generate_quiz
from seo_metadata import metadata_for_quiz
from video_builder import build_video
load_dotenv()
root = Path(__file__).resolve().parent
output = root / "output"
quiz = generate_quiz("Python functions, arguments, and return values")
long_path = output / "branded_preview_long.mp4"
short_path = output / "branded_preview_short.mp4"
music = root / "assets" / "music.mp3"
build_video(quiz, str(long_path), str(music), shorts=False)
build_video(quiz, str(short_path), str(music), shorts=True)
metadata = {
"quiz": quiz,
"longform": metadata_for_quiz(quiz, shorts=False),
"short": metadata_for_quiz(quiz, shorts=True),
}
(root / "data" / "preview_metadata.json").write_text(json.dumps(metadata, indent=2), encoding="utf-8")
print(f"long={long_path}")
print(f"short={short_path}")
print(f"title={metadata['longform']['title']}")
print(f"short_title={metadata['short']['title']}")