File size: 4,372 Bytes
1425afc | 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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | from __future__ import annotations
from copy import deepcopy
from typing import Any
PRESETS: dict[str, dict[str, Any]] = {
"tiktok_9_16_fast": {
"creative_style": "viral_shorts",
"platform": "tiktok",
"template": "tiktok_classic",
"subtitle_format": "ass",
"auto_subtitles": True,
"preview": False,
"normalize": True,
},
"youtube_shorts_hd": {
"creative_style": "viral_shorts",
"platform": "youtube_shorts",
"template": "youtube_shorts",
"subtitle_format": "ass",
"auto_subtitles": True,
"normalize": True,
},
"podcast_square": {
"creative_style": "podcast_clip",
"platform": "instagram_feed_square",
"template": "podcast_style",
"subtitle_format": "ass",
"auto_subtitles": True,
"normalize": True,
"metadata": {"target_aspect": "1:1"},
},
"reels_with_subtitles": {
"creative_style": "story_vlog",
"platform": "instagram_reels",
"template": "modern_minimal",
"subtitle_format": "ass",
"auto_subtitles": True,
"normalize": True,
},
"draft_preview": {
"creative_style": "product_demo",
"platform": "tiktok",
"template": "modern_minimal",
"subtitle_format": "ass",
"preview": True,
"normalize": True,
},
"tiktok_music_ducked": {
"creative_style": "viral_shorts",
"platform": "tiktok",
"template": "tiktok_classic",
"subtitle_format": "ass",
"auto_subtitles": True,
"audio_normalize": True,
"music_volume": 0.25,
"music_fade_in": 0.4,
"music_fade_out": 1.0,
"music_loop": True,
"music_ducking": True,
"normalize": True,
},
"instagram_reels_music": {
"creative_style": "story_vlog",
"platform": "instagram_reels",
"template": "modern_minimal",
"subtitle_format": "ass",
"auto_subtitles": True,
"audio_normalize": True,
"music_volume": 0.28,
"music_fade_in": 0.3,
"music_fade_out": 0.8,
"music_loop": True,
"music_ducking": True,
"normalize": True,
},
"youtube_landscape_1080p": {
"creative_style": "news_explainer",
"platform": "youtube_1080p",
"template": "news_style",
"subtitle_format": "ass",
"auto_subtitles": False,
"audio_normalize": True,
"normalize": True,
},
"capcut_viral_auto": {
"creative_style": "viral_shorts",
"platform": "tiktok",
"template": "neon_pop",
"subtitle_format": "ass",
"auto_subtitles": True,
"audio_normalize": True,
"music_volume": 0.24,
"music_fade_in": 0.2,
"music_fade_out": 0.8,
"music_loop": True,
"music_ducking": True,
"normalize": True,
},
"capcut_product_launch": {
"creative_style": "product_demo",
"platform": "instagram_reels",
"template": "product_demo",
"subtitle_format": "ass",
"auto_subtitles": True,
"audio_normalize": True,
"music_volume": 0.18,
"music_fade_in": 0.3,
"music_fade_out": 0.7,
"music_loop": True,
"music_ducking": True,
"normalize": True,
},
"capcut_cinematic_story": {
"creative_style": "cinematic_story",
"platform": "youtube_shorts",
"template": "cinematic_gold",
"subtitle_format": "ass",
"auto_subtitles": True,
"audio_normalize": True,
"music_volume": 0.26,
"music_fade_in": 0.8,
"music_fade_out": 1.4,
"music_loop": True,
"music_ducking": True,
"normalize": True,
},
}
def list_presets() -> list[str]:
return sorted(PRESETS)
def apply_preset(payload: dict[str, Any]) -> dict[str, Any]:
preset_name = payload.get("preset")
if not preset_name:
return payload
preset = deepcopy(PRESETS.get(preset_name, {}))
preset.update(payload)
if "metadata" in PRESETS.get(preset_name, {}) or "metadata" in payload:
metadata = deepcopy(PRESETS.get(preset_name, {}).get("metadata", {}))
metadata.update(payload.get("metadata", {}))
preset["metadata"] = metadata
return preset
|