feat(ssulbox): 썰박스 생성 파이프라인 통합 및 콘텐츠 목록 UNION

This commit is contained in:
skkim committed 2026-08-11 11:03:03 +09:00
1 parent 8096837b13
commit 666c3bf6d1
77 files changed
+15912 -349

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
[캐릭터 공식 레퍼런스 폴더 — '눈만 고정']
이 폴더에 고양이 왕 기준 이미지를 1장 넣어두면(예: king_ref.png),
모든 쇼츠 영상의 고양이 왕이 '그 눈과 표정'을 그대로 따라갑니다.
- 고정되는 것 : 눈 모양 / 눈동자 / 표정 (귀여운 순한 눈으로 통일)
- 고정 안 됨 : 곤룡포 색, 관모, 포즈, 배경 → 왕별 character_sheet / 장면 프롬프트대로
(즉 광해군·순종 등 왕마다 복장은 다르게 나옴)
- 파일명은 자유 (폴더 안 '첫 번째' 이미지 파일을 사용. png/jpg/jpeg/webp)
- 한 장만 두는 걸 권장 (여러 장이면 정렬상 첫 파일만 사용)
- 빼고 싶으면 이미지를 폴더 밖으로 빼거나 폴더를 비우면 됨
→ 그럼 예전처럼 영상마다 캐릭터를 새로 그림(눈은 EYE_STYLE 텍스트 지시로 귀엽게 유지)
연결 코드: make_short.py 의 load_char_ref() / CHAR_REF_DIR / gen_image(ref_mode="eyes")
Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

