V3 Phase 4: multi-platform export + caption generator + font presets#13
Merged
Conversation
…presets scripts/multi_export.py Three platform presets (xhs 3:4 1080×1440, douyin 9:16, wxch ≤60s). Smart aspect filter: scale when ratios match, centre-crop top/bottom when source is taller than target, centre-crop sides when wider. -movflags +faststart on every output. wxch auto-truncates at 60s. scripts/generate_caption.py Rule-based caption (note body) generator. No LLM dep. - TF-IDF-ish keyword extraction (stopword-filtered) - Title ≤18 chars, surfaces 2 keywords in front 18 chars - Body 200-500 chars with emoji every ~60 chars from 8-emoji palette - 3-6 # tags from keywords (mix垂类+长尾, no pure hot-tag spam) - Publish-time hint sourced from audience profile - All output passes through the content guard scripts/profiles/_fonts.yaml Five title-font presets: tech_ai (Smiley Sans), data_review (阿里妈 妈数黑体), warm_lifestyle (阿里妈妈方圆体), business_serious (思源 Heavy), food_youth (奶酪体). Underscore prefix so list_profiles() doesn't enumerate it as an audience profile. scripts/profiles/__init__.py - load_profile() / list_profiles() skip underscore-prefixed files - load_fonts_preset() resolves a font intent to a primary + fallbacks Tests: +21 (10 multi-export aspect/cmd, 10 caption synthesis + guard integration, 1 font preset). Full suite: 130 passing.
5 tasks
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes part of #10.
What this PR adds
multi_export.pygenerate_caption.pyprofiles/_fonts.yamlmulti_export.py
Smart aspect filter selects between scale-only, centre-crop top/bottom, or centre-crop sides depending on source vs target ratio.
-movflags +faststarton every output.wxchpreset auto-truncates at 60s for 视频号 social-graph distribution.generate_caption.py
No LLM dependency — pure rule-based. TF-IDF keyword extraction (with CJK stopwords), title synthesis from hook or top keywords, emoji-paced body, tag generation that mixes 垂类 + 长尾 (avoids the pure-hot-tag spam pattern that flags搬运).
Output is run through
content_guard.enforce()so any caption that trips a hard rule (diversion, extreme words, medical claims, wealth bait) is rejected at generation time.Tests
+21 new (multi_export aspect/cmd build, caption synthesis + guard integration, font preset). Full suite: 130 passing.
Test plan
pytest tests/greenpython3 scripts/generate_caption.py --script day58/work/clean_script.md --profile tech_proreturns a sensible title + 200-500 char bodypython3 scripts/multi_export.py <in.mp4> --output-dir /tmp/out --platforms xhs douyin wxch --dry-runprints three ffmpeg invocations