@@ -0,0 +1,394 @@
대수,왕,문서제목,썰후보여부,키워드,URL
1,태조,태조(조선),,태조(조선),https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,개요,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,생애,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),Y,이름,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,묘호(廟號)와 시호(諡號),https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,휘(諱),https://namu.wiki/w/태조(조선)
1,태조,태조(조선),Y,가족 관계,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,사용한 무구,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,어궁구,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,전어도,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,화살보다 빠른 말,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,팔준마,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,직접 쓴 글과 시,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),Y,평가,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,어진,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),Y,여담,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),Y,대중매체,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,관련 문서,https://namu.wiki/w/태조(조선)
1,태조,태조(조선),,둘러보기,https://namu.wiki/w/태조(조선)
2,정종,정종(조선),,정종(조선),https://namu.wiki/w/정종(조선)
2,정종,정종(조선),,개요,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),,생애,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),Y,가족 관계,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),,선대 가계,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),,배우자 / 자녀,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),Y,평가,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),Y,여담,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),,정종 무인정사 배후설?,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),Y,대중매체,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),,관련 문서,https://namu.wiki/w/정종(조선)
2,정종,정종(조선),,둘러보기,https://namu.wiki/w/정종(조선)
3,태종,태종(조선),,태종(조선),https://namu.wiki/w/태종(조선)
3,태종,태종(조선),,개요,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),,묘호와 시호,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),Y,이름과 작위,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),,생애,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),Y,평가,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),Y,일화,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),,직접 쓴 글과 시,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),Y,기타,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),Y,가족 관계,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),Y,대중매체,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),,관련 문서,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),,외부 링크,https://namu.wiki/w/태종(조선)
3,태종,태종(조선),,둘러보기,https://namu.wiki/w/태종(조선)
4,세종,세종(조선),,세종(조선),https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,개요,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,생애,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),Y,업적,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),Y,비판과 반론,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),Y,특이한 기록들,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,가계,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,조상,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,배우자 / 자녀,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,영릉,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,어진,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),Y,대중매체,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,직접 쓴 글과 시,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),Y,여담,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),Y,어록,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,관련 단체,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,관련 문서,https://namu.wiki/w/세종(조선)
4,세종,세종(조선),,둘러보기,https://namu.wiki/w/세종(조선)
5,문종,문종(조선),,문종(조선),https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,개요,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,생애,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),Y,평가,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,가계,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,조상,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,배우자 / 자녀,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,직접 쓴 글과 시,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),Y,기타,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),Y,대중매체,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,드라마,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,영화,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,소설,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,게임,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,관련 문서,https://namu.wiki/w/문종(조선)
5,문종,문종(조선),,둘러보기,https://namu.wiki/w/문종(조선)
6,단종,단종(조선),,단종(조선),https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,개요,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,휘,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,생애,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),Y,평가,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),Y,가족관계,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,조상,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,형제자매,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,배우자,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,직접 쓴 글과 시,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,어진,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),Y,대중매체,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,만화,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,연극,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,영화,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,드라마,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,다큐멘터리,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,TV조선왕조실록,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,고운님 여의옵고,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,EBS 특집 다큐멘터리,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,MBC 다큐프라임,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,역사스페셜 시간여행자,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,소설,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),Y,여담,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,관련 문서,https://namu.wiki/w/단종(조선)
6,단종,단종(조선),,둘러보기,https://namu.wiki/w/단종(조선)
7,세조,세조(조선),,세조(조선),https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,개요,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,생애,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),Y,평가,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,어진,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,어필,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,수결(서명),https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,직접 쓴 글과 시,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,가계,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,조상,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,배우자 / 자녀,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),Y,대중매체,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),Y,여담,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,관련 유물,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,관련 문서,https://namu.wiki/w/세조(조선)
7,세조,세조(조선),,둘러보기,https://namu.wiki/w/세조(조선)
8,예종,예종(조선),,예종(조선),https://namu.wiki/w/예종(조선)
8,예종,예종(조선),,개요,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),,생애,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),,직접 쓴 글과 시,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),Y,평가,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),,가계,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),,조상,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),,배우자 / 자녀,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),Y,기타,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),Y,대중매체,https://namu.wiki/w/예종(조선)
8,예종,예종(조선),,둘러보기,https://namu.wiki/w/예종(조선)
9,성종,성종(조선),,성종(조선),https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,개요,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,생애,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,가계,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,조상,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,배우자 / 자녀,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),Y,평가,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),Y,기타,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),Y,대중매체,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,영화,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,드라마,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,관련 문서,https://namu.wiki/w/성종(조선)
9,성종,성종(조선),,둘러보기,https://namu.wiki/w/성종(조선)
10,연산군,연산군,,연산군,https://namu.wiki/w/연산군
10,연산군,연산군,,개요,https://namu.wiki/w/연산군
10,연산군,연산군,,생애,https://namu.wiki/w/연산군
10,연산군,연산군,Y,여담,https://namu.wiki/w/연산군
10,연산군,연산군,,가계,https://namu.wiki/w/연산군
10,연산군,연산군,,조상,https://namu.wiki/w/연산군
10,연산군,연산군,,배우자/자녀,https://namu.wiki/w/연산군
10,연산군,연산군,Y,평가,https://namu.wiki/w/연산군
10,연산군,연산군,Y,대중매체,https://namu.wiki/w/연산군
10,연산군,연산군,,관련 문서,https://namu.wiki/w/연산군
10,연산군,연산군,,둘러보기,https://namu.wiki/w/연산군
11,중종,중종(조선),,중종(조선),https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,개요,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,생애,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),Y,평가,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),Y,기타,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,가계,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,조상,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,배우자 / 자녀,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),Y,대중매체,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,드라마,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,영화,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,관련 문서,https://namu.wiki/w/중종(조선)
11,중종,중종(조선),,둘러보기,https://namu.wiki/w/중종(조선)
12,인종,인종(조선),,인종(조선),https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,개요,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,생애,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,가계,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,친가(전주 이씨),https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,조상,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,외가(파평 윤씨),https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,처가(반남 박씨),https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,배우자 / 자녀,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),Y,기타,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),Y,대중매체,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,만화,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,영화,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,드라마,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,소설,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,관련 문서,https://namu.wiki/w/인종(조선)
12,인종,인종(조선),,둘러보기,https://namu.wiki/w/인종(조선)
13,명종,명종(조선),,명종(조선),https://namu.wiki/w/명종(조선)
13,명종,명종(조선),,개요,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),,생애,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),,가계,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),,조상,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),,배우자 / 자녀,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),Y,평가,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),Y,기타,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),Y,대중매체,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),,관련 문서,https://namu.wiki/w/명종(조선)
13,명종,명종(조선),,둘러보기,https://namu.wiki/w/명종(조선)
14,선조,선조(조선),,선조(조선),https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,개요,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,생애,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),Y,평가,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),Y,가족 관계,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,조상,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,배우자/자녀,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),Y,기타,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,어진(御眞),https://namu.wiki/w/선조(조선)
14,선조,선조(조선),Y,대중매체,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,소설,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,만화,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,게임,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,영화,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,드라마,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,교양·다큐멘터리,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,관련 문서,https://namu.wiki/w/선조(조선)
14,선조,선조(조선),,둘러보기,https://namu.wiki/w/선조(조선)
15,광해군,광해군,,광해군,https://namu.wiki/w/광해군
15,광해군,광해군,,개요,https://namu.wiki/w/광해군
15,광해군,광해군,,생애,https://namu.wiki/w/광해군
15,광해군,광해군,Y,평가,https://namu.wiki/w/광해군
15,광해군,광해군,Y,여담,https://namu.wiki/w/광해군
15,광해군,광해군,Y,가족 관계,https://namu.wiki/w/광해군
15,광해군,광해군,,조상,https://namu.wiki/w/광해군
15,광해군,광해군,,배우자/자녀,https://namu.wiki/w/광해군
15,광해군,광해군,,광해군묘,https://namu.wiki/w/광해군
15,광해군,광해군,Y,대중매체,https://namu.wiki/w/광해군
15,광해군,광해군,,관련 다큐,https://namu.wiki/w/광해군
15,광해군,광해군,,한국사 傳,https://namu.wiki/w/광해군
15,광해군,광해군,,역사스페셜,https://namu.wiki/w/광해군
15,광해군,광해군,,역사스페셜 시간여행자,https://namu.wiki/w/광해군
15,광해군,광해군,,같이 보기,https://namu.wiki/w/광해군
15,광해군,광해군,,둘러보기,https://namu.wiki/w/광해군
17,효종,효종(조선),,효종(조선),https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,개요,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,생애,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,즉위 과정,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,북벌 준비와 군비 확장,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),Y,사망 징조와 죽음,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,후일담,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),Y,평가,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,북벌론,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,정통성에 대한 태도,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),Y,기타,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),Y,가족,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,조상,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,배우자/자녀,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),Y,대중매체,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,드라마,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,영화,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,관련 문서,https://namu.wiki/w/효종(조선)
17,효종,효종(조선),,둘러보기,https://namu.wiki/w/효종(조선)
18,현종,현종(조선),,현종(조선),https://namu.wiki/w/현종(조선)
18,현종,현종(조선),,개요,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),,생애,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),Y,평가,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),Y,기타,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),,가계,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),,조상,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),,배우자 / 자녀,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),Y,대중매체,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),,관련 문서,https://namu.wiki/w/현종(조선)
18,현종,현종(조선),,둘러보기,https://namu.wiki/w/현종(조선)
19,숙종,숙종(조선),,숙종(조선),https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,개요,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,생애,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,가계,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,조상,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,배우자 / 자녀,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),Y,여담,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,"금덕, 금손, 애묘인",https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,어진,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,직접 쓴 글과 시,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),Y,평가,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),Y,긍정적 평가,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),Y,부정적 평가,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),Y,대중매체,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,영화,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,드라마,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,소설,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,관련 문서,https://namu.wiki/w/숙종(조선)
19,숙종,숙종(조선),,둘러보기,https://namu.wiki/w/숙종(조선)
20,경종,경종(조선),,경종(조선),https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,개요,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,생애,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,조상,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),Y,여담,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,불임 의혹,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,이복동생 연잉군과의 관계,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),Y,대중매체,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,영화,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,드라마,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,소설,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,뮤지컬,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),Y,기타,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,관련 문서,https://namu.wiki/w/경종(조선)
20,경종,경종(조선),,둘러보기,https://namu.wiki/w/경종(조선)
22,정조,정조(조선),,정조(조선),https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,개요,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,생애,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),Y,업적과 정책,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,"묘호, 시호, 휘",https://namu.wiki/w/정조(조선)
22,정조,정조(조선),Y,평가,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,가계,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,조상,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,어진,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),Y,기타,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,엄친아,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),Y,유성한 사건,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),Y,의빈 성씨와의 일화,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,술과 담배 사랑,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,정조의 비밀 편지들,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,과인은 사도세자의 아들이다?,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),Y,대중매체,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,관련 문서,https://namu.wiki/w/정조(조선)
22,정조,정조(조선),,둘러보기,https://namu.wiki/w/정조(조선)
23,순조,순조,,순조,https://namu.wiki/w/순조
23,순조,순조,,개요,https://namu.wiki/w/순조
23,순조,순조,,생애,https://namu.wiki/w/순조
23,순조,순조,Y,평가,https://namu.wiki/w/순조
23,순조,순조,,묘호와 시호,https://namu.wiki/w/순조
23,순조,순조,,어진,https://namu.wiki/w/순조
23,순조,순조,Y,기타,https://namu.wiki/w/순조
23,순조,순조,,가계,https://namu.wiki/w/순조
23,순조,순조,,조상,https://namu.wiki/w/순조
23,순조,순조,,형제자매,https://namu.wiki/w/순조
23,순조,순조,,배우자/자녀,https://namu.wiki/w/순조
23,순조,순조,Y,대중매체,https://namu.wiki/w/순조
23,순조,순조,,관련 문서,https://namu.wiki/w/순조
23,순조,순조,,둘러보기,https://namu.wiki/w/순조
24,헌종,헌종(조선),,헌종(조선),https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,개요,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,생애,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),Y,평가,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,가계,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,조상,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,친가(전주 이씨),https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,외가(풍양 조씨),https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,처가,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,안동 김씨,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,남양 홍씨,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,배우자 / 자녀,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,어진,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),Y,여담,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),Y,대중매체,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,관련 문서,https://namu.wiki/w/헌종(조선)
24,헌종,헌종(조선),,둘러보기,https://namu.wiki/w/헌종(조선)
25,철종,철종(조선),,철종(조선),https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,개요,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,생애,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),Y,평가,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,어진,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,외부 링크,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,보물 (舊 보물 제1492호),https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,가계,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,조상,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,친가(전주 이씨),https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,외가(용담 염씨),https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,처가(안동 김씨),https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,배우자 / 자녀,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),Y,여담,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),Y,대중매체,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,소설,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,영화,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,드라마,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,만화,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,게임,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,관련 문서,https://namu.wiki/w/철종(조선)
25,철종,철종(조선),,둘러보기,https://namu.wiki/w/철종(조선)
26,고종,고종(대한제국),,고종(대한제국),https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,개요,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,호칭,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,즉위 배경,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,생애,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),Y,평가,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,청과의 영토 분쟁,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),Y,가족 관계,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,조상,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),Y,"사진과 어진, 기타 그림",https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,사진,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,어진,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),Y,기타 그림,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),Y,여담,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),Y,대중매체,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,관련 문서,https://namu.wiki/w/고종(대한제국)
26,고종,고종(대한제국),,둘러보기,https://namu.wiki/w/고종(대한제국)
27,순종,순종(대한제국),,순종(대한제국),https://namu.wiki/w/순종(대한제국)
27,순종,순종(대한제국),,개요,https://namu.wiki/w/순종(대한제국)
27,순종,순종(대한제국),,생애,https://namu.wiki/w/순종(대한제국)
27,순종,순종(대한제국),Y,평가,https://namu.wiki/w/순종(대한제국)
27,순종,순종(대한제국),,어진,https://namu.wiki/w/순종(대한제국)
27,순종,순종(대한제국),Y,기타,https://namu.wiki/w/순종(대한제국)
27,순종,순종(대한제국),Y,대중매체,https://namu.wiki/w/순종(대한제국)
27,순종,순종(대한제국),,관련 문서,https://namu.wiki/w/순종(대한제국)
27,순종,순종(대한제국),,둘러보기,https://namu.wiki/w/순종(대한제국)
1 대수 왕 문서제목 썰후보여부 키워드 URL
2 1 태조 태조(조선) 태조(조선) https://namu.wiki/w/태조(조선)
3 1 태조 태조(조선) 개요 https://namu.wiki/w/태조(조선)
4 1 태조 태조(조선) 생애 https://namu.wiki/w/태조(조선)
5 1 태조 태조(조선) Y 이름 https://namu.wiki/w/태조(조선)
6 1 태조 태조(조선) 묘호(廟號)와 시호(諡號) https://namu.wiki/w/태조(조선)
7 1 태조 태조(조선) 휘(諱) https://namu.wiki/w/태조(조선)
8 1 태조 태조(조선) Y 가족 관계 https://namu.wiki/w/태조(조선)
9 1 태조 태조(조선) 사용한 무구 https://namu.wiki/w/태조(조선)
10 1 태조 태조(조선) 어궁구 https://namu.wiki/w/태조(조선)
11 1 태조 태조(조선) 전어도 https://namu.wiki/w/태조(조선)
12 1 태조 태조(조선) 화살보다 빠른 말 https://namu.wiki/w/태조(조선)
13 1 태조 태조(조선) 팔준마 https://namu.wiki/w/태조(조선)
14 1 태조 태조(조선) 직접 쓴 글과 시 https://namu.wiki/w/태조(조선)
15 1 태조 태조(조선) Y 평가 https://namu.wiki/w/태조(조선)
16 1 태조 태조(조선) 어진 https://namu.wiki/w/태조(조선)
17 1 태조 태조(조선) Y 여담 https://namu.wiki/w/태조(조선)
18 1 태조 태조(조선) Y 대중매체 https://namu.wiki/w/태조(조선)
19 1 태조 태조(조선) 관련 문서 https://namu.wiki/w/태조(조선)
20 1 태조 태조(조선) 둘러보기 https://namu.wiki/w/태조(조선)
21 2 정종 정종(조선) 정종(조선) https://namu.wiki/w/정종(조선)
22 2 정종 정종(조선) 개요 https://namu.wiki/w/정종(조선)
23 2 정종 정종(조선) 생애 https://namu.wiki/w/정종(조선)
24 2 정종 정종(조선) Y 가족 관계 https://namu.wiki/w/정종(조선)
25 2 정종 정종(조선) 선대 가계 https://namu.wiki/w/정종(조선)
26 2 정종 정종(조선) 배우자 / 자녀 https://namu.wiki/w/정종(조선)
27 2 정종 정종(조선) Y 평가 https://namu.wiki/w/정종(조선)
28 2 정종 정종(조선) Y 여담 https://namu.wiki/w/정종(조선)
29 2 정종 정종(조선) 정종 무인정사 배후설? https://namu.wiki/w/정종(조선)
30 2 정종 정종(조선) Y 대중매체 https://namu.wiki/w/정종(조선)
31 2 정종 정종(조선) 관련 문서 https://namu.wiki/w/정종(조선)
32 2 정종 정종(조선) 둘러보기 https://namu.wiki/w/정종(조선)
33 3 태종 태종(조선) 태종(조선) https://namu.wiki/w/태종(조선)
34 3 태종 태종(조선) 개요 https://namu.wiki/w/태종(조선)
35 3 태종 태종(조선) 묘호와 시호 https://namu.wiki/w/태종(조선)
36 3 태종 태종(조선) Y 이름과 작위 https://namu.wiki/w/태종(조선)
37 3 태종 태종(조선) 생애 https://namu.wiki/w/태종(조선)
38 3 태종 태종(조선) Y 평가 https://namu.wiki/w/태종(조선)
39 3 태종 태종(조선) Y 일화 https://namu.wiki/w/태종(조선)
40 3 태종 태종(조선) 직접 쓴 글과 시 https://namu.wiki/w/태종(조선)
41 3 태종 태종(조선) Y 기타 https://namu.wiki/w/태종(조선)
42 3 태종 태종(조선) Y 가족 관계 https://namu.wiki/w/태종(조선)
43 3 태종 태종(조선) Y 대중매체 https://namu.wiki/w/태종(조선)
44 3 태종 태종(조선) 관련 문서 https://namu.wiki/w/태종(조선)
45 3 태종 태종(조선) 외부 링크 https://namu.wiki/w/태종(조선)
46 3 태종 태종(조선) 둘러보기 https://namu.wiki/w/태종(조선)
47 4 세종 세종(조선) 세종(조선) https://namu.wiki/w/세종(조선)
48 4 세종 세종(조선) 개요 https://namu.wiki/w/세종(조선)
49 4 세종 세종(조선) 생애 https://namu.wiki/w/세종(조선)
50 4 세종 세종(조선) Y 업적 https://namu.wiki/w/세종(조선)
51 4 세종 세종(조선) Y 비판과 반론 https://namu.wiki/w/세종(조선)
52 4 세종 세종(조선) Y 특이한 기록들 https://namu.wiki/w/세종(조선)
53 4 세종 세종(조선) 가계 https://namu.wiki/w/세종(조선)
54 4 세종 세종(조선) 조상 https://namu.wiki/w/세종(조선)
55 4 세종 세종(조선) 배우자 / 자녀 https://namu.wiki/w/세종(조선)
56 4 세종 세종(조선) 영릉 https://namu.wiki/w/세종(조선)
57 4 세종 세종(조선) 어진 https://namu.wiki/w/세종(조선)
58 4 세종 세종(조선) Y 대중매체 https://namu.wiki/w/세종(조선)
59 4 세종 세종(조선) 직접 쓴 글과 시 https://namu.wiki/w/세종(조선)
60 4 세종 세종(조선) Y 여담 https://namu.wiki/w/세종(조선)
61 4 세종 세종(조선) Y 어록 https://namu.wiki/w/세종(조선)
62 4 세종 세종(조선) 관련 단체 https://namu.wiki/w/세종(조선)
63 4 세종 세종(조선) 관련 문서 https://namu.wiki/w/세종(조선)
64 4 세종 세종(조선) 둘러보기 https://namu.wiki/w/세종(조선)
65 5 문종 문종(조선) 문종(조선) https://namu.wiki/w/문종(조선)
66 5 문종 문종(조선) 개요 https://namu.wiki/w/문종(조선)
67 5 문종 문종(조선) 생애 https://namu.wiki/w/문종(조선)
68 5 문종 문종(조선) Y 평가 https://namu.wiki/w/문종(조선)
69 5 문종 문종(조선) 가계 https://namu.wiki/w/문종(조선)
70 5 문종 문종(조선) 조상 https://namu.wiki/w/문종(조선)
71 5 문종 문종(조선) 배우자 / 자녀 https://namu.wiki/w/문종(조선)
72 5 문종 문종(조선) 직접 쓴 글과 시 https://namu.wiki/w/문종(조선)
73 5 문종 문종(조선) Y 기타 https://namu.wiki/w/문종(조선)
74 5 문종 문종(조선) Y 대중매체 https://namu.wiki/w/문종(조선)
75 5 문종 문종(조선) 드라마 https://namu.wiki/w/문종(조선)
76 5 문종 문종(조선) 영화 https://namu.wiki/w/문종(조선)
77 5 문종 문종(조선) 소설 https://namu.wiki/w/문종(조선)
78 5 문종 문종(조선) 게임 https://namu.wiki/w/문종(조선)
79 5 문종 문종(조선) 관련 문서 https://namu.wiki/w/문종(조선)
80 5 문종 문종(조선) 둘러보기 https://namu.wiki/w/문종(조선)
81 6 단종 단종(조선) 단종(조선) https://namu.wiki/w/단종(조선)
82 6 단종 단종(조선) 개요 https://namu.wiki/w/단종(조선)
83 6 단종 단종(조선) 휘 https://namu.wiki/w/단종(조선)
84 6 단종 단종(조선) 생애 https://namu.wiki/w/단종(조선)
85 6 단종 단종(조선) Y 평가 https://namu.wiki/w/단종(조선)
86 6 단종 단종(조선) Y 가족관계 https://namu.wiki/w/단종(조선)
87 6 단종 단종(조선) 조상 https://namu.wiki/w/단종(조선)
88 6 단종 단종(조선) 형제자매 https://namu.wiki/w/단종(조선)
89 6 단종 단종(조선) 배우자 https://namu.wiki/w/단종(조선)
90 6 단종 단종(조선) 직접 쓴 글과 시 https://namu.wiki/w/단종(조선)
91 6 단종 단종(조선) 어진 https://namu.wiki/w/단종(조선)
92 6 단종 단종(조선) Y 대중매체 https://namu.wiki/w/단종(조선)
93 6 단종 단종(조선) 만화 https://namu.wiki/w/단종(조선)
94 6 단종 단종(조선) 연극 https://namu.wiki/w/단종(조선)
95 6 단종 단종(조선) 영화 https://namu.wiki/w/단종(조선)
96 6 단종 단종(조선) 드라마 https://namu.wiki/w/단종(조선)
97 6 단종 단종(조선) 다큐멘터리 https://namu.wiki/w/단종(조선)
98 6 단종 단종(조선) TV조선왕조실록 https://namu.wiki/w/단종(조선)
99 6 단종 단종(조선) 고운님 여의옵고 https://namu.wiki/w/단종(조선)
100 6 단종 단종(조선) EBS 특집 다큐멘터리 https://namu.wiki/w/단종(조선)
101 6 단종 단종(조선) MBC 다큐프라임 https://namu.wiki/w/단종(조선)
102 6 단종 단종(조선) 역사스페셜 시간여행자 https://namu.wiki/w/단종(조선)
103 6 단종 단종(조선) 소설 https://namu.wiki/w/단종(조선)
104 6 단종 단종(조선) Y 여담 https://namu.wiki/w/단종(조선)
105 6 단종 단종(조선) 관련 문서 https://namu.wiki/w/단종(조선)
106 6 단종 단종(조선) 둘러보기 https://namu.wiki/w/단종(조선)
107 7 세조 세조(조선) 세조(조선) https://namu.wiki/w/세조(조선)
108 7 세조 세조(조선) 개요 https://namu.wiki/w/세조(조선)
109 7 세조 세조(조선) 생애 https://namu.wiki/w/세조(조선)
110 7 세조 세조(조선) Y 평가 https://namu.wiki/w/세조(조선)
111 7 세조 세조(조선) 어진 https://namu.wiki/w/세조(조선)
112 7 세조 세조(조선) 어필 https://namu.wiki/w/세조(조선)
113 7 세조 세조(조선) 수결(서명) https://namu.wiki/w/세조(조선)
114 7 세조 세조(조선) 직접 쓴 글과 시 https://namu.wiki/w/세조(조선)
115 7 세조 세조(조선) 가계 https://namu.wiki/w/세조(조선)
116 7 세조 세조(조선) 조상 https://namu.wiki/w/세조(조선)
117 7 세조 세조(조선) 배우자 / 자녀 https://namu.wiki/w/세조(조선)
118 7 세조 세조(조선) Y 대중매체 https://namu.wiki/w/세조(조선)
119 7 세조 세조(조선) Y 여담 https://namu.wiki/w/세조(조선)
120 7 세조 세조(조선) 관련 유물 https://namu.wiki/w/세조(조선)
121 7 세조 세조(조선) 관련 문서 https://namu.wiki/w/세조(조선)
122 7 세조 세조(조선) 둘러보기 https://namu.wiki/w/세조(조선)
123 8 예종 예종(조선) 예종(조선) https://namu.wiki/w/예종(조선)
124 8 예종 예종(조선) 개요 https://namu.wiki/w/예종(조선)
125 8 예종 예종(조선) 생애 https://namu.wiki/w/예종(조선)
126 8 예종 예종(조선) 직접 쓴 글과 시 https://namu.wiki/w/예종(조선)
127 8 예종 예종(조선) Y 평가 https://namu.wiki/w/예종(조선)
128 8 예종 예종(조선) 가계 https://namu.wiki/w/예종(조선)
129 8 예종 예종(조선) 조상 https://namu.wiki/w/예종(조선)
130 8 예종 예종(조선) 배우자 / 자녀 https://namu.wiki/w/예종(조선)
131 8 예종 예종(조선) Y 기타 https://namu.wiki/w/예종(조선)
132 8 예종 예종(조선) Y 대중매체 https://namu.wiki/w/예종(조선)
133 8 예종 예종(조선) 둘러보기 https://namu.wiki/w/예종(조선)
134 9 성종 성종(조선) 성종(조선) https://namu.wiki/w/성종(조선)
135 9 성종 성종(조선) 개요 https://namu.wiki/w/성종(조선)
136 9 성종 성종(조선) 생애 https://namu.wiki/w/성종(조선)
137 9 성종 성종(조선) 가계 https://namu.wiki/w/성종(조선)
138 9 성종 성종(조선) 조상 https://namu.wiki/w/성종(조선)
139 9 성종 성종(조선) 배우자 / 자녀 https://namu.wiki/w/성종(조선)
140 9 성종 성종(조선) Y 평가 https://namu.wiki/w/성종(조선)
141 9 성종 성종(조선) Y 기타 https://namu.wiki/w/성종(조선)
142 9 성종 성종(조선) Y 대중매체 https://namu.wiki/w/성종(조선)
143 9 성종 성종(조선) 영화 https://namu.wiki/w/성종(조선)
144 9 성종 성종(조선) 드라마 https://namu.wiki/w/성종(조선)
145 9 성종 성종(조선) 관련 문서 https://namu.wiki/w/성종(조선)
146 9 성종 성종(조선) 둘러보기 https://namu.wiki/w/성종(조선)
147 10 연산군 연산군 연산군 https://namu.wiki/w/연산군
148 10 연산군 연산군 개요 https://namu.wiki/w/연산군
149 10 연산군 연산군 생애 https://namu.wiki/w/연산군
150 10 연산군 연산군 Y 여담 https://namu.wiki/w/연산군
151 10 연산군 연산군 가계 https://namu.wiki/w/연산군
152 10 연산군 연산군 조상 https://namu.wiki/w/연산군
153 10 연산군 연산군 배우자/자녀 https://namu.wiki/w/연산군
154 10 연산군 연산군 Y 평가 https://namu.wiki/w/연산군
155 10 연산군 연산군 Y 대중매체 https://namu.wiki/w/연산군
156 10 연산군 연산군 관련 문서 https://namu.wiki/w/연산군
157 10 연산군 연산군 둘러보기 https://namu.wiki/w/연산군
158 11 중종 중종(조선) 중종(조선) https://namu.wiki/w/중종(조선)
159 11 중종 중종(조선) 개요 https://namu.wiki/w/중종(조선)
160 11 중종 중종(조선) 생애 https://namu.wiki/w/중종(조선)
161 11 중종 중종(조선) Y 평가 https://namu.wiki/w/중종(조선)
162 11 중종 중종(조선) Y 기타 https://namu.wiki/w/중종(조선)
163 11 중종 중종(조선) 가계 https://namu.wiki/w/중종(조선)
164 11 중종 중종(조선) 조상 https://namu.wiki/w/중종(조선)
165 11 중종 중종(조선) 배우자 / 자녀 https://namu.wiki/w/중종(조선)
166 11 중종 중종(조선) Y 대중매체 https://namu.wiki/w/중종(조선)
167 11 중종 중종(조선) 드라마 https://namu.wiki/w/중종(조선)
168 11 중종 중종(조선) 영화 https://namu.wiki/w/중종(조선)
169 11 중종 중종(조선) 관련 문서 https://namu.wiki/w/중종(조선)
170 11 중종 중종(조선) 둘러보기 https://namu.wiki/w/중종(조선)
171 12 인종 인종(조선) 인종(조선) https://namu.wiki/w/인종(조선)
172 12 인종 인종(조선) 개요 https://namu.wiki/w/인종(조선)
173 12 인종 인종(조선) 생애 https://namu.wiki/w/인종(조선)
174 12 인종 인종(조선) 가계 https://namu.wiki/w/인종(조선)
175 12 인종 인종(조선) 친가(전주 이씨) https://namu.wiki/w/인종(조선)
176 12 인종 인종(조선) 조상 https://namu.wiki/w/인종(조선)
177 12 인종 인종(조선) 외가(파평 윤씨) https://namu.wiki/w/인종(조선)
178 12 인종 인종(조선) 처가(반남 박씨) https://namu.wiki/w/인종(조선)
179 12 인종 인종(조선) 배우자 / 자녀 https://namu.wiki/w/인종(조선)
180 12 인종 인종(조선) Y 기타 https://namu.wiki/w/인종(조선)
181 12 인종 인종(조선) Y 대중매체 https://namu.wiki/w/인종(조선)
182 12 인종 인종(조선) 만화 https://namu.wiki/w/인종(조선)
183 12 인종 인종(조선) 영화 https://namu.wiki/w/인종(조선)
184 12 인종 인종(조선) 드라마 https://namu.wiki/w/인종(조선)
185 12 인종 인종(조선) 소설 https://namu.wiki/w/인종(조선)
186 12 인종 인종(조선) 관련 문서 https://namu.wiki/w/인종(조선)
187 12 인종 인종(조선) 둘러보기 https://namu.wiki/w/인종(조선)
188 13 명종 명종(조선) 명종(조선) https://namu.wiki/w/명종(조선)
189 13 명종 명종(조선) 개요 https://namu.wiki/w/명종(조선)
190 13 명종 명종(조선) 생애 https://namu.wiki/w/명종(조선)
191 13 명종 명종(조선) 가계 https://namu.wiki/w/명종(조선)
192 13 명종 명종(조선) 조상 https://namu.wiki/w/명종(조선)
193 13 명종 명종(조선) 배우자 / 자녀 https://namu.wiki/w/명종(조선)
194 13 명종 명종(조선) Y 평가 https://namu.wiki/w/명종(조선)
195 13 명종 명종(조선) Y 기타 https://namu.wiki/w/명종(조선)
196 13 명종 명종(조선) Y 대중매체 https://namu.wiki/w/명종(조선)
197 13 명종 명종(조선) 관련 문서 https://namu.wiki/w/명종(조선)
198 13 명종 명종(조선) 둘러보기 https://namu.wiki/w/명종(조선)
199 14 선조 선조(조선) 선조(조선) https://namu.wiki/w/선조(조선)
200 14 선조 선조(조선) 개요 https://namu.wiki/w/선조(조선)
201 14 선조 선조(조선) 생애 https://namu.wiki/w/선조(조선)
202 14 선조 선조(조선) Y 평가 https://namu.wiki/w/선조(조선)
203 14 선조 선조(조선) Y 가족 관계 https://namu.wiki/w/선조(조선)
204 14 선조 선조(조선) 조상 https://namu.wiki/w/선조(조선)
205 14 선조 선조(조선) 배우자/자녀 https://namu.wiki/w/선조(조선)
206 14 선조 선조(조선) Y 기타 https://namu.wiki/w/선조(조선)
207 14 선조 선조(조선) 어진(御眞) https://namu.wiki/w/선조(조선)
208 14 선조 선조(조선) Y 대중매체 https://namu.wiki/w/선조(조선)
209 14 선조 선조(조선) 소설 https://namu.wiki/w/선조(조선)
210 14 선조 선조(조선) 만화 https://namu.wiki/w/선조(조선)
211 14 선조 선조(조선) 게임 https://namu.wiki/w/선조(조선)
212 14 선조 선조(조선) 영화 https://namu.wiki/w/선조(조선)
213 14 선조 선조(조선) 드라마 https://namu.wiki/w/선조(조선)
214 14 선조 선조(조선) 교양·다큐멘터리 https://namu.wiki/w/선조(조선)
215 14 선조 선조(조선) 관련 문서 https://namu.wiki/w/선조(조선)
216 14 선조 선조(조선) 둘러보기 https://namu.wiki/w/선조(조선)
217 15 광해군 광해군 광해군 https://namu.wiki/w/광해군
218 15 광해군 광해군 개요 https://namu.wiki/w/광해군
219 15 광해군 광해군 생애 https://namu.wiki/w/광해군
220 15 광해군 광해군 Y 평가 https://namu.wiki/w/광해군
221 15 광해군 광해군 Y 여담 https://namu.wiki/w/광해군
222 15 광해군 광해군 Y 가족 관계 https://namu.wiki/w/광해군
223 15 광해군 광해군 조상 https://namu.wiki/w/광해군
224 15 광해군 광해군 배우자/자녀 https://namu.wiki/w/광해군
225 15 광해군 광해군 광해군묘 https://namu.wiki/w/광해군
226 15 광해군 광해군 Y 대중매체 https://namu.wiki/w/광해군
227 15 광해군 광해군 관련 다큐 https://namu.wiki/w/광해군
228 15 광해군 광해군 한국사 傳 https://namu.wiki/w/광해군
229 15 광해군 광해군 역사스페셜 https://namu.wiki/w/광해군
230 15 광해군 광해군 역사스페셜 시간여행자 https://namu.wiki/w/광해군
231 15 광해군 광해군 같이 보기 https://namu.wiki/w/광해군
232 15 광해군 광해군 둘러보기 https://namu.wiki/w/광해군
233 17 효종 효종(조선) 효종(조선) https://namu.wiki/w/효종(조선)
234 17 효종 효종(조선) 개요 https://namu.wiki/w/효종(조선)
235 17 효종 효종(조선) 생애 https://namu.wiki/w/효종(조선)
236 17 효종 효종(조선) 즉위 과정 https://namu.wiki/w/효종(조선)
237 17 효종 효종(조선) 북벌 준비와 군비 확장 https://namu.wiki/w/효종(조선)
238 17 효종 효종(조선) Y 사망 징조와 죽음 https://namu.wiki/w/효종(조선)
239 17 효종 효종(조선) 후일담 https://namu.wiki/w/효종(조선)
240 17 효종 효종(조선) Y 평가 https://namu.wiki/w/효종(조선)
241 17 효종 효종(조선) 북벌론 https://namu.wiki/w/효종(조선)
242 17 효종 효종(조선) 정통성에 대한 태도 https://namu.wiki/w/효종(조선)
243 17 효종 효종(조선) Y 기타 https://namu.wiki/w/효종(조선)
244 17 효종 효종(조선) Y 가족 https://namu.wiki/w/효종(조선)
245 17 효종 효종(조선) 조상 https://namu.wiki/w/효종(조선)
246 17 효종 효종(조선) 배우자/자녀 https://namu.wiki/w/효종(조선)
247 17 효종 효종(조선) Y 대중매체 https://namu.wiki/w/효종(조선)
248 17 효종 효종(조선) 드라마 https://namu.wiki/w/효종(조선)
249 17 효종 효종(조선) 영화 https://namu.wiki/w/효종(조선)
250 17 효종 효종(조선) 관련 문서 https://namu.wiki/w/효종(조선)
251 17 효종 효종(조선) 둘러보기 https://namu.wiki/w/효종(조선)
252 18 현종 현종(조선) 현종(조선) https://namu.wiki/w/현종(조선)
253 18 현종 현종(조선) 개요 https://namu.wiki/w/현종(조선)
254 18 현종 현종(조선) 생애 https://namu.wiki/w/현종(조선)
255 18 현종 현종(조선) Y 평가 https://namu.wiki/w/현종(조선)
256 18 현종 현종(조선) Y 기타 https://namu.wiki/w/현종(조선)
257 18 현종 현종(조선) 가계 https://namu.wiki/w/현종(조선)
258 18 현종 현종(조선) 조상 https://namu.wiki/w/현종(조선)
259 18 현종 현종(조선) 배우자 / 자녀 https://namu.wiki/w/현종(조선)
260 18 현종 현종(조선) Y 대중매체 https://namu.wiki/w/현종(조선)
261 18 현종 현종(조선) 관련 문서 https://namu.wiki/w/현종(조선)
262 18 현종 현종(조선) 둘러보기 https://namu.wiki/w/현종(조선)
263 19 숙종 숙종(조선) 숙종(조선) https://namu.wiki/w/숙종(조선)
264 19 숙종 숙종(조선) 개요 https://namu.wiki/w/숙종(조선)
265 19 숙종 숙종(조선) 생애 https://namu.wiki/w/숙종(조선)
266 19 숙종 숙종(조선) 가계 https://namu.wiki/w/숙종(조선)
267 19 숙종 숙종(조선) 조상 https://namu.wiki/w/숙종(조선)
268 19 숙종 숙종(조선) 배우자 / 자녀 https://namu.wiki/w/숙종(조선)
269 19 숙종 숙종(조선) Y 여담 https://namu.wiki/w/숙종(조선)
270 19 숙종 숙종(조선) 금덕, 금손, 애묘인 https://namu.wiki/w/숙종(조선)
271 19 숙종 숙종(조선) 어진 https://namu.wiki/w/숙종(조선)
272 19 숙종 숙종(조선) 직접 쓴 글과 시 https://namu.wiki/w/숙종(조선)
273 19 숙종 숙종(조선) Y 평가 https://namu.wiki/w/숙종(조선)
274 19 숙종 숙종(조선) Y 긍정적 평가 https://namu.wiki/w/숙종(조선)
275 19 숙종 숙종(조선) Y 부정적 평가 https://namu.wiki/w/숙종(조선)
276 19 숙종 숙종(조선) Y 대중매체 https://namu.wiki/w/숙종(조선)
277 19 숙종 숙종(조선) 영화 https://namu.wiki/w/숙종(조선)
278 19 숙종 숙종(조선) 드라마 https://namu.wiki/w/숙종(조선)
279 19 숙종 숙종(조선) 소설 https://namu.wiki/w/숙종(조선)
280 19 숙종 숙종(조선) 관련 문서 https://namu.wiki/w/숙종(조선)
281 19 숙종 숙종(조선) 둘러보기 https://namu.wiki/w/숙종(조선)
282 20 경종 경종(조선) 경종(조선) https://namu.wiki/w/경종(조선)
283 20 경종 경종(조선) 개요 https://namu.wiki/w/경종(조선)
284 20 경종 경종(조선) 생애 https://namu.wiki/w/경종(조선)
285 20 경종 경종(조선) 조상 https://namu.wiki/w/경종(조선)
286 20 경종 경종(조선) Y 여담 https://namu.wiki/w/경종(조선)
287 20 경종 경종(조선) 불임 의혹 https://namu.wiki/w/경종(조선)
288 20 경종 경종(조선) 이복동생 연잉군과의 관계 https://namu.wiki/w/경종(조선)
289 20 경종 경종(조선) Y 대중매체 https://namu.wiki/w/경종(조선)
290 20 경종 경종(조선) 영화 https://namu.wiki/w/경종(조선)
291 20 경종 경종(조선) 드라마 https://namu.wiki/w/경종(조선)
292 20 경종 경종(조선) 소설 https://namu.wiki/w/경종(조선)
293 20 경종 경종(조선) 뮤지컬 https://namu.wiki/w/경종(조선)
294 20 경종 경종(조선) Y 기타 https://namu.wiki/w/경종(조선)
295 20 경종 경종(조선) 관련 문서 https://namu.wiki/w/경종(조선)
296 20 경종 경종(조선) 둘러보기 https://namu.wiki/w/경종(조선)
297 22 정조 정조(조선) 정조(조선) https://namu.wiki/w/정조(조선)
298 22 정조 정조(조선) 개요 https://namu.wiki/w/정조(조선)
299 22 정조 정조(조선) 생애 https://namu.wiki/w/정조(조선)
300 22 정조 정조(조선) Y 업적과 정책 https://namu.wiki/w/정조(조선)
301 22 정조 정조(조선) 묘호, 시호, 휘 https://namu.wiki/w/정조(조선)
302 22 정조 정조(조선) Y 평가 https://namu.wiki/w/정조(조선)
303 22 정조 정조(조선) 가계 https://namu.wiki/w/정조(조선)
304 22 정조 정조(조선) 조상 https://namu.wiki/w/정조(조선)
305 22 정조 정조(조선) 어진 https://namu.wiki/w/정조(조선)
306 22 정조 정조(조선) Y 기타 https://namu.wiki/w/정조(조선)
307 22 정조 정조(조선) 엄친아 https://namu.wiki/w/정조(조선)
308 22 정조 정조(조선) Y 유성한 사건 https://namu.wiki/w/정조(조선)
309 22 정조 정조(조선) Y 의빈 성씨와의 일화 https://namu.wiki/w/정조(조선)
310 22 정조 정조(조선) 술과 담배 사랑 https://namu.wiki/w/정조(조선)
311 22 정조 정조(조선) 정조의 비밀 편지들 https://namu.wiki/w/정조(조선)
312 22 정조 정조(조선) 과인은 사도세자의 아들이다? https://namu.wiki/w/정조(조선)
313 22 정조 정조(조선) Y 대중매체 https://namu.wiki/w/정조(조선)
314 22 정조 정조(조선) 관련 문서 https://namu.wiki/w/정조(조선)
315 22 정조 정조(조선) 둘러보기 https://namu.wiki/w/정조(조선)
316 23 순조 순조 순조 https://namu.wiki/w/순조
317 23 순조 순조 개요 https://namu.wiki/w/순조
318 23 순조 순조 생애 https://namu.wiki/w/순조
319 23 순조 순조 Y 평가 https://namu.wiki/w/순조
320 23 순조 순조 묘호와 시호 https://namu.wiki/w/순조
321 23 순조 순조 어진 https://namu.wiki/w/순조
322 23 순조 순조 Y 기타 https://namu.wiki/w/순조
323 23 순조 순조 가계 https://namu.wiki/w/순조
324 23 순조 순조 조상 https://namu.wiki/w/순조
325 23 순조 순조 형제자매 https://namu.wiki/w/순조
326 23 순조 순조 배우자/자녀 https://namu.wiki/w/순조
327 23 순조 순조 Y 대중매체 https://namu.wiki/w/순조
328 23 순조 순조 관련 문서 https://namu.wiki/w/순조
329 23 순조 순조 둘러보기 https://namu.wiki/w/순조
330 24 헌종 헌종(조선) 헌종(조선) https://namu.wiki/w/헌종(조선)
331 24 헌종 헌종(조선) 개요 https://namu.wiki/w/헌종(조선)
332 24 헌종 헌종(조선) 생애 https://namu.wiki/w/헌종(조선)
333 24 헌종 헌종(조선) Y 평가 https://namu.wiki/w/헌종(조선)
334 24 헌종 헌종(조선) 가계 https://namu.wiki/w/헌종(조선)
335 24 헌종 헌종(조선) 조상 https://namu.wiki/w/헌종(조선)
336 24 헌종 헌종(조선) 친가(전주 이씨) https://namu.wiki/w/헌종(조선)
337 24 헌종 헌종(조선) 외가(풍양 조씨) https://namu.wiki/w/헌종(조선)
338 24 헌종 헌종(조선) 처가 https://namu.wiki/w/헌종(조선)
339 24 헌종 헌종(조선) 안동 김씨 https://namu.wiki/w/헌종(조선)
340 24 헌종 헌종(조선) 남양 홍씨 https://namu.wiki/w/헌종(조선)
341 24 헌종 헌종(조선) 배우자 / 자녀 https://namu.wiki/w/헌종(조선)
342 24 헌종 헌종(조선) 어진 https://namu.wiki/w/헌종(조선)
343 24 헌종 헌종(조선) Y 여담 https://namu.wiki/w/헌종(조선)
344 24 헌종 헌종(조선) Y 대중매체 https://namu.wiki/w/헌종(조선)
345 24 헌종 헌종(조선) 관련 문서 https://namu.wiki/w/헌종(조선)
346 24 헌종 헌종(조선) 둘러보기 https://namu.wiki/w/헌종(조선)
347 25 철종 철종(조선) 철종(조선) https://namu.wiki/w/철종(조선)
348 25 철종 철종(조선) 개요 https://namu.wiki/w/철종(조선)
349 25 철종 철종(조선) 생애 https://namu.wiki/w/철종(조선)
350 25 철종 철종(조선) Y 평가 https://namu.wiki/w/철종(조선)
351 25 철종 철종(조선) 어진 https://namu.wiki/w/철종(조선)
352 25 철종 철종(조선) 외부 링크 https://namu.wiki/w/철종(조선)
353 25 철종 철종(조선) 보물 (舊 보물 제1492호) https://namu.wiki/w/철종(조선)
354 25 철종 철종(조선) 가계 https://namu.wiki/w/철종(조선)
355 25 철종 철종(조선) 조상 https://namu.wiki/w/철종(조선)
356 25 철종 철종(조선) 친가(전주 이씨) https://namu.wiki/w/철종(조선)
357 25 철종 철종(조선) 외가(용담 염씨) https://namu.wiki/w/철종(조선)
358 25 철종 철종(조선) 처가(안동 김씨) https://namu.wiki/w/철종(조선)
359 25 철종 철종(조선) 배우자 / 자녀 https://namu.wiki/w/철종(조선)
360 25 철종 철종(조선) Y 여담 https://namu.wiki/w/철종(조선)
361 25 철종 철종(조선) Y 대중매체 https://namu.wiki/w/철종(조선)
362 25 철종 철종(조선) 소설 https://namu.wiki/w/철종(조선)
363 25 철종 철종(조선) 영화 https://namu.wiki/w/철종(조선)
364 25 철종 철종(조선) 드라마 https://namu.wiki/w/철종(조선)
365 25 철종 철종(조선) 만화 https://namu.wiki/w/철종(조선)
366 25 철종 철종(조선) 게임 https://namu.wiki/w/철종(조선)
367 25 철종 철종(조선) 관련 문서 https://namu.wiki/w/철종(조선)
368 25 철종 철종(조선) 둘러보기 https://namu.wiki/w/철종(조선)
369 26 고종 고종(대한제국) 고종(대한제국) https://namu.wiki/w/고종(대한제국)
370 26 고종 고종(대한제국) 개요 https://namu.wiki/w/고종(대한제국)
371 26 고종 고종(대한제국) 호칭 https://namu.wiki/w/고종(대한제국)
372 26 고종 고종(대한제국) 즉위 배경 https://namu.wiki/w/고종(대한제국)
373 26 고종 고종(대한제국) 생애 https://namu.wiki/w/고종(대한제국)
374 26 고종 고종(대한제국) Y 평가 https://namu.wiki/w/고종(대한제국)
375 26 고종 고종(대한제국) 청과의 영토 분쟁 https://namu.wiki/w/고종(대한제국)
376 26 고종 고종(대한제국) Y 가족 관계 https://namu.wiki/w/고종(대한제국)
377 26 고종 고종(대한제국) 조상 https://namu.wiki/w/고종(대한제국)
378 26 고종 고종(대한제국) Y 사진과 어진, 기타 그림 https://namu.wiki/w/고종(대한제국)
379 26 고종 고종(대한제국) 사진 https://namu.wiki/w/고종(대한제국)
380 26 고종 고종(대한제국) 어진 https://namu.wiki/w/고종(대한제국)
381 26 고종 고종(대한제국) Y 기타 그림 https://namu.wiki/w/고종(대한제국)
382 26 고종 고종(대한제국) Y 여담 https://namu.wiki/w/고종(대한제국)
383 26 고종 고종(대한제국) Y 대중매체 https://namu.wiki/w/고종(대한제국)
384 26 고종 고종(대한제국) 관련 문서 https://namu.wiki/w/고종(대한제국)
385 26 고종 고종(대한제국) 둘러보기 https://namu.wiki/w/고종(대한제국)
386 27 순종 순종(대한제국) 순종(대한제국) https://namu.wiki/w/순종(대한제국)
387 27 순종 순종(대한제국) 개요 https://namu.wiki/w/순종(대한제국)
388 27 순종 순종(대한제국) 생애 https://namu.wiki/w/순종(대한제국)
389 27 순종 순종(대한제국) Y 평가 https://namu.wiki/w/순종(대한제국)
390 27 순종 순종(대한제국) 어진 https://namu.wiki/w/순종(대한제국)
391 27 순종 순종(대한제국) Y 기타 https://namu.wiki/w/순종(대한제국)
392 27 순종 순종(대한제국) Y 대중매체 https://namu.wiki/w/순종(대한제국)
393 27 순종 순종(대한제국) 관련 문서 https://namu.wiki/w/순종(대한제국)
394 27 순종 순종(대한제국) 둘러보기 https://namu.wiki/w/순종(대한제국)
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+294
View File
@@ -0,0 +1,294 @@
# -*- coding: utf-8 -*-
"""
animation 생성 단계 (나레이션 + 스토리보드) — 병합본
==================================================================
조선왕 '썰' CSV → ① 병맛 마케팅 나레이션 ② 장면 분할 스토리보드 를 한 파일에 모음.
(이전 gen_narration.py + gen_storyboard.py 를 main.py 가 한 모듈로 쓰도록 합침.)
scraper.py 가 만든 joseon_keywords_*.csv 를 입력으로 한다.
· 나레이션: latest_csv / load_rows / pick_seed / generate
· 스토리보드: clamp_scenes / make_storyboard
구조: 훅 → 썰 전개(역사 + 병맛 과장) → 어거지 전환 → 마케팅 + CTA → 장면별 분할(자막+그림 프롬프트).
"""
import csv
import json
import random
import re
import sys
from pathlib import Path
from google.genai import types
HERE = Path(__file__).parent
DATA_DIR = HERE / "data" # 조선왕 일화 CSV(선행 데이터). ★ output/ 이 아님 — 거긴 출력물(mp4)만.
DEFAULT_MODEL = "gemini-2.5-flash"
# 자막 폰트(주아/송명/맑은고딕)에 없는 이모지·기호(😊▼★♥ 등)는 화면에서 □ 로 깨진다 → 제거.
_TYPO = {"…": "...", "‘": "'", "’": "'", "“": '"',
"”": '"', "·": " ", "~": "~", "〜": "~"}
# 폰트(주아/송명/맑은고딕)에 확실히 있는 것 = 한글 음절·자모(ㅋㅋ ㅠㅠ) + ASCII 인쇄문자. 그 외(이모지·…·특수기호)는 제거.
_KEEP_RE = re.compile(r"[^가-힣ㄱ-ㅣ\x20-\x7E]")
def _no_emoji(s):
s = s or ""
for _k, _v in _TYPO.items():
s = s.replace(_k, _v)
return re.sub(r" +", " ", _KEEP_RE.sub("", s)).strip()
# ============================== ① 나레이션 (조선왕 썰 → 병맛 대본) ==============================
def latest_csv() -> Path:
files = sorted(DATA_DIR.glob("joseon_keywords_*.csv"))
if not files:
sys.exit("[!] animation/data/ 에 joseon_keywords_*.csv 가 없음. 먼저 'python scraper.py' 실행.")
return files[-1]
def load_rows(csv_path: Path):
"""CSV → [{order, king, doc, is_anecdote, keyword, url}, ...]"""
rows = []
with csv_path.open(encoding="utf-8-sig", newline="") as f:
r = csv.reader(f)
next(r, None) # 헤더 스킵
for line in r:
if len(line) < 6:
continue
order, king, doc, anec, kw, url = line[:6]
rows.append({
"order": int(order) if order.isdigit() else 0,
"king": king, "doc": doc,
"is_anecdote": anec.strip().upper() == "Y",
"keyword": kw, "url": url,
})
return rows
def pick_seed(rows, king=None, keyword=None, prefer_anecdote=True):
"""대본의 씨앗이 될 (왕, 썰키워드) 한 건 선택."""
cand = rows
if king:
cand = [r for r in cand if r["king"] == king]
if not cand:
kings = sorted({r["king"] for r in rows})
sys.exit(f"[!] '{king}' 없음. 가능: {', '.join(kings)}")
if keyword:
kw_match = [r for r in cand if keyword in r["keyword"]]
if not kw_match:
sys.exit(f"[!] '{keyword}' 키워드가 {king or '전체'}에 없음.")
return random.choice(kw_match)
if prefer_anecdote:
anec = [r for r in cand if r["is_anecdote"]]
if anec:
cand = anec
return random.choice(cand)
NARR_SYSTEM = """\
너는 한국 숏폼(쇼츠/릴스) 전문 카피라이터다. '병맛(어이없고 황당하지만 묘하게 중독성 있는)' 유머 톤으로,
조선 왕들의 역사 '썰'을 풀다가 마지막에 자연스러운 척 억지로 광고로 갈아타는 {seconds}초 나레이션 대본을 쓴다.
[톤 규칙]
- 구어체 반말 나레이션. TTS(AI 음성)가 읽을 것을 전제로, 문장은 짧고 리듬감 있게.
- 진지하게 시작했다가 갑자기 헛소리로 빠지는 낙차가 핵심. "근데", "그래서", "참고로" 같은 접속사로 능청스럽게 전환.
- 역사적 사실(왕 이름, 사건 키워드)은 최소한의 뼈대로만 쓰고, 디테일은 과장·왜곡해서 웃기게 채운다.
단, 시청자가 '진짜 역사'와 '드립'을 구분 못 할 정도로 거짓 정보를 사실처럼 단정하진 마라(가벼운 드립 신호 유지).
- 욕설·혐오·정치 비방 금지. 누구나 웃을 수 있는 선.
[구조] (반드시 이 4단)
1) hook : 3초 안에 스크롤 멈추게 하는 한 방. 질문/충격/궁금증.
2) story : 썰 본문. 역사로 시작해 점점 병맛으로 과열. 광고로 넘어갈 '연결고리'를 은근히 심어둔다.
3) pivot : "근데 알고 보니/그래서/요즘 같으면…" 식으로 광고로 억지 전환. 이 억지스러움 자체가 개그.
4) cta : 광고 대상의 핵심 셀링포인트 + 행동유도 한 줄.
[분량]
- 한국어 나레이션 기준 약 {seconds}초 분량 = {lo}~{hi}자. full_narration 은 반드시 이 글자수 범위로.
- 이 범위를 넘기지 마라. 너무 길면 TTS가 빨라져 병맛이 죽고 영상도 길어진다. 간결하게.
[SNS 캡션] (sns_caption 필드 — 유튜브/인스타/틱톡에 그대로 붙여넣을 업로드 설명)
- 아래 '형식'을 지켜라. 이모지를 적극 사용(나레이션과 달리 캡션은 이모지 OK). 줄바꿈으로 구분.
- 형식:
1) 첫 줄: 후킹 카피 한 줄 (예: "세종대왕이 사실 OO 단골이었다는 썰 풉니다.")
2) 본문 1~2줄: 조선왕 썰 ↔ 가게를 잇는 재밌는 소개 (이모지 곁들여)
3) 셀링 한 줄: 왕이 반할 식으로 가게 핵심 (예: "세종도 반할 OO시장 숨은 맛집 'OOO' 🍲")
4) 📍 가게명 (위치) ← 가게명/위치 모르면 이 줄 생략
5) 🔥 대표 메뉴·포인트 나열 ← 모르면 생략
6) 👉 방문 팁 또는 행동유도 한 줄
7) 마지막 줄: 해시태그 나열. #조선왕 #역사썰 을 앞에 두고, 가게·지역·메뉴·병맛 태그 + #shorts #AIO2O 로 끝.
- 가게 정보(이름·위치·메뉴)는 '마케팅 대상' 텍스트에서 뽑아라. 없으면 그 줄은 자연스럽게 빼라(억지로 지어내지 마라).
[출력]
- 반드시 지정된 JSON 스키마로만 응답. 설명/사족 금지.
- full_narration 은 hook+story+pivot+cta 를 자연스럽게 이어붙인 '읽는 그대로의' 최종 나레이션.
- sns_caption 은 위 [SNS 캡션] 형식대로. title 에는 해시태그를 넣지 말 것(태그는 hashtags·sns_caption 에만).
"""
NARR_USER = """\
[이번 쇼츠 소재]
- 왕: {king} ({doc})
- 썰 키워드: "{keyword}"
- 참고 출처: {url}
[마케팅 대상 (마지막에 이걸로 갈아타기)]
- 가게명: {store}
- 소개/키워드: {product}
위 '썰 키워드'에서 출발해, 병맛으로 풀다가 마지막에 '마케팅 대상'으로 억지 전환하는
{seconds}초 쇼츠 나레이션을 만들어라. 썰 키워드가 빈약하면 그 왕의 유명한 일화로 살을 붙여도 된다.
"""
NARR_SCHEMA = {
"type": "object",
"properties": {
"title": {"type": "string", "description": "쇼츠 제목/썸네일 문구 (짧고 자극적). 해시태그(#…)를 넣지 말 것 — 태그는 hashtags 필드에만."},
"hook": {"type": "string"},
"story": {"type": "string"},
"pivot": {"type": "string"},
"cta": {"type": "string"},
"full_narration": {"type": "string", "description": "TTS가 읽을 최종 나레이션 전문"},
"estimated_seconds": {"type": "integer"},
"hashtags": {"type": "array", "items": {"type": "string"}},
"sns_caption": {"type": "string", "description": "SNS 업로드용 설명 전문([SNS 캡션] 형식, 이모지·해시태그 포함)"},
},
"required": ["title", "hook", "story", "pivot", "cta", "full_narration", "sns_caption"],
}
def generate(client, model, seed, product, seconds, store=""):
"""조선왕 썰 + 마케팅 대상 → 병맛 나레이션 dict (Gemini)."""
# 글자수를 목표 길이에 비례시킨다(한국어 나레이션 ≒ 초당 5.4~6.4자). 60초면 ≒324~384자.
lo, hi = round(seconds * 5.4), round(seconds * 6.4)
user = NARR_USER.format(
king=seed["king"], doc=seed["doc"],
keyword=seed["keyword"], url=seed["url"], product=product,
store=(store or "(가게명 미상 — 소개 텍스트에서 유추)"), seconds=seconds,
)
sys_prompt = NARR_SYSTEM.format(seconds=seconds, lo=lo, hi=hi)
resp = client.models.generate_content(
model=model,
contents=user,
config=types.GenerateContentConfig(
system_instruction=sys_prompt,
temperature=1.1, # 병맛 = 약간 높은 창의성
response_mime_type="application/json",
response_schema=NARR_SCHEMA,
),
)
data = json.loads(resp.text)
data["full_narration"] = _no_emoji(data.get("full_narration", "")) # 이모지 제거(자막·TTS 깨짐 방지)
data["_seed"] = {"king": seed["king"], "keyword": seed["keyword"], "url": seed["url"]}
data["_product"] = product
return data
# ============================== ② 스토리보드 (나레이션 → 장면 분할) ==============================
SB_SYSTEM = """\
너는 숏폼 영상 디렉터다. 주어진 '병맛 한국사 마케팅 나레이션'을 세로 쇼츠용 스토리보드로 쪼갠다.
[핵심 규칙]
- narration 필드에는 받은 나레이션 '원문을 그대로' 잘라 담아라. 절대 다시 쓰거나 요약하지 마라.
(이 텍스트가 그대로 TTS 음성이 되므로, 모든 장면 narration 을 이으면 원본과 100% 같아야 한다.)
- 장면 수는 아래 '목표 장면 수'에 맞춰라. 한 장면 narration 이 너무 길어지지 않게(자막 한두 줄) 적당히 끊어 담아라.
- caption: 화면에 띄울 굵은 자막. 짧고 임팩트 있게(최대 18자). narration 의 핵심을 뽑되 드립 살려서.
- image_prompt: 그 장면 그림을 그릴 영어 프롬프트. character_sheet 와 style_guide 를 항상 전제로,
'이 장면에서 캐릭터가 뭘 하는지'를 구체적으로. (예: the cat king sweating while supervising palace construction)
★ 절대 그림 안에 '글자/간판 글씨/메뉴판 글자/브랜드명 텍스트'를 그리도록 요구하지 마라.
(AI가 한글을 깨진 글자로 그린다.) 간판·현수막·메뉴판이 등장해도 'blank sign with no text'처럼
글자 없는 상태로 묘사하라. 가게 이름 등 텍스트는 영상 자막에서 따로 넣는다.
★ 감정이 강한 장면(웃음/울음/졸림/한숨/장난/좌절 등)에서는 눈 표정도 영어로 적어라
(예: eyes squeezed shut while laughing, sleepy half-closed eyes, a playful wink,
teary closed eyes). 평범한 장면은 굳이 눈을 적지 말고 뜬 눈(기본)으로 두면 된다.
→ 그래야 컷마다 눈 표정이 다양해진다.
[전역 설정]
- character_sheet: 이 영상에 일관되게 등장할 주인공 캐릭터를 영어로 정의. 한국사 인물을 '귀여운 통통한 고양이'로 의인화.
복식/색/특징을 못박아 컷마다 동일하게. (예: a chubby cute cat as Joseon King Gwanghaegun, wearing red royal gonryongpo robe and black ikseongwan hat, round face)
★ 눈 그림체: 눈을 떴을 때는 large round eyes with big round solid black pupils and a small
soft white highlight, gentle innocent look (귀엽고 둥근 눈)으로 통일. 단 이 '그림체'만 유지하고,
장면 감정에 따라 눈을 감거나(eyes closed) 실눈(squint)·윙크·졸린 눈 등 표정은 바꿔도 된다.
절대 날카롭거나 찢어진/화난/매서운/사실적인 맹수 눈은 금지.
- style_guide: 그림 스타일을 영어로. 한국 웹툰풍 플랫 일러스트, 굵은 외곽선, 따뜻한 색, 단순 배경, 세로 9:16.
[출력] 지정된 JSON 스키마로만.
"""
SB_USER = """\
[마케팅 대상] {product}
[소재 왕] {king}
[목표 장면 수] 약 {scenes}개
[나레이션 원문 — 이걸 그대로 잘라서 narration 필드에 담아라]
{narration}
"""
SB_SCHEMA = {
"type": "object",
"properties": {
"character_sheet": {"type": "string"},
"style_guide": {"type": "string"},
"scenes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"narration": {"type": "string"},
"caption": {"type": "string"},
"image_prompt": {"type": "string"},
},
"required": ["narration", "caption", "image_prompt"],
},
},
},
"required": ["character_sheet", "style_guide", "scenes"],
}
def clamp_scenes(scene_list, target):
"""장면 수가 target 보다 많으면, 가장 짧은 인접쌍을 병합해 target 개까지 줄인다.
narration 은 순서대로 보존된다(분할은 하지 않는다)."""
def clen(s):
return len(s.get("narration", "").strip())
while len(scene_list) > target:
# 합쳤을 때 가장 짧아지는 인접쌍을 골라 병합
i = min(range(len(scene_list) - 1),
key=lambda k: clen(scene_list[k]) + clen(scene_list[k + 1]))
base = dict(scene_list[i + 1]) # 이웃(뒤 컷)의 caption/image_prompt 유지
a, b = scene_list[i].get("narration", "").strip(), scene_list[i + 1].get("narration", "").strip()
base["narration"] = (a + " " + b).strip()
scene_list[i:i + 2] = [base]
return scene_list
def make_storyboard(client, model, narration, product, king, scenes=8) -> dict:
"""나레이션 → 스토리보드 dict (Gemini)."""
resp = client.models.generate_content(
model=model,
contents=SB_USER.format(product=product, king=king,
scenes=scenes, narration=narration),
config=types.GenerateContentConfig(
system_instruction=SB_SYSTEM,
temperature=0.8,
response_mime_type="application/json",
response_schema=SB_SCHEMA,
),
)
sb = json.loads(resp.text)
# 모델이 '목표 장면 수'를 채우려고 narration 이 빈 장면(닫는 CTA 컷 등)을 끼워넣을 때가 있다.
# 이 파이프라인은 narration 을 TTS·자막으로 쓰므로 빈 장면은 의미가 없고,
# 빈 텍스트를 TTS 에 넣으면 빈 응답을 반복하다 죽는다 → 생성 단계에서 미리 제거.
raw = sb.get("scenes", [])
kept = [s for s in raw if s.get("narration", "").strip()]
if len(kept) < len(raw):
print(f"[i] 빈 나레이션 장면 {len(raw) - len(kept)}개 제거")
sb["scenes"] = clamp_scenes(kept, scenes) # 장면이 목표보다 많으면 병합해 맞춤
for sc in sb["scenes"]: # 이모지 제거(자막·TTS 깨짐 방지)
sc["narration"] = _no_emoji(sc.get("narration", ""))
sc["caption"] = _no_emoji(sc.get("caption", ""))
sb["_product"] = product
sb["_king"] = king
return sb
+275
View File
@@ -0,0 +1,275 @@
# -*- coding: utf-8 -*-
"""
키워드 → 병맛 한국사 마케팅 쇼츠 (완전 자동, 원커맨드)
==========================================================
마케팅하고 싶은 대상을 '자유로운 키워드/문장'으로 주면:
1) 랜덤으로 조선왕 '썰' 매칭
2) Gemini 로 병맛 마케팅 나레이션 생성
3) 장면 분할(스토리보드)
4) 장면별 이미지 + 음성 생성
5) Ken Burns + 자막(맨 위) + 음성 합성 → 세로 mp4
6) 한 작업의 결과(나레이션·스토리보드·이미지·음성·mp4)는
모두 output/<작업폴더>/ 안에만 저장. 완성 후 중간 파일(assets)은 자동 삭제.
선행: namu_joseon_scraper.py 로 만든 output/joseon_keywords_*.csv 가 있어야 함.
API 키: GEMINI_API_KEY 환경변수 (또는 --api-key). 이미지 생성은 결제 활성화 필요.
★ 실행 (Shorts 폴더 안에서, 키워드는 자유롭게):
python auto_short.py 감성 펜션 왕의휴식 객실 노천탕 평창 숲속 1박 12만원
python auto_short.py "강원도 평창 '왕의휴식' 감성 펜션, 객실 노천탕, 1박 12만원"
python auto_short.py 배달앱 왕의밥상 --label 왕의밥상
옵션:
--label 왕의휴식 결과 폴더 이름에 쓸 라벨 (기본: 키워드 앞부분 자동)
--king 광해군 특정 왕 고정 (기본: 랜덤)
--scenes 12 장면 수=이미지 수 (기본 12)
--seconds 45 목표 길이 초 (기본 45)
--voice Puck TTS 목소리
--keep 중간 파일(assets) 삭제하지 않고 보존
"""
import argparse
import json
import os
import re
import shutil
import sys
from datetime import datetime
from pathlib import Path
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
from google import genai
sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) # 공유 모듈(naver.py, media.py)
import gen # 나레이션 + 스토리보드 생성(병합: 이전 gen_narration + gen_storyboard)
import render as MS # animation 영상합성 엔진(이전 make_short.py)
import naver as NV # 공유 네이버 크롤러/브리핑/사진 선별
HERE = Path(__file__).parent
OUT_DIR = HERE.parent / "output" / "animation" # 통합 출력: shorts_all/output/animation/
TEXT_MODEL = "gemini-2.5-flash"
def safe_name(s: str) -> str:
s = re.sub(r"[^\w가-힣]+", "_", s).strip("_")
return s[:30] or "short"
def main():
ap = argparse.ArgumentParser(
description="키워드 또는 네이버 링크 → 병맛 한국사 쇼츠 (완전 자동)",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="예) python main.py 감성 펜션 왕의휴식 객실 노천탕 1박 12만원\n"
" python main.py https://naver.me/xxxx (링크만 — AI브리핑 자동 키워드화)",
)
# 마케팅 대상: 자유 키워드(여러 단어/문장) 또는 네이버 링크(섞어 써도 됨)
ap.add_argument("keywords", nargs="*",
help="마케팅 대상 키워드/문장, 또는 네이버 링크 (--link 없이 링크만 줘도 됨)")
# 결과 폴더 라벨
ap.add_argument("--label", help="결과 폴더 라벨 (기본: 키워드 앞부분 자동)")
# 생성 옵션
ap.add_argument("--king", help="특정 왕 고정 (기본: 랜덤)")
ap.add_argument("--scenes", type=int, default=12, help="장면 수=이미지 수 (기본 12)")
ap.add_argument("--seconds", type=int, default=45, help="목표 길이(초) (기본 45)")
ap.add_argument("--voice", default=MS.TTS_VOICE, help=f"TTS 목소리 (기본 {MS.TTS_VOICE})")
ap.add_argument("--keep", action="store_true", help="중간 파일(assets) 보존")
ap.add_argument("--csv", help="썰 CSV 경로 (기본: output/ 최신)")
# 실제 사진(가게/메뉴판) 섞기 + 마지막 링크 카드
ap.add_argument("--images", default="load_image",
help="실제 사진 폴더. 가게 이름만 줘도 load_image/<가게>/ 를 찾음 "
"(예: --images 연산골막국수). 비었으면 전부 AI")
ap.add_argument("--max-real", type=int, default=0,
help="실제 사진으로 채울 최대 장면 수 (기본 0=폴더 사진 전부, 장면 수 한도 내)")
ap.add_argument("--real-scenes",
help="실제 사진 깔 장면 번호 1-based, 콤마구분 (예: 5,6,7). 주면 내용매칭 대신 수동")
ap.add_argument("--no-match", action="store_true",
help="실제 사진 내용 자동매칭(Gemini 비전) 끄고 위치 기반(뒤쪽 장면)으로")
ap.add_argument("--photos", type=int, default=4,
help="네이버 사진탭에서 자동 선별할 공식사진 수 (기본 4, --link 줄 때)")
ap.add_argument("--no-photos", action="store_true",
help="네이버 사진 자동 수집 끄기 (전부 AI 그림으로)")
ap.add_argument("--link", help="맨 마지막 화면에 띄울 링크/문구 (예: naver.me/xxxx)")
ap.add_argument("--link-seconds", type=float, default=3.0, help="링크 카드 길이(초)")
ap.add_argument("--store", help="링크 카드에 함께 띄울 가게 이름 (기본: 키워드 첫 부분 자동)")
ap.add_argument("--cta", default=MS.LINK_CTA, help=f"링크 카드 안내문구 (기본: '{MS.LINK_CTA}')")
ap.add_argument("--img-model", default=MS.IMG_MODEL,
help=f"이미지 생성 모델 (기본 {MS.IMG_MODEL}). 글자 또렷하게: gemini-3.1-flash-image / gemini-3-pro-image")
ap.add_argument("--allow-text", action="store_true",
help="그림 안 글자 금지 해제 (신형 모델로 간판에 진짜 이름 넣고 싶을 때)")
# 컷편집 느낌 (말 빠르게 + 컷 사이 침묵 제거 → 분량 ↓)
ap.add_argument("--speed", type=float, default=1.3,
help="말 속도 배율 (기본 1.3=30%% 빠르게, 음정 유지). 1.0=원본")
ap.add_argument("--no-trim", action="store_true",
help="컷 앞뒤 침묵 제거 끄기 (기본은 제거해 컷을 타이트하게)")
ap.add_argument("--tail", type=float, default=0.0,
help="각 컷 말 끝난 뒤 여운(초). 기본 0=말 끝나자마자 다음 컷. 여유 주려면 0.1~0.2")
ap.add_argument("--workers", type=int, default=4,
help="이미지·음성 동시 생성 수 (기본 4). 높이면 빠르지만 API 속도제한 주의")
ap.add_argument("--bgm",
help="배경음악(병맛 BGM) 파일 또는 폴더. 폴더면 무작위 1곡. "
"기본: bgm/ 폴더에 곡이 있으면 자동으로 무작위 사용. "
"특정 곡 고정하려면 --bgm 파일명. BGM 끄려면 --bgm none")
ap.add_argument("--bgm-volume", type=float, default=0.3,
help="BGM 볼륨 0~1 (기본 0.3). 나레이션 안 묻히게 조절")
ap.add_argument("--api-key")
args = ap.parse_args()
# --link 안 써도 됨: 위치 인자에 네이버 링크가 섞여 있으면 그걸 링크로 빼낸다
# (narration/kakao 처럼 `python main.py https://naver.me/xxxx` 만으로 실행 가능)
if not args.link:
link_tok = next((k for k in args.keywords if NV.looks_like_naver_place(k)), None)
if link_tok:
args.link = link_tok
args.keywords = [k for k in args.keywords if k != link_tok]
product = " ".join(args.keywords).strip()
# 키워드를 안 줬는데 --link 가 네이버 플레이스면 → AI 브리핑을 긁어와 마케팅 키워드로 사용
brief_store = None
if not product and NV.looks_like_naver_place(args.link or ""):
print("■ 키워드 없음 → 네이버 AI 브리핑 자동 수집...")
try:
brief_store, bullets, _cat = NV.fetch_briefing(args.link) # 업종(cat)은 animation 미사용
except Exception as e:
sys.exit(f"[!] AI 브리핑 수집 실패: {type(e).__name__}: {e}")
if not bullets:
# AI 브리핑이 없으면 → 방문자 리뷰를 '더보기'까지 펼쳐 긁은 뒤 Gemini 로 요약(브리핑 대체)
print(f"■ '{brief_store or '이 가게'}' AI 브리핑 없음 → 방문자 리뷰 크롤링 후 요약...")
_key = args.api_key or os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY")
if not _key:
sys.exit("[!] 리뷰 요약에 API 키 필요. setx GEMINI_API_KEY \"키\" 후 새 터미널, 또는 --api-key.")
try:
rstore, reviews = NV.fetch_reviews(args.link, max_reviews=30)
except Exception as e:
sys.exit(f"[!] 리뷰 수집 실패: {type(e).__name__}: {e}")
if rstore and not brief_store:
brief_store = rstore
bullets = NV.summarize_reviews(genai.Client(api_key=_key), brief_store, reviews)
if not bullets:
sys.exit(f"[!] '{brief_store or '이 가게'}'는 AI 브리핑도 리뷰도 못 얻었어요. "
"키워드를 직접 주거나 다른 링크를 쓰세요.")
print(f"■ 리뷰 {len(reviews)}개 수집 → 요약 {len(bullets)}줄 (브리핑 대체)")
product = " ".join(bullets)
print(f"■ 가게: {brief_store or '?'} / 소재 {len(bullets)}줄 → 키워드로 사용")
for b in bullets:
print(f" • {b}")
if not product:
sys.exit("[!] 마케팅 키워드가 필요해. 예: python auto_short.py 감성 펜션 ... "
"또는 --link 에 네이버 가게 링크(AI 브리핑 자동 수집).")
api_key = args.api_key or os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY")
if not api_key:
sys.exit("[!] API 키 없음. setx GEMINI_API_KEY \"키\" 후 새 터미널, 또는 --api-key.")
csv_path = Path(args.csv) if args.csv else gen.latest_csv()
rows = gen.load_rows(csv_path)
client = genai.Client(api_key=api_key)
OUT_DIR.mkdir(parents=True, exist_ok=True)
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
# 네이버 링크 주고 사진 폴더를 직접 안 줬으면 → 사진탭 공식사진을 자동 수집·선별
if (not args.no_photos and NV.looks_like_naver_place(args.link or "")
and args.images == "load_image"):
store_for_dir = (brief_store or args.store or args.label
or " ".join(args.keywords[:2]) or "naver_store")
photo_dir = HERE / "load_image" / safe_name(store_for_dir)
existing = [p for p in photo_dir.glob("*.jpg")] if photo_dir.exists() else []
if existing:
print(f"■ 사진 캐시 재사용: {photo_dir} ({len(existing)}장)")
args.images = safe_name(store_for_dir)
else:
print(f"■ 네이버 사진탭 → 공식사진 {args.photos}장 자동 수집·선별...")
try:
_, finals = NV.fetch_and_select(args.link, photo_dir,
n=args.photos, client=client)
if finals:
args.images = safe_name(store_for_dir)
print(f"■ 사진 {len(finals)}장 준비 → {photo_dir}")
else:
print("■ 공식사진을 못 받았어요 → 전부 AI 그림으로 진행")
except Exception as e:
print(f"■ 사진 수집 실패({type(e).__name__}) → 전부 AI 그림으로 진행")
# 이 작업 전용 폴더 (모든 산출물은 여기 안에만)
label = args.label or " ".join(args.keywords[:3]) or brief_store or product[:20]
stem = f"{safe_name(label)}_{ts}"
job_dir = OUT_DIR / stem
job_dir.mkdir(parents=True, exist_ok=True)
# 1) 랜덤(또는 지정) 왕 썰 매칭
seed = gen.pick_seed(rows, king=args.king)
print(f"■ 작업 폴더 : {job_dir}")
print(f"■ 마케팅 대상 : {product}")
print(f"■ 매칭된 썰 : {seed['king']} / \"{seed['keyword']}\"\n")
# 2) 병맛 나레이션
print("[1/4] 나레이션 생성...")
store_name = brief_store or getattr(args, "store", None) or label
narr = gen.generate(client, TEXT_MODEL, seed, product, args.seconds, store=store_name)
# 제목엔 해시태그가 들어갈 이유가 없다 — LLM 이 끼워넣은 '#태그' 토큰 제거(태그는 hashtags 필드에만).
narr["title"] = re.sub(r"\s*#\S+", "", narr.get("title", "")).strip()
(job_dir / "narration.json").write_text(
json.dumps(narr, ensure_ascii=False, indent=2), encoding="utf-8")
# 사람이 바로 읽는 나레이션 '가사' 텍스트 (제목 + 본문 + 해시태그)
lyric = (f"[제목] {narr.get('title','')}\n"
f"[소재] {seed['king']} / \"{seed['keyword']}\"\n"
f"[마케팅] {product}\n"
f"{'-'*40}\n"
f"{narr.get('full_narration','')}\n")
if narr.get("hashtags"):
lyric += f"\n{' '.join(narr['hashtags'])}\n"
(job_dir / "narration.txt").write_text(lyric, encoding="utf-8")
# SNS 업로드용 캡션(이모지·해시태그 포함) — content_sync/finalize 가 읽어 Content.caption 에 저장.
caption = (narr.get("sns_caption") or "").strip()
if caption:
(job_dir / "caption.txt").write_text(caption, encoding="utf-8")
print(f" \"{narr['title']}\" ({len(narr['full_narration'])}자)")
# 3) 스토리보드(장면 분할)
print("[2/4] 스토리보드 분할...")
sb = gen.make_storyboard(client, TEXT_MODEL, narr["full_narration"],
product, seed["king"], scenes=args.scenes)
(job_dir / "storyboard.json").write_text(
json.dumps(sb, ensure_ascii=False, indent=2), encoding="utf-8")
print(f" 장면 {len(sb['scenes'])}개")
# 4) 이미지 + 음성 + 영상 합성 (assets·mp4 모두 job_dir 안)
# 실제 사진(가게/메뉴판)을 내용 맞는 장면에 AI 배경과 합성, 마지막에 링크 카드 추가
real_images, real_scenes = MS.resolve_real_images(args.images, args.real_scenes)
if not real_images:
print(f"■ 실제 사진 : 없음 ('{args.images}' 폴더 비었거나 없음) → 전부 AI")
# --bgm 안 줘도 bgm/ 폴더에 곡이 있으면 자동으로 무작위 1곡 사용
bgm = MS.resolve_bgm(args.bgm or "bgm")
_off = str(args.bgm or "").strip().lower() in ("none", "off", "no")
if args.bgm and not _off and not bgm:
print(f"■ BGM '{args.bgm}' 를 못 찾음 → BGM 없이 진행")
elif bgm:
print(f"■ BGM : {bgm.name} (bgm/ 무작위)")
print("[3/4] 이미지·음성 생성...")
store = args.store or brief_store or product.split(",")[0].strip() or None
out_mp4 = MS.produce(client, sb, stem, workdir=job_dir, voice=args.voice, force=False,
real_images=real_images, real_scenes=real_scenes,
max_real=args.max_real, match_content=not args.no_match,
link=args.link, link_seconds=args.link_seconds, store=store, cta=args.cta,
img_model=args.img_model, allow_text=args.allow_text,
speed=args.speed, trim_silence=not args.no_trim, tail=args.tail,
workers=args.workers, bgm=bgm, bgm_volume=args.bgm_volume)
# 5) 중간 파일 정리: assets/ + 기계용 json 삭제. 결과 mp4 와 narration.txt(제목/해시태그)만 남김.
if not args.keep and out_mp4.exists() and out_mp4.stat().st_size > 0:
shutil.rmtree(job_dir / "assets", ignore_errors=True)
for junk in ("narration.json", "storyboard.json"):
(job_dir / junk).unlink(missing_ok=True)
print(" 중간 파일(assets·json) 삭제 완료 — mp4 + narration.txt 만 보존")
print(f"\n✅ 완성: {out_mp4}")
print(f" {seed['king']} 썰 · {product}")
if __name__ == "__main__":
main()
+970
View File
@@ -0,0 +1,970 @@
# -*- coding: utf-8 -*-
"""
스토리보드 → 완성 쇼츠 영상(mp4) 조립 [A방식: 정지 일러스트 + 모션]
=====================================================================
gen_storyboard.py 가 만든 스토리보드를 받아 장면별로:
1) Gemini 이미지로 일러스트 생성 (캐릭터 일관성 = 1번 컷을 레퍼런스로 물림)
2) Gemini TTS 로 그 장면 나레이션 음성 생성 (장면 길이 = 음성 길이)
3) ffmpeg 로 Ken Burns(zoompan 줌) + 자막(PNG 오버레이) + 음성 합성 → 세로 1080x1920 mp4
(Intel QSV 하드웨어 인코딩 자동 사용, 없으면 libx264 ultrafast)
이미지/음성은 output/ 에 장면별로 캐싱한다. 재실행 시 이미 있으면 재사용(재과금 X).
다시 그리고 싶으면 --force.
설치: pip install google-genai pillow imageio-ffmpeg (moviepy 불필요 — ffmpeg 직접 렌더)
실행:
python make_short.py # 최신 *_storyboard.json
python make_short.py --storyboard output/xxx_storyboard.json --voice Puck
python make_short.py --force # 이미지/음성 새로 생성
"""
import json
import re
import shutil
import subprocess
import sys
import time
import wave
from pathlib import Path
from google.genai import types
from PIL import Image
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
import media as MU
HERE = Path(__file__).parent
OUT_DIR = HERE.parent / "output" / "animation" # 통합 출력: shorts_all/output/animation/
W, H = 1080, 1920 # 세로 쇼츠
BAND_RATIO = 0.18 # 상단 흰 자막 밴드 높이 비율(그림은 그 아래, 안 가림)
NARR_SIZE = 48 # 나레이션 자막 기본 글자 크기(밴드에 안 들어가면 자동 축소)
NARR_MIN_SIZE = 30 # 자동 축소 하한(이보다 작아지진 않음)
BRAND_TITLE = "썰박스" # 상단 밴드 제목(옆에 '×' + AI O2O 로고 결합)
BRAND_LOGO = str(Path(__file__).parent / "fonts" / "brand_logo.png") # 제목 옆 AI O2O 로고(흰배경·검정)
IMG_MODEL = "gemini-2.5-flash-image"
VISION_MODEL = "gemini-2.5-flash" # 실제 사진 내용 분석 + 장면 매칭용
TTS_MODEL = "gemini-2.5-pro-preview-tts" # 최상위 TTS(발음 품질 우선). 저렴하게: gemini-3.1-flash-tts-preview
TTS_VOICE = "Puck"
TTS_STYLE = ("다음 한 문장을 한국 숏폼 병맛 나레이션처럼 신나고 빠르게, "
"능청스럽게 약간 오버해서 읽어줘:")
# 한글 자막용 폰트 — 둥글둥글 B급 느낌의 '주아체'. per-engine fonts/ 우선, 없으면 상위 공유(generator/fonts).
def _find_font(name):
for c in (HERE / "fonts" / name, HERE.parent / "fonts" / name):
if c.exists():
return str(c)
return str(HERE / "fonts" / name)
FONT = _find_font("Jua-Regular.ttf")
FONT_FALLBACK = r"C:\Windows\Fonts\malgunbd.ttf"
# 상단 제목('썰록') 전용 폰트 — 조선 느낌 명조(송명체). 자막과 일부러 다르게.
TITLE_FONT = _find_font("SongMyung-Regular.ttf")
TITLE_SIZE = 58
# AI 이미지 모델은 글자(특히 한글)를 제대로 못 그려 간판/메뉴 글씨가 깨진다.
# → 모든 이미지 생성에서 '글자 자체를 그리지 말라'고 강하게 지시. (가게 이름은 자막/카드로 표기)
NO_TEXT = (" CRITICAL: Render NO text of any kind in the image — no letters, words, numbers, "
"Korean hangul, logos, or signage text. Keep every sign, banner, board and menu "
"completely BLANK with no writing on them.")
# ---------------------------------------------------------------- 데이터
IMG_EXTS = (".jpg", ".jpeg", ".png", ".webp")
def resolve_real_images(images_dir, real_scenes_arg):
"""--images 값 → 정렬된 실제 사진 경로 리스트, --real-scenes → 정수 리스트.
images_dir 해석 순서 (가게마다 load_image/<가게>/ 로 나눠 담는 걸 지원):
1) 절대경로면 그대로
2) 상대경로/이름이면 HERE/<값> (예: load_image/연산골막국수)
3) 그래도 없으면 HERE/load_image/<값> (예: --images 연산골막국수)
가장 먼저 '이미지가 들어있는' 폴더를 채택. 없으면 빈 리스트.
"""
real_images, used = [], None
if images_dir:
d = Path(images_dir)
candidates = [d] if d.is_absolute() else [HERE / d, HERE / "load_image" / d]
for c in candidates:
if c.exists() and c.is_dir():
imgs = sorted(p for p in c.iterdir() if p.suffix.lower() in IMG_EXTS)
if imgs:
real_images, used = imgs, c
break
if used:
print(f"■ 실제 사진 폴더: {used} ({len(real_images)}장)")
real_scenes = None
if real_scenes_arg:
real_scenes = [int(x) for x in re.split(r"[,\s]+", str(real_scenes_arg).strip()) if x]
return real_images, real_scenes
# 실제 사진 카드를 합성하는 장면에서, AI 배경이 카드 자리를 비워두도록 주는 포즈 힌트
PRESENT_POSES = [
"Place the cat king in the UPPER part of the frame, smiling and pointing down toward the "
"lower-center, leaving the lower-center area visually simple (a photo will be placed there).",
"Put the cat king on the LEFT side presenting with one paw to the right-center, keeping the "
"right-center area simple and uncluttered (a photo will be placed there).",
"Show the cat king at the BOTTOM looking up with sparkling eyes toward the upper-center, "
"keeping the upper-center area simple (a photo will be placed there).",
]
# PRESENT_POSES 순서에 맞춰 실제 사진 카드를 놓을 (가로,세로) 중심 비율
PRESENT_SPOTS = [(0.50, 0.62), (0.62, 0.50), (0.50, 0.40)]
# 고양이 왕의 '눈' 그림체를 귀엽게 유지하되, 눈을 '떴을 때'의 모양만 고정한다.
# (모든 장면을 동그란 뜬눈으로 강제하면 감김/실눈/윙크 같은 표정 다양성이 사라짐)
EYE_STYLE = (
"When the cat's eyes are open, they are the same cute friendly eyes: large round eyes "
"with big round solid black pupils and a small soft white highlight, gentle innocent "
"look. Keep this cute rounded eye style; never sharp, angry, fierce, glaring or "
"realistic predatory eyes."
)
# 눈을 감거나(감김/실눈/윙크/졸림/웃음·울음으로 눈이 변하는) 장면용: 표정은 장면대로 두되 화풍만 유지.
EYE_FREE = (
"In this scene the cat's eye EXPRESSION follows the moment — the eyes may be gently "
"closed, squinting, blinking, winking, teary or sleepy half-closed as appropriate. "
"Keep the same cute, soft, rounded drawing style (never sharp, angry or realistic), "
"but do NOT force wide-open round eyes here."
)
# image_prompt(영어)에 아래 표현이 있으면 '눈 표정 장면'으로 보고 뜬눈 고정/레퍼런스를 푼다.
_EYE_EXPR_KW = (
"closed eye", "eyes closed", "close its eye", "close his eye", "shut eye",
"shut its eye", "squint", "narrowed eye", "wink", "half-closed", "half closed",
"sleepy", "sleeping", "asleep", "dozing", "doze", "napping", "yawn", "drowsy",
"crying", "sob", "weeping", "tears", "teary", "laughing", "giggl", "chuckl",
"wince", "grimac", "blink",
)
def scene_needs_eye_expression(sc) -> bool:
"""장면이 눈 감김/실눈/윙크 등 '뜬눈 아닌' 표정을 필요로 하면 True."""
text = ((sc.get("image_prompt") or "") + " " + (sc.get("caption") or "")).lower()
return any(k in text for k in _EYE_EXPR_KW)
# 캐릭터 공식 레퍼런스: 이 폴더에 이미지를 넣어두면(예: king_ref.png),
# 모든 영상의 모든 컷이 그 고양이 왕의 얼굴/눈/복장/화풍을 그대로 따라간다.
CHAR_REF_DIR = HERE / "character"
def load_char_ref():
"""Shorts/character/ 안의 첫 이미지 바이트 반환(없으면 None). 모든 영상의 캐릭터 앵커로 쓰인다."""
if not CHAR_REF_DIR.is_dir():
return None
for p in sorted(CHAR_REF_DIR.iterdir()):
if p.suffix.lower() in IMG_EXTS:
return p.read_bytes()
return None
# ---------------------------------------------------------------- 이미지
def gen_image(client, prompt, ref_bytes=None, model=None, no_text=True,
ref_mode="full") -> bytes:
"""Gemini 이미지 생성. ref_bytes 주면 캐릭터 일관성 위해 레퍼런스로 사용.
model: 사용할 이미지 모델 (없으면 IMG_MODEL). 신형일수록 글자 렌더링 우수.
no_text: True 면 '그림에 글자 금지' 지시를 붙인다(글자 깨짐 방지).
ref_mode: 'full' = 레퍼런스의 캐릭터/복장/화풍을 통째로 유지.
'eyes' = 레퍼런스에선 '눈/표정만' 복제하고 복장·장면은 프롬프트대로.
"""
parts = []
if ref_bytes:
parts.append(types.Part.from_bytes(data=ref_bytes, mime_type="image/png"))
if ref_mode == "eyes":
prompt = ("Use the reference image ONLY to copy the cat character's EYES and "
"facial expression exactly: the same large round eyes with big round "
"solid black pupils and a small soft white highlight, gentle innocent "
"look. Do NOT copy the outfit, hat, robe color, pose, framing or "
"background from the reference — those follow the scene description. "
"New scene: " + prompt)
else:
prompt = ("Keep the EXACT same character design, outfit and art style as the "
"reference image. New scene: " + prompt)
parts.append(types.Part.from_text(text=prompt + (NO_TEXT if no_text else "")))
resp = client.models.generate_content(
model=model or IMG_MODEL,
contents=parts,
config=types.GenerateContentConfig(response_modalities=["IMAGE"]),
)
for p in resp.candidates[0].content.parts:
if getattr(p, "inline_data", None):
return p.inline_data.data
raise RuntimeError("이미지 파트 없음")
def composite_card(base_path, photo_path, out_path,
rel_w=0.60, center=(0.5, 0.60), angle=4.0, border=22):
"""AI 배경(base) 위에 '실제 사진'을 작은 폴라로이드 카드로 얹어 합성 저장.
사진은 원본 그대로(왜곡 X) 축소만 하고, 흰 테두리+그림자+살짝 기울기로 자연스럽게 올린다.
rel_w: 카드 사진 가로 = 화면폭 * rel_w. center: 카드 중심 (가로,세로) 비율. angle: 기울기(도).
"""
from PIL import Image, ImageFilter
base = Image.open(base_path).convert("RGBA")
photo = Image.open(photo_path).convert("RGB")
cw = int(W * rel_w)
ph = int(photo.height * (cw / photo.width))
max_h = int(H * 0.40) # 너무 길면 높이 기준으로 제한
if ph > max_h:
ph, cw = max_h, int(photo.width * (max_h / photo.height))
photo = photo.resize((cw, ph), Image.LANCZOS)
# 폴라로이드 흰 카드 (아래쪽 여백 좀 더)
card = Image.new("RGBA", (cw + 2 * border, ph + 2 * border + int(border * 1.4)),
(255, 255, 255, 255))
card.paste(photo, (border, border))
card = card.rotate(angle, expand=True, resample=Image.BICUBIC)
cx, cy = int(W * center[0]), int(H * center[1])
x, y = cx - card.width // 2, cy - card.height // 2
# 그림자
alpha = card.split()[3]
shadow = Image.new("RGBA", card.size, (0, 0, 0, 0))
shadow.paste(Image.new("RGBA", card.size, (0, 0, 0, 150)), (0, 0), alpha)
shadow = shadow.filter(ImageFilter.GaussianBlur(18))
base.alpha_composite(shadow, (x + 10, y + 16))
base.alpha_composite(card, (x, y))
base.convert("RGB").save(out_path)
def cover_crop(src: Path, dst: Path):
"""이미지를 1080x1920 꽉 차게 cover-crop 해서 저장."""
im = Image.open(src).convert("RGB")
scale = max(W / im.width, H / im.height)
nw, nh = int(im.width * scale + 0.5), int(im.height * scale + 0.5)
im = im.resize((nw, nh), Image.LANCZOS)
left, top = (nw - W) // 2, (nh - H) // 2
im.crop((left, top, left + W, top + H)).save(dst)
# ---------------------------------------------------------------- 음성
def _extract_audio(resp):
"""TTS 응답에서 (pcm, rate) 추출. 비었으면 None 반환(재시도 신호)."""
cands = getattr(resp, "candidates", None) or []
for c in cands:
content = getattr(c, "content", None)
parts = getattr(content, "parts", None) or [] if content else []
for p in parts:
inline = getattr(p, "inline_data", None)
if inline and inline.data:
m = re.search(r"rate=(\d+)", inline.mime_type or "")
return inline.data, (int(m.group(1)) if m else 24000)
return None
def gen_tts(client, text, voice, retries=4) -> bytes:
"""Gemini TTS. 프리뷰 모델이 가끔 빈 응답(content=None)을 주므로 재시도한다."""
last = ""
for attempt in range(1, retries + 1):
try:
resp = client.models.generate_content(
model=TTS_MODEL,
contents=f"{TTS_STYLE}\n\n{text}",
config=types.GenerateContentConfig(
response_modalities=["AUDIO"],
speech_config=types.SpeechConfig(
voice_config=types.VoiceConfig(
prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name=voice)
)
),
),
)
got = _extract_audio(resp)
if got:
return got
# 비었으면 왜 비었는지(finish_reason 등) 기록하고 재시도
fr = ""
try:
fr = str(getattr(resp.candidates[0], "finish_reason", "") or "")
except Exception:
fr = "no-candidates"
last = f"빈 응답(finish_reason={fr or '?'})"
except Exception as e:
last = f"{type(e).__name__}: {e}"
if attempt < retries:
wait = 2 * attempt # 2s, 4s, 6s … 점증 백오프
print(f"\n ↻ TTS 재시도 {attempt}/{retries-1} ({last}) — {wait}s 후",
end="", flush=True)
time.sleep(wait)
raise RuntimeError(f"TTS 실패(재시도 {retries}회): {last}\n 문장: {text[:40]}…")
def pcm_to_wav(pcm, path, rate):
with wave.open(str(path), "wb") as w:
w.setnchannels(1); w.setsampwidth(2); w.setframerate(rate)
w.writeframes(pcm)
def wav_seconds(path: Path) -> float:
with wave.open(str(path), "rb") as w:
return w.getnframes() / w.getframerate()
def _atempo_chain(speed: float) -> list:
"""atempo 는 0.5~2.0 범위만 받으므로 큰 배율은 곱으로 쪼개 체이닝."""
chain, s = [], speed
while s > 2.0:
chain.append("atempo=2.0"); s /= 2.0
while s < 0.5:
chain.append("atempo=0.5"); s *= 2.0
chain.append(f"atempo={s:.4f}")
return chain
def process_audio(exe, src_wav, dst_wav, speed=1.0, trim_silence=True,
threshold="-38dB", keep=0.06):
"""컷편집용 음성 가공: 앞뒤 침묵 제거 + 말 속도 올리기.
- trim_silence: 앞/뒤 침묵을 잘라 컷이 탁탁 넘어가게(가운데 호흡은 유지).
silenceremove 로 앞을 자르고, areverse 로 뒤집어 다시 앞(=원래 뒤)을 자른 뒤 복원.
keep: 잘라낸 끝에 남길 여유(초). 0 이면 너무 칼같이 잘려 어색할 수 있어 약간 남긴다.
- speed: 1.0=원본, 1.3 이면 30% 빠르게(음정 유지). 길이도 그만큼 줄어든다.
가공 결과가 비거나 실패하면 원본을 그대로 복사해 안전하게 폴백.
"""
af = []
if trim_silence:
one = (f"silenceremove=start_periods=1:start_silence={keep}:"
f"start_threshold={threshold}:detection=peak")
af += [one, "areverse", one, "areverse"]
if speed and abs(speed - 1.0) > 1e-3:
af += _atempo_chain(speed)
if not af:
shutil.copyfile(src_wav, dst_wav); return
try:
_run([exe, "-y", "-i", str(src_wav), "-af", ",".join(af),
"-ar", "24000", "-ac", "1", str(dst_wav)])
if wav_seconds(dst_wav) < 0.15: # 과하게 잘렸으면 폴백
raise RuntimeError("가공 후 음성이 너무 짧음")
except (RuntimeError, OSError):
shutil.copyfile(src_wav, dst_wav)
# ---------------------------------------------------------------- 조립 (ffmpeg 직접 렌더)
FPS = 30
def _ffmpeg() -> str:
import imageio_ffmpeg
return imageio_ffmpeg.get_ffmpeg_exe()
def _run(cmd):
r = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace")
if r.returncode != 0:
raise RuntimeError("ffmpeg 실패:\n" + (r.stderr or "")[-1500:])
return r
def pick_encoder(exe) -> list:
"""Intel QSV 하드웨어 인코딩이 실제로 동작하면 그걸, 아니면 libx264 ultrafast."""
test = subprocess.run(
[exe, "-hide_banner", "-f", "lavfi", "-i", "color=c=black:s=128x128:d=1",
"-c:v", "h264_qsv", "-f", "null", "-"],
capture_output=True, text=True, errors="replace")
if test.returncode == 0:
print(" 인코더: h264_qsv (Intel 하드웨어)")
return ["-c:v", "h264_qsv", "-global_quality", "24", "-preset", "fast"]
print(" 인코더: libx264 (superfast)")
return ["-c:v", "libx264", "-preset", "superfast", "-crf", "26"]
def _wrap_lines(draw, text, font, max_w):
"""글자 단위로 픽셀 폭(max_w)에 맞춰 줄바꿈."""
lines, cur = [], ""
for ch in text:
if ch == "\n":
lines.append(cur); cur = ""; continue
if draw.textlength(cur + ch, font=font) <= max_w:
cur += ch
else:
lines.append(cur); cur = ch
if cur:
lines.append(cur)
return lines or [""]
def _blossom(d, cx, cy, r, color):
"""간단한 5장 꽃잎 벚꽃 장식(제목 양옆 무늬)."""
import math
pr = r * 0.62 # 꽃잎 반지름
for k in range(5):
a = math.radians(-90 + k * 72)
px, py = cx + r * 0.55 * math.cos(a), cy + r * 0.55 * math.sin(a)
d.ellipse([px - pr, py - pr, px + pr, py + pr], fill=color)
d.ellipse([cx - r * 0.32, cy - r * 0.32, cx + r * 0.32, cy + r * 0.32],
fill=(255, 238, 175, 255)) # 꽃심
_LOGO_RGBA = None
def _brand_logo():
"""제목 옆 AI O2O 로고를 캐시 로드(흰 배경→투명, 검정 톤 통일). 파일 없으면 None."""
global _LOGO_RGBA
if _LOGO_RGBA is not None:
return _LOGO_RGBA
if not Path(BRAND_LOGO).exists():
return None
# 흰 배경 PNG → 밝기를 알파로 반전(검은 획=불투명, 흰 배경=투명). 안티에일리어싱도 자연 반투명.
g = Image.open(BRAND_LOGO).convert("L")
alpha = g.point(lambda p: 255 - p)
logo = Image.new("RGBA", g.size, (30, 30, 30, 255))
logo.putalpha(alpha)
_LOGO_RGBA = logo
return logo
def render_band_png(text, out_path, font_path, title=BRAND_TITLE):
"""상단 흰 밴드에 제목('썰박스' + '×' + AI O2O 로고) + 나레이션(검정 글씨)을 그린 1080x1920 PNG.
밴드 아래는 투명 → 그 자리에 그림이 들어가 '그림을 가리지 않는' 만화컷 레이아웃."""
from PIL import ImageDraw, ImageFont
band_h = int(H * BAND_RATIO)
img = Image.new("RGBA", (W, H), (0, 0, 0, 0))
d = ImageDraw.Draw(img)
d.rectangle([0, 0, W, band_h], fill=(255, 255, 255, 255)) # 흰 밴드
d.line([(0, band_h - 2), (W, band_h - 2)], fill=(0, 0, 0, 38), width=2) # 옅은 구분선
# ── 제목: "썰박스" + "×" + AI O2O 로고 를 가로 중앙에 나란히 ──
title_y = int(H * 0.012)
title_fp = TITLE_FONT if Path(TITLE_FONT).exists() else font_path
tf = ImageFont.truetype(title_fp, TITLE_SIZE)
cy = title_y + TITLE_SIZE / 2 # 제목 요소 세로 중심
ink = (30, 30, 30, 255)
sep = "×" # 곱셈기호(×) — 콜라보 표기
gap = 26
w_title = d.textlength(title, font=tf)
w_sep = d.textlength(sep, font=tf)
logo = _brand_logo()
logo_h = 0
if logo is not None:
logo_h = int(TITLE_SIZE * 1.05)
logo_w = max(1, int(logo.width * logo_h / logo.height))
logo = logo.resize((logo_w, logo_h), Image.LANCZOS)
else:
logo_w = 0
total = w_title + gap + w_sep + (gap + logo_w if logo is not None else 0)
group_left = (W - total) / 2
x = group_left
d.text((x, cy), title, font=tf, fill=ink, anchor="lm")
x += w_title + gap
d.text((x, cy), sep, font=tf, fill=ink, anchor="lm")
x += w_sep + gap
if logo is not None:
img.alpha_composite(logo, (int(x), int(cy - logo_h / 2)))
# 제목 그룹 양옆 벚꽃(원래 디자인 유지)
rose = (228, 150, 168, 255)
bgap = 46
_blossom(d, group_left - bgap, cy, 17, rose)
_blossom(d, group_left + total + bgap, cy, 17, rose)
rule_y = title_y + TITLE_SIZE + 26 # 제목 아래 구분선: 화면 끝까지, 불투명
d.line([(0, rule_y), (W, rule_y)], fill=(60, 60, 60, 255), width=4)
# 나레이션: 기본은 NARR_SIZE, 밴드 높이를 넘칠 만큼 길면 폰트를 자동 축소해
# 항상 흰 밴드 '안'에만 그린다(넘쳐서 아래 그림을 침범하지 않도록). 세로 가운데 정렬.
top = rule_y + 22
avail = band_h - top - 24
size = NARR_SIZE
while size > NARR_MIN_SIZE:
f = ImageFont.truetype(font_path, size)
lines = _wrap_lines(d, text, f, W - 150)
lh = int(size * 1.4)
if len(lines) * lh <= avail:
break
size -= 2
else:
f = ImageFont.truetype(font_path, NARR_MIN_SIZE)
lines = _wrap_lines(d, text, f, W - 150)
lh = int(NARR_MIN_SIZE * 1.4)
y = top + max(0, (avail - len(lines) * lh) // 2)
for ln in lines:
d.text((W / 2, y), ln, font=f, fill=(20, 20, 20, 255), anchor="ma")
y += lh
img.save(out_path)
LINK_CTA = "링크는 고정댓글 확인" # ▼ 등 특수문자는 자막 폰트(주아체)에 없어 □로 깨짐 → 한글만
def render_link_card_png(base_img_path, link, out_path, font_path, store=None, cta=None):
"""배경 사진을 어둡게 깔고 가게 이름 + 안내문구 + 링크를 큼직하게 그린 1080x1920 PNG."""
from PIL import ImageDraw, ImageFont
base = Image.open(base_img_path).convert("RGB")
base = Image.blend(base, Image.new("RGB", base.size, (0, 0, 0)), 0.55)
d = ImageDraw.Draw(base)
def centered(text, y, size, fill, fit_one_line=False):
if fit_one_line: # 한 줄에 들어갈 때까지 폰트 축소
while size > 40 and d.textlength(text, font=ImageFont.truetype(font_path, size)) > W - 140:
size -= 4
f = ImageFont.truetype(font_path, size)
for ln in _wrap_lines(d, text, f, W - 140):
w = d.textlength(ln, font=f)
d.text(((W - w) / 2, y), ln, font=f, fill=fill,
stroke_width=5, stroke_fill="black")
y += int(size * 1.25)
if store:
centered(store, int(H * 0.33), 88, "white", fit_one_line=True)
centered(cta or LINK_CTA, int(H * 0.43), 58, "#FFFFFF", fit_one_line=True)
centered(link, int(H * 0.51), 72, "#FFE94A", fit_one_line=True)
base.save(out_path)
# 모든 세그먼트를 같은 규격으로 만들어 concat copy 가 되게 한다.
_AUDIO_ARGS = ["-c:a", "aac", "-b:a", "160k", "-ar", "44100", "-ac", "2"]
# ---------------------------------------------------------------- BGM
AUDIO_EXTS = (".mp3", ".wav", ".m4a", ".aac", ".ogg", ".flac", ".opus")
def resolve_bgm(bgm_arg):
"""--bgm 값 → 실제 음악 파일 경로(없으면 None).
해석 순서(가게/분위기별로 bgm/ 폴더에 나눠 담는 걸 지원):
1) 파일이면 그대로
2) 폴더면 그 안 음악 중 무작위 1곡 (병맛 BGM 여러 개 넣어두고 매번 다르게)
3) 이름만 주면 HERE/<값> → HERE/bgm/<값> 순으로 파일/폴더 탐색
"""
if not bgm_arg or str(bgm_arg).strip().lower() in ("none", "off", "no"):
return None
import random
p = Path(bgm_arg)
cands = [p] if p.is_absolute() else [HERE / p, HERE / "bgm" / p]
for c in cands:
if c.is_file():
return c
if c.is_dir():
files = [f for f in sorted(c.iterdir()) if f.suffix.lower() in AUDIO_EXTS]
if files:
return random.choice(files)
return None
def mix_bgm(exe, video_path, bgm_path, out_path, volume=0.3, fade=1.0):
"""완성 영상(나레이션 음성 포함) 위에 BGM 한 트랙을 작은 볼륨으로 깔아 최종본 저장.
- BGM 이 영상보다 짧으면 무한 루프(-stream_loop -1), 길면 영상 길이에 맞춰 잘림.
- 나레이션[0:a] + BGM[1:a]*volume 를 amix(duration=first)로 섞어 영상 길이에 맞춘다.
- 영상은 재인코딩하지 않는다(-c:v copy) → 빠름. 시작에 짧은 페이드인.
"""
fc = (f"[1:a]volume={volume},afade=t=in:st=0:d={fade}[bg];"
f"[0:a][bg]amix=inputs=2:duration=first:dropout_transition=0[a]")
_run([exe, "-y", "-i", str(video_path), "-stream_loop", "-1", "-i", str(bgm_path),
"-filter_complex", fc, "-map", "0:v", "-map", "[a]",
"-c:v", "copy", *_AUDIO_ARGS, "-shortest", "-movflags", "+faststart",
str(out_path)])
# Shared low-level media utilities. Keep local render.py for per-feature
# layout, prompts, local fonts, BGM folder resolution, and produce().
_ffmpeg = MU._ffmpeg
_run = MU._run
pick_encoder = MU.pick_encoder
pcm_to_wav = MU.pcm_to_wav
wav_seconds = MU.wav_seconds
process_audio = MU.process_audio
_wrap_lines = MU._wrap_lines
mix_bgm = MU.mix_bgm
def _scene_motion(idx: int, n: int, frames: int) -> str:
"""장면별 zoompan 카메라 모션(z/x/y 표현식만 반환 — d/s/fps 는 호출부에서 붙임).
- 1번 컷(훅): 펀치인 — 1.30 에서 확 들어와 시선 고정 후 서서히 줌
- 뒤에서 3번째 컷(피벗 추정 — 억지 광고 전환): 셰이크. 장면 역할 태그가
스토리보드에 없어 위치 휴리스틱(hook→story→pivot→cta 순서상 cta 직전)
- 나머지: 줌인 / 줌아웃 / 좌→우 팬 / 우→좌 팬 순환
"""
center = "x='iw/2-(iw/zoom/2)':y='ih/2-(ih/zoom/2)'"
f = max(frames, 1)
if idx == 1: # 훅: 리빌(살짝 당김→전체)
return f"zoompan=z='max(1.10-0.10*on/{f},1.0)':{center}"
if n >= 6 and idx == n - 2: # 피벗: 아주 약한 흔들림(줌 1.06 유지)
return ("zoompan=z='1.06':"
"x='iw/2-(iw/zoom/2)+8*sin(on*1.6)':"
"y='ih/2-(ih/zoom/2)+6*cos(on*2.2)'")
kind = idx % 4
if kind == 0: # 줌아웃(끝에 전체)
return f"zoompan=z='max(1.10-0.10*on/{f},1.0)':{center}"
if kind == 1: # 줌인(시작에 전체)
return f"zoompan=z='min(1.0+0.10*on/{f},1.10)':{center}"
if kind == 2: # 약한 좌→우 팬(줌 1.06, ~6%만 이동)
return f"zoompan=z='1.06':x='(iw-iw/zoom)*on/{f}':y='ih/2-(ih/zoom/2)'"
return f"zoompan=z='1.06':x='(iw-iw/zoom)*(1-on/{f})':y='ih/2-(ih/zoom/2)'"
def build_video(scenes, audio_paths, img_paths, out_path, link=None, link_seconds=3.0,
store=None, cta=None, speed=1.0, trim_silence=True, tail=0.15,
bgm=None, bgm_volume=0.3):
"""장면별 ffmpeg 세그먼트(Ken Burns 줌 + 자막 오버레이 + 음성) → concat 으로 최종 mp4.
speed/trim_silence: 컷편집 느낌 — 음성을 빠르게 + 앞뒤 침묵 제거(→ 컷이 타이트).
tail: 각 컷 음성 끝에 붙일 정적(초). 0 이면 말 끝나자마자 바로 다음 컷.
bgm: 배경음악 파일 경로. 주면 concat 후 BGM 을 작은 볼륨으로 깔아 한 번 더 믹스.
bgm_volume: BGM 볼륨(0~1). 기본 0.12 = 나레이션 안 묻히게 12%.
"""
print("[4/4] 영상 합성...", flush=True)
exe = _ffmpeg()
enc = pick_encoder(exe)
font = FONT if Path(FONT).exists() else FONT_FALLBACK
out_path = Path(out_path)
tmp = out_path.parent / "_render"
tmp.mkdir(exist_ok=True)
segs = []
total = 0.0
for idx, (sc, ap, ip) in enumerate(zip(scenes, audio_paths, img_paths), 1):
# 컷편집용으로 음성 가공(빠르게 + 침묵 제거) 후 그 길이를 컷 길이로 사용
proc_ap = tmp / f"aud{idx:02d}.wav"
process_audio(exe, ap, proc_ap, speed=speed, trim_silence=trim_silence)
speech = wav_seconds(proc_ap)
dur = speech + max(0.0, tail) # 말 끝나고 약간의 여운만
frames = max(1, round(dur * FPS))
sub_png = tmp / f"sub{idx:02d}.png"
# 화면 자막 = 그 장면에서 '말하는 문장'(나레이션) 그대로 → 무음 시청자도 내용 전달
render_band_png(sc.get("narration") or sc.get("caption", ""), sub_png, font)
seg = tmp / f"seg{idx:02d}.mp4"
# 레이아웃: 흰 배경 위 → 그림은 상단 밴드 '아래' 영역에만(안 가림) → 밴드 PNG 오버레이
band_h = int(H * BAND_RATIO)
img_h = H - band_h
bw, bh = int(W * 3), int(img_h * 3) # zoompan 정수픽셀 반올림 떨림 방지용 업스케일(2배는 떨림 재발, 3배로 메모리·화질 절충)
motion = _scene_motion(idx, len(scenes), frames)
fd = min(0.18, dur / 4) # 컷 전환 화이트 페이드(짧은 컷은 비례 축소)
# 페이드는 '그림'에만 → 캡션(자막)은 그 위에 나중에 얹어 항상 선명하게 유지.
# 첫 컷(hook)은 흰 화면 없이 바로 이미지로 시작 → 페이드인은 2번째 컷부터.
fades = "" if idx == 1 else f"fade=t=in:st=0:d={fd:.2f}:color=white,"
fades += f"fade=t=out:st={max(dur - fd, 0):.2f}:d={fd:.2f}:color=white"
fc = (f"color=c=white:s={W}x{H}:r={FPS}[bg];"
f"[0:v]scale={bw}:{bh}:force_original_aspect_ratio=increase:flags=lanczos,"
f"crop={bw}:{bh},"
f"{motion}:d={frames}:s={W}x{img_h}:fps={FPS}[img];"
f"[bg][img]overlay=0:{band_h},{fades}[base];"
f"[base][1:v]overlay=0:0[v]")
# 음성 뒤에 tail 만큼 무음을 붙여 영상 길이와 맞춤(apad + -t 로 컷)
_run([exe, "-y", "-loop", "1", "-i", str(ip), "-i", str(sub_png), "-i", str(proc_ap),
"-filter_complex", fc, "-map", "[v]", "-map", "2:a",
"-af", "apad", "-t", f"{dur:.3f}", "-r", str(FPS), *enc, *_AUDIO_ARGS,
"-pix_fmt", "yuv420p", str(seg)])
segs.append(seg)
total += dur
print(f"[{idx:2d}] 세그먼트 (말 {speech:.1f}초 → 컷 {dur:.1f}초)")
print(f" ▶ 본편 합계 {total:.1f}초" + (f" + 링크 {link_seconds:.1f}초" if link else ""))
# 링크 카드 (무음)
if link and img_paths:
card_png = tmp / "linkcard.png"
render_link_card_png(img_paths[-1], link, card_png, font, store=store, cta=cta)
seg = tmp / "seg_link.mp4"
_run([exe, "-y", "-loop", "1", "-i", str(card_png),
"-f", "lavfi", "-i", "anullsrc=r=44100:cl=stereo",
"-t", f"{link_seconds:.3f}", "-r", str(FPS), *enc, *_AUDIO_ARGS,
"-pix_fmt", "yuv420p", str(seg)])
segs.append(seg)
print(f"[링크] 카드 세그먼트 ({link_seconds:.1f}초)")
# concat (재인코딩 없이 복사 → 즉시). 실패하면 재인코딩으로 폴백.
# BGM 이 있으면 일단 임시 본편으로 이어붙이고, 그 위에 BGM 을 믹스해 최종본을 만든다.
listf = tmp / "concat.txt"
# concat 목록은 절대경로로 (ffmpeg 가 목록파일 위치 기준으로 상대경로를 또 해석하는 문제 방지)
listf.write_text("".join(f"file '{s.resolve().as_posix()}'\n" for s in segs), encoding="utf-8")
concat_out = (tmp / "_body.mp4") if bgm else out_path
try:
_run([exe, "-y", "-f", "concat", "-safe", "0", "-i", str(listf),
"-c", "copy",
# AAC priming(1024샘플) 탓에 concat 이 비디오 시작 pts 를 +0.023s 밀어버리면
# 페북/인스타(Buffer) 썸네일 추출(t=0)이 빈 구간=검은 화면을 잡는다 → pts 0 으로 재작성.
"-bsf:v", "setts=ts=TS-STARTDTS:pts=PTS-STARTPTS",
"-movflags", "+faststart", str(concat_out)])
except RuntimeError:
_run([exe, "-y", "-f", "concat", "-safe", "0", "-i", str(listf),
*enc, *_AUDIO_ARGS, "-pix_fmt", "yuv420p", "-movflags", "+faststart",
str(concat_out)])
if bgm:
mix_bgm(exe, concat_out, bgm, out_path, volume=bgm_volume)
print(f" ♪ BGM 믹스: {Path(bgm).name} (볼륨 {bgm_volume})")
shutil.rmtree(tmp, ignore_errors=True)
def _mime_of(path) -> str:
return "image/jpeg" if Path(path).suffix.lower() in (".jpg", ".jpeg") else "image/png"
def analyze_photo(client, photo_path) -> str:
"""실제 사진 1장을 Gemini 비전으로 보고 짧은 한국어 라벨 반환 (예: '수육 한 접시')."""
data = Path(photo_path).read_bytes()
resp = client.models.generate_content(
model=VISION_MODEL,
contents=[
types.Part.from_bytes(data=data, mime_type=_mime_of(photo_path)),
types.Part.from_text(text=(
"이 사진의 핵심 대상을 한국어 명사구 12자 이내로만 답해. "
"음식이면 메뉴명(예: '수육', '메밀국수'), 가게면 '가게 외관'/'매장 내부', "
"메뉴판이면 '메뉴판'. 설명·문장 금지, 라벨만.")),
],
)
return (resp.text or "").strip().splitlines()[0][:20] if resp.text else ""
_MATCH_SCHEMA = {
"type": "object",
"properties": {
"assignments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"photo_index": {"type": "integer"},
"scene_number": {"type": "integer"},
},
"required": ["photo_index", "scene_number"],
},
}
},
"required": ["assignments"],
}
def match_real_scenes(client, scenes, real_images, max_real=3) -> dict:
"""각 실제 사진을 비전 분석 → 내용이 가장 맞는 장면에 배치한 {장면번호: 사진경로} 반환.
실패하면 위치 기반(plan_real_scenes)으로 폴백한다.
"""
real_images = list(real_images or [])
if not real_images:
return {}
# 1) 사진별 내용 라벨
labels = []
for p in real_images:
try:
lab = analyze_photo(client, p)
except Exception:
lab = ""
labels.append(lab)
print(f" · {Path(p).name} → '{lab or '?'}'")
# 2) 라벨 ↔ 장면 매칭 (구조화 출력 1회)
scene_lines = "\n".join(
f"{i+1}. [{s.get('caption','')}] {s.get('narration','')}"
for i, s in enumerate(scenes))
photo_lines = "\n".join(f"{i}. {labels[i] or '내용불명'}" for i in range(len(real_images)))
prompt = (
"아래는 영상의 '장면 목록'과, 영상에 넣을 '실제 사진'들의 내용 라벨이다.\n"
"각 사진을 그 내용이 가장 잘 어울리는 장면에 배치하라.\n"
"[규칙]\n"
"- 한 장면엔 사진 하나, 한 사진은 한 장면에만.\n"
"- 그 음식/메뉴/가게를 직접 언급·소개하는 장면에 우선 배치.\n"
"- 비슷하면 마케팅/소개가 나오는 뒤쪽 장면을 선호.\n"
f"- 최대 {max_real}장까지만 배치(나머지는 제외).\n\n"
f"[장면 목록]\n{scene_lines}\n\n[사진 라벨]\n{photo_lines}\n")
try:
resp = client.models.generate_content(
model=VISION_MODEL,
contents=prompt,
config=types.GenerateContentConfig(
temperature=0.2,
response_mime_type="application/json",
response_schema=_MATCH_SCHEMA,
),
)
assigns = json.loads(resp.text).get("assignments", [])
except Exception as e:
print(f" (매칭 실패 → 위치 기반으로 폴백: {type(e).__name__})")
return plan_real_scenes(scenes, real_images, None, max_real)
real_map, used_photo = {}, set()
for a in assigns:
pi, sn = a.get("photo_index"), a.get("scene_number")
if pi is None or sn is None:
continue
if 0 <= pi < len(real_images) and 1 <= sn <= len(scenes) \
and pi not in used_photo and sn not in real_map:
real_map[sn] = Path(real_images[pi])
used_photo.add(pi)
if len(real_map) >= max_real:
break
return real_map or plan_real_scenes(scenes, real_images, None, max_real)
def plan_real_scenes(scenes, real_images, real_scenes=None, max_real=3) -> dict:
"""어느 장면 번호(1-based)에 어떤 실제 사진을 깔지 매핑 dict 로 반환.
- real_scenes 가 주어지면 그 장면 번호들에 사진을 순서대로 매핑.
- 없으면 '뒤쪽(마케팅 전환부) 장면들'에 사진 개수만큼(최대 max_real) 자동 배치.
"""
real_images = list(real_images or [])
real_map = {}
if not real_images:
return real_map
if real_scenes:
for no, img in zip(real_scenes, real_images):
if 1 <= no <= len(scenes):
real_map[no] = Path(img)
else:
n = min(len(real_images), max_real, len(scenes))
start = len(scenes) - n + 1 # 뒤에서 n개
for k in range(n):
real_map[start + k] = Path(real_images[k])
return real_map
def produce(client, sb, stem, workdir=None, voice=TTS_VOICE, force=False,
real_images=None, real_scenes=None, max_real=3, match_content=True,
link=None, link_seconds=3.0, store=None, cta=None,
img_model=None, allow_text=False,
speed=1.0, trim_silence=True, tail=0.15, workers=4,
bgm=None, bgm_volume=0.3) -> Path:
"""스토리보드 dict → 장면별 이미지/음성 생성 후 mp4 합성. 완성 경로 반환.
workdir: 이 작업의 결과/중간파일을 담을 폴더. 이미지·음성은 workdir/assets/ 에,
완성 mp4 는 workdir/{stem}.mp4 로 저장한다. (기본: output/{stem})
real_images: 실제 사진(가게/메뉴판 등) 경로 리스트. 뒤쪽 장면에 깔아 AI 컷과 섞는다.
real_scenes: 실제 사진을 깔 장면 번호(1-based) 리스트. 없으면 뒤쪽 자동.
max_real: 자동 배치 시 실제 사진으로 채울 최대 장면 수.
link: 주면 맨 마지막에 링크 카드 1장을 붙인다.
"""
scenes = sb["scenes"]
style = sb.get("style_guide", "")
char = sb.get("character_sheet", "")
workdir = Path(workdir) if workdir else (OUT_DIR / stem)
workdir.mkdir(parents=True, exist_ok=True)
assets = workdir / "assets"
assets.mkdir(exist_ok=True)
# 실제 사진 → 장면 배치 결정
# · real_scenes 수동지정이 최우선
# · 아니면 내용 매칭(비전). 단, 새로 생성할 장면이 있을 때만(전부 캐시면 비전 호출 낭비라 생략)
real_images = list(real_images or [])
# max_real 이 None/0/음수면 '폴더 사진 전부 사용'(장면 수 한도 내)
eff_max = max_real if (max_real and max_real > 0) else len(real_images)
need_gen = force or any(not (assets / f"scene{i:02d}.png").exists()
for i in range(1, len(scenes) + 1))
if not real_images:
real_map = {}
elif real_scenes:
real_map = plan_real_scenes(scenes, real_images, real_scenes, eff_max)
elif match_content and client is not None and need_gen:
print(f"■ 실제 사진 내용 분석(Gemini 비전) → 장면 매칭 (최대 {eff_max}장)")
real_map = match_real_scenes(client, scenes, real_images, eff_max)
else:
real_map = plan_real_scenes(scenes, real_images, None, eff_max)
real_order = {no: k for k, no in enumerate(sorted(real_map))} # 포즈/위치 번갈아 쓰기용
if real_map:
picks = ", ".join(f"{no}←{real_map[no].name}" for no in sorted(real_map))
print(f"■ 실제 사진 합성 장면: {picks}")
from concurrent.futures import ThreadPoolExecutor, as_completed
img_paths = [assets / f"scene{i:02d}.png" for i in range(1, len(scenes) + 1)]
audio_paths = [assets / f"scene{i:02d}.wav" for i in range(1, len(scenes) + 1)]
def make_image(i, ref, ref_mode="full"):
"""장면 i 이미지 1장 생성(필요시 실사진 합성). ref=캐릭터 앵커 바이트."""
sc = scenes[i - 1]
raw_png = assets / f"scene{i:02d}_raw.png"
img_png = assets / f"scene{i:02d}.png"
# 눈 표정 장면(감김/실눈/윙크/졸림/웃음·울음 등)은 뜬눈 고정을 풀고 표정대로 그린다.
# · '눈만 고정(eyes)' 레퍼런스도 이런 장면에선 빼야 눈이 안 떠짐.
free_eyes = scene_needs_eye_expression(sc)
eye = EYE_FREE if free_eyes else EYE_STYLE
use_ref = None if (free_eyes and ref_mode == "eyes") else ref
if i in real_map:
k = real_order[i]
pose = PRESENT_POSES[k % len(PRESENT_POSES)]
spot = PRESENT_SPOTS[k % len(PRESENT_SPOTS)]
prompt = (f"{style}. {char}. {eye} Scene: {sc['image_prompt']}. {pose} "
f"Vertical 9:16 composition.")
data = gen_image(client, prompt, ref_bytes=use_ref, model=img_model,
no_text=not allow_text, ref_mode=ref_mode)
raw_png.write_bytes(data)
cover_crop(raw_png, img_png) # 1) AI 배경
composite_card(img_png, real_map[i], img_png, center=spot) # 2) 실사진 카드
else:
prompt = f"{style}. {char}. {eye} Scene: {sc['image_prompt']}. Vertical 9:16 composition."
data = gen_image(client, prompt, ref_bytes=use_ref, model=img_model,
no_text=not allow_text, ref_mode=ref_mode)
raw_png.write_bytes(data)
cover_crop(raw_png, img_png)
import time as _tm; _t_img = _tm.monotonic()
# --- 이미지: 캐릭터 앵커(1컷) 먼저, 나머지는 병렬 ---
# 앵커 의존성: 모든 컷이 1번 컷(캐릭터)을 ref 로 참조해야 일관성이 유지된다.
# → 앵커 1장만 순차로 만든 뒤, 나머지는 동시에 생성(서로 독립).
need_img = [i for i in range(1, len(scenes) + 1)
if force or not img_paths[i - 1].exists()]
cached_img = [i for i in range(1, len(scenes) + 1) if i not in need_img]
for i in cached_img:
print(f"[{i:2d}] 이미지 캐시 사용")
# 공식 캐릭터 레퍼런스가 있으면 '눈만 고정' 모드: 모든 컷이 레퍼런스에서 눈/표정만 복제.
# 곤룡포·관모 등 복장은 복제하지 않고 왕별 character_sheet/장면 프롬프트대로 그려진다.
char_ref = load_char_ref()
if char_ref is not None:
print("■ 캐릭터 레퍼런스(눈만 고정) 사용: Shorts/character/ "
"→ 눈/표정은 통일, 복장은 왕별로 다르게")
ref_bytes, ref_mode, anchor = char_ref, "eyes", None
else:
ref_mode = "full"
ref_bytes = None
for i in range(1, len(scenes) + 1): # 캐시된 raw 가 있으면 앵커로 재사용
raw = assets / f"scene{i:02d}_raw.png"
if raw.exists() and not force:
ref_bytes = raw.read_bytes(); break
anchor = None
if ref_bytes is None:
anchor = next((i for i in need_img if i not in real_map), None)
if anchor is not None:
print(f"[{anchor:2d}] 캐릭터 앵커 이미지 생성...", flush=True)
make_image(anchor, None)
ref_bytes = (assets / f"scene{anchor:02d}_raw.png").read_bytes()
rest = [i for i in need_img if i != anchor]
if rest:
print(f"■ 이미지 {len(rest)}장 병렬 생성 (워커 {workers})...", flush=True)
with ThreadPoolExecutor(max_workers=workers) as ex:
futs = {ex.submit(make_image, i, ref_bytes, ref_mode): i for i in rest}
for fut in as_completed(futs):
i = futs[fut]; fut.result()
tag = f"실사합성({real_map[i].name})" if i in real_map else "이미지"
print(f"[{i:2d}] {tag} done", flush=True)
print(f"[⏱] 이미지 {_tm.monotonic() - _t_img:.1f}초", flush=True); _t_tts = _tm.monotonic()
# --- 음성: 전부 독립 → 병렬 ---
def make_tts(i):
text = (scenes[i - 1].get("narration") or "").strip()
if not text:
# 빈 나레이션 방어: TTS 가 빈 텍스트에 빈 응답을 반복하다 죽으므로 0.3초 무음으로 대체.
# (정상 경로에선 gen_storyboard 가 빈 장면을 미리 거르지만, 만약을 대비한 이중 안전장치)
pcm_to_wav(b"\x00\x00" * int(24000 * 0.3), audio_paths[i - 1], 24000)
return
pcm, rate = gen_tts(client, text, voice)
pcm_to_wav(pcm, audio_paths[i - 1], rate)
need_wav = [i for i in range(1, len(scenes) + 1)
if force or not audio_paths[i - 1].exists()]
for i in (i for i in range(1, len(scenes) + 1) if i not in need_wav):
print(f" [{i:2d}] 음성 캐시 사용 ({wav_seconds(audio_paths[i - 1]):.1f}초)")
if need_wav:
print(f"■ 음성 {len(need_wav)}개 병렬 생성 (워커 {workers})...", flush=True)
with ThreadPoolExecutor(max_workers=workers) as ex:
futs = {ex.submit(make_tts, i): i for i in need_wav}
for fut in as_completed(futs):
i = futs[fut]; fut.result()
print(f" [{i:2d}] 음성 {wav_seconds(audio_paths[i - 1]):.1f}초", flush=True)
print(f"[⏱] 음성 {_tm.monotonic() - _t_tts:.1f}초", flush=True)
out = workdir / f"{stem}.mp4"
print(f"\n영상 합성 → {out.name}")
build_video(scenes, audio_paths, img_paths, out, link=link, link_seconds=link_seconds,
store=store, cta=cta, speed=speed, trim_silence=trim_silence, tail=tail,
bgm=bgm, bgm_volume=bgm_volume)
print(f"완성: {out}")
return out
+270
View File
@@ -0,0 +1,270 @@
# -*- coding: utf-8 -*-
"""
나무위키 조선 왕 '썰 키워드' 스크래퍼
====================================
조선 27대 왕의 나무위키 문서에서 목차(섹션 제목)를 긁어와
숏폼 소재가 될 만한 '썰/일화 키워드'를 추출해 JSON / CSV 로 저장한다.
나무위키는 Cloudflare 보호 + JS 렌더링이라 requests 로는 막히므로
Playwright(Chromium)로 실제 브라우저를 띄워 렌더링된 목차를 읽는다.
설치:
pip install playwright beautifulsoup4
playwright install chromium # (이미 설치돼 있으면 생략)
실행:
python namu_joseon_scraper.py
옵션:
python namu_joseon_scraper.py --headful # 브라우저 창 보이게
python namu_joseon_scraper.py --only 세종 광해군 # 특정 왕만
"""
import argparse
import asyncio
import csv
import json
import re
import sys
from datetime import datetime
from pathlib import Path
from playwright.async_api import async_playwright
# ----------------------------------------------------------------------------
# 설정
# ----------------------------------------------------------------------------
BASE = "https://namu.wiki/w/"
OUT_DIR = Path(__file__).parent / "data" # 조선왕 일화 CSV/JSON(선행 데이터). ★ output/ 아님 — 거긴 mp4만.
# 조선 27대 왕: (대수, 묘호/군호, 나무위키 문서 제목)
# 군주는 보통 "묘호(조선)" 형태, 폐위된 임금(연산군/광해군)은 군호 단독.
JOSEON_KINGS = [
(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, "순종", "순종(대한제국)"),
]
# 썰/일화/논란성 키워드가 모이는 섹션 (목차 제목에 이 단어가 들어가면 '썰' 우선순위↑)
ANECDOTE_HINTS = [
"여담", "일화", "야사", "평가", "논란", "비판", "사건", "기타",
"이야기", "에피소드", "어록", "대중매체", "미디어", "기록", "사망", "죽음",
"독살", "암살", "치세", "업적", "가족", "후궁", "이름", "별명",
]
def clean_heading(text: str) -> str:
"""목차 항목 텍스트 정리: 앞 번호와 [편집] 등 제거."""
t = text.replace("[편집]", "").strip()
# 앞쪽 "1.", "2.3.", "10." 같은 목차 번호 제거
t = re.sub(r"^\s*[\d.]+\s*", "", t)
return t.strip()
def is_anecdote(keyword: str) -> bool:
return any(h in keyword for h in ANECDOTE_HINTS)
async def scrape_king(page, title: str):
"""한 왕 문서를 열고 목차 키워드 목록을 반환."""
url = BASE + title
result = {"title": title, "url": url, "page_title": None,
"keywords": [], "anecdote_keywords": [], "error": None}
try:
resp = await page.goto(url, wait_until="domcontentloaded", timeout=45000)
# 고정 sleep 대신 목차 요소가 뜰 때까지만 대기 (없으면 짧게 폴백)
try:
await page.wait_for_selector(
'.wiki-macro-toc a, [class*="toc"] a, .toc-item a',
timeout=8000,
)
except Exception:
# 목차가 없는 문서일 수 있으니 헤딩 렌더만 잠깐 기다림
await page.wait_for_timeout(800)
# 문서 실제 제목
try:
result["page_title"] = (await page.title()).split(" - ")[0].strip()
except Exception:
pass
if resp and resp.status >= 400:
result["error"] = f"HTTP {resp.status}"
return result
# 렌더링된 목차/제목에서 키워드 추출 (클래스명이 자주 바뀌므로 여러 선택자 시도)
keywords = await page.evaluate(
"""
() => {
const clean = s => s.replace('[편집]', '').trim();
let items = [];
// 1순위: 목차(table of contents)
const tocLinks = document.querySelectorAll(
'.wiki-macro-toc a, [class*="toc"] a, .toc-item a'
);
if (tocLinks.length) {
items = Array.from(tocLinks).map(a => clean(a.textContent));
}
// 2순위(목차가 없으면): 본문 헤딩 태그
if (items.length === 0) {
const hs = document.querySelectorAll('h1,h2,h3,h4,h5,h6');
items = Array.from(hs).map(h => clean(h.textContent));
}
return items.filter(Boolean);
}
"""
)
# 중복 제거 + 번호 정리
seen, cleaned = set(), []
for raw in keywords:
kw = clean_heading(raw)
if kw and kw not in seen and len(kw) <= 60:
seen.add(kw)
cleaned.append(kw)
result["keywords"] = cleaned
result["anecdote_keywords"] = [k for k in cleaned if is_anecdote(k)]
except Exception as e:
result["error"] = f"{type(e).__name__}: {e}"
return result
async def main():
parser = argparse.ArgumentParser()
parser.add_argument("--headful", action="store_true", help="브라우저 창 표시")
parser.add_argument("--only", nargs="*", help="특정 왕만 (묘호/군호로 지정)")
parser.add_argument("--concurrency", type=int, default=4,
help="동시에 열 페이지 수 (기본 4)")
args = parser.parse_args()
kings = JOSEON_KINGS
if args.only:
wanted = set(args.only)
kings = [k for k in JOSEON_KINGS if k[1] in wanted]
if not kings:
print(f"[!] 매칭되는 왕 없음: {args.only}")
print(" 가능한 값:", ", ".join(k[1] for k in JOSEON_KINGS))
return
OUT_DIR.mkdir(parents=True, exist_ok=True)
all_results = []
total = len(kings)
async with async_playwright() as p:
browser = await p.chromium.launch(headless=not args.headful)
context = await browser.new_context(
user_agent=(
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/124.0.0.0 Safari/537.36"
),
locale="ko-KR",
)
# 목차 텍스트만 필요하므로 이미지/CSS/폰트/미디어는 받지 않음 (로딩 대폭 단축)
async def _block(route):
if route.request.resource_type in {"image", "stylesheet", "font", "media"}:
await route.abort()
else:
await route.continue_()
await context.route("**/*", _block)
sem = asyncio.Semaphore(max(1, args.concurrency))
done = 0
async def worker(idx, name, title):
nonlocal done
async with sem:
page = await context.new_page()
try:
# 나무위키는 동시 요청 시 간헐적으로 404/차단을 주므로
# 실패하면 백오프하며 최대 3회까지 재시도
r = await scrape_king(page, title)
for attempt in range(3):
if not r["error"]:
break
await page.wait_for_timeout(1500 * (attempt + 1))
r = await scrape_king(page, title)
finally:
await page.close()
r["order"] = idx
r["name"] = name
done += 1
if r["error"]:
print(f"[{done:2d}/{total}] {name} ({title}) 실패: {r['error']}", flush=True)
else:
print(f"[{done:2d}/{total}] {name} ({title}) "
f"키워드 {len(r['keywords'])}개 "
f"(썰후보 {len(r['anecdote_keywords'])}개)", flush=True)
return r
all_results = await asyncio.gather(
*(worker(idx, name, title) for idx, name, title in kings)
)
all_results = sorted(all_results, key=lambda r: r["order"])
await browser.close()
# 저장 ---------------------------------------------------------------
ts = datetime.now().strftime("%Y%m%d_%H%M%S")
json_path = OUT_DIR / f"joseon_keywords_{ts}.json"
json_path.write_text(
json.dumps(all_results, ensure_ascii=False, indent=2), encoding="utf-8"
)
csv_path = OUT_DIR / f"joseon_keywords_{ts}.csv"
with csv_path.open("w", encoding="utf-8-sig", newline="") as f:
w = csv.writer(f)
w.writerow(["대수", "왕", "문서제목", "썰후보여부", "키워드", "URL"])
for r in all_results:
anec = set(r["anecdote_keywords"])
for kw in r["keywords"]:
w.writerow([r["order"], r["name"], r["title"],
"Y" if kw in anec else "", kw, r["url"]])
total_kw = sum(len(r["keywords"]) for r in all_results)
total_anec = sum(len(r["anecdote_keywords"]) for r in all_results)
fails = [r["name"] for r in all_results if r["error"]]
print("\n" + "=" * 50)
print(f"완료: 왕 {len(all_results)}명 / 키워드 {total_kw}개 / 썰후보 {total_anec}개")
if fails:
print(f"수집 실패: {', '.join(fails)}")
print(f"JSON -> {json_path}")
print(f"CSV -> {csv_path}")
if __name__ == "__main__":
if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())
asyncio.run(main())