Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63b4fa74fe | ||
|
|
c6c40191ae | ||
|
|
56f71cdfbe | ||
|
|
6c1d12d845 | ||
|
|
7d8911ed7d | ||
|
|
dac9f7b8e0 | ||
|
|
8ca1d12822 | ||
|
|
1e9ddb4719 | ||
|
|
c61d488794 | ||
|
|
41b09664eb | ||
|
|
4d79ec839c | ||
|
|
c8df1f5ef6 | ||
|
|
9e7bd54c7e | ||
|
|
3df3e0113b | ||
|
|
3da946382c | ||
|
|
cb013fcc9a | ||
|
|
e4834fd24e | ||
|
|
4cfcbcf7ea | ||
|
|
4ef99e5f73 | ||
|
|
0399942fb1 | ||
|
|
7d097a05de | ||
|
|
03ad57bcaa | ||
|
|
8a18ddc515 | ||
|
|
ab6959ee0f | ||
|
|
71974dcf42 | ||
|
|
b2c46086a3 | ||
|
|
92206d82f0 | ||
|
|
045d8d6cf0 | ||
|
|
44146888d3 | ||
|
|
13bb3d9a02 | ||
|
|
0a46fd71c2 | ||
|
|
cbee7cd807 | ||
|
|
c37773f48f | ||
|
|
52a4830b08 | ||
|
|
e154242c32 | ||
|
|
728b24a0c9 | ||
|
|
1489030c5f | ||
|
|
430f97131b | ||
|
|
1d6bb1e630 | ||
|
|
001e163b2a | ||
|
|
1ec87a82c1 | ||
|
|
5a1d464196 | ||
|
|
571ff84b0c | ||
|
|
ab9674eaa2 | ||
|
|
685a65faa5 | ||
|
|
6ed6c14adc | ||
|
|
ac16b098ba | ||
|
|
5ee25551ea | ||
|
|
1ae81ac25c | ||
|
|
1ca680f006 | ||
|
|
9544674e7f | ||
|
|
3c81976998 | ||
|
|
8709bfba2a | ||
|
|
7f5441a512 | ||
|
|
694ea85ed3 | ||
|
|
ef61a5bf73 | ||
|
|
74805aa829 | ||
|
|
5f79df1973 | ||
|
|
942b652e56 | ||
|
|
f24e790bd7 | ||
|
|
d38cfc7229 | ||
|
|
b346af7fef | ||
|
|
340b30cc8b | ||
|
|
fd67c2b45f | ||
|
|
ffe6153148 | ||
|
|
3a249c509d | ||
|
|
55edc037fb | ||
|
|
a17cef201d | ||
|
|
0414160520 | ||
|
|
0bc8ca02a4 | ||
|
|
1557ba42c4 | ||
|
|
9af3407546 | ||
|
|
117de90c3e | ||
|
|
be60551f49 | ||
|
|
dcf2fe5a53 | ||
|
|
132301dc28 | ||
|
|
dd133c9d52 | ||
|
|
5459b97ba0 | ||
|
|
1908433e46 | ||
|
|
7dcd6c6a4c | ||
|
|
7d84226105 | ||
|
|
c45940c358 | ||
|
|
09e8b4734a | ||
|
|
a87f245547 | ||
|
|
197fafdc02 | ||
|
|
65fd9b8fb1 | ||
|
|
668377660c | ||
|
|
98b5c0cbe3 | ||
|
|
d32e24a5ab | ||
|
|
fcc4163e15 | ||
|
|
882c7f06dc | ||
|
|
694757b2fb | ||
|
|
019b018bfa | ||
|
|
746aa4ba92 | ||
|
|
f4cb2217ed | ||
|
|
0f6c8c4bc9 | ||
|
|
8bc4678f40 | ||
|
|
0e4455fdc8 | ||
|
|
df7cf01835 | ||
|
|
baa4324ea0 | ||
|
|
1bfa224c62 | ||
|
|
b73bc650c4 | ||
|
|
b8117f190d | ||
|
|
d8c406b8b8 | ||
|
|
ceacd5615b | ||
|
|
7144084d8c | ||
|
|
2caa4d2832 | ||
|
|
d3d6d1a109 | ||
|
|
09feb3cd9e |
No files matched your search
@@ -6,6 +6,17 @@ argument-hint: "<스타일> minimal(꾸안꾸)·casual·semi(오피스)·formal
|
||||
오늘의 코디 카드를 만들어 올린다. 인자: `$ARGUMENTS` — 코디 스타일 하나(minimal=꾸안꾸, casual=캐주얼, semi=세미정장·오피스, formal=정장, street=스트릿). 비어 있으면 minimal. 포스트 하나는 스타일 하나: 네 사람 모두 같은 스타일.
|
||||
재확인 질문 없이 순서대로 진행하고, 막히면 그 자리에서 보고하고 멈춘다. 검수를 통과한 뒤에만 올린다(올린 건 되돌릴 수 없다).
|
||||
|
||||
## 꼭 지킬 것 (2026-10-27 사용자 피드백)
|
||||
- 에이블리는 공개 API 가 없어 쓸 수 없다. 요청에 있어도 처음에 그 사실을 말하고 무신사로만 만든다.
|
||||
- 옷은 스냅에 태그된 무신사 상품만 쓴다. 사진에만 보이는 옷·가방은 넣지 않는다(`admin/scripts/outfit.mjs`).
|
||||
- 계절감(가장 중요): 검수 때 아침·저녁 체감기온으로 '오늘 이 옷이면 춥지 않은가'를 사람마다 본다. 쌀쌀한 날(아침 체감과 낮 최고 평균 12도 미만, 스크립트 구간 chilly 이하)은 네 사람 모두 겉옷이 있어야 하고, 반팔 단독·미니 원피스/스커트·뮬·슬링백·샌들은 안 된다. 하나라도 걸리면 그 사람 스냅을 다시 고른다.
|
||||
- 여자 코디는 남성적·고프코어(카고 바지·백팩·등산화·바람막이)를 피하고 여성스러운 스냅을 고른다. 스트릿처럼 남성적인 스타일이 네 사람에게 안 어울리면 다른 스타일로 바꾼다.
|
||||
- 이름표는 한 줄에 들어가게 짧게(색 이름 접두어 빼기).
|
||||
- 인스타 API 가 `Application request limit reached` 를 돌려줘도 실제로는 올라갔을 수 있다. 다시 올리기 전에 `GET https://graph.instagram.com/v24.0/me/media?fields=permalink,caption,timestamp&limit=1` 로 최신 글 캡션을 확인하고, 없을 때만 다시 올린다(중복 게시 금지).
|
||||
- 캡션 해시태그가 이 포스트 내용(주제·카드·스타일·계절)과 맞는지 본다. 고정 태그만 있으면 올리지 않는다(`admin/src/cards/templates.tsx` `post`).
|
||||
- 무엇을 왜 바꿨는지·되돌렸는지는 한 번에 구체적으로 설명한다(파일 이름만 말하지 않는다).
|
||||
|
||||
## 순서
|
||||
1. 관리자 서버: `curl -s http://localhost:5175/api/targets` 에 `king` 이 있어야 한다. 없으면 `admin/` 에서 백그라운드로 켠다 (`admin/AGENTS.md` '켜기', 킹서버 키는 `ssh King_admin` 의 `~/proj/o2o-weather/.env` `ADMIN_API_KEY`, 값은 출력하지 않는다).
|
||||
2. 만들기(승인 대기로 저장까지): `cd admin && VITE_API_BASE_URL=https://weather.o2o.kr ADMIN_URL=http://localhost:5175 npm run card -- ootd --daily --style <스타일> --color sky --post-wait`. 출력 끝의 `카드 N` 번호를 적어 둔다.
|
||||
무신사 인기 스냅 중 그 스타일 태그가 붙은 것에서 사람 4명 코디를 고르고(최근 14일에 쓴 스냅 제외), Claude 가 옷 목록을 뽑고, Codex 가 스냅 사진·상품 썸네일을 참고해 플랫레이 그림을 그린다(사람당 2~4분, 총 10~15분). 고른 스냅 주소·옷 목록이 출력된다. "스냅이 없어요"·"저장하지 못했어요"·"Codex 실행이 실패" 가 나오면 멈추고 보고한다. 로그의 `rmcp … AuthRequired` 는 Codex 내부 경고라 무시한다. 크롬이 한 장에서 45초 넘게 멈추면 그 프로세스를 죽이고 그 장만 다시 찍는다.
|
||||
|
||||
@@ -6,6 +6,16 @@ argument-hint: "<타로 주제> 예) 건강 운동 · 연애 썸 · 경제 주
|
||||
오늘의 날씨 타로 카드를 만들어 올린다. 인자: `$ARGUMENTS` — 타로 주제(대주제 소주제). 비어 있으면 Claude 가 오늘 날씨에 맞는 주제를 고른다.
|
||||
재확인 질문 없이 순서대로 진행하고, 막히면 그 자리에서 보고하고 멈춘다. 검수를 통과한 뒤에만 올린다(올린 건 되돌릴 수 없다).
|
||||
|
||||
## 꼭 지킬 것 (2026-10-27 사용자 피드백)
|
||||
- 카드는 주제와 직접 엮여야 한다. 경제(주식·재테크) 주제는 경제 전용 카드(`admin/money-deck.json`: 불장·존버·분할매수·익절·손절·관망·물타기·배당·적금·텅장)에서만 고르고, 리딩은 돈·주식 이야기로 쓴다. 산책·꽃구경 같은 활동 이야기로 새면 다시 기획한다.
|
||||
- 주식 주제의 제목·질문은 "오늘 내 주식"(계좌·지갑처럼 돌려 말하지 않는다).
|
||||
- 예보 데이터에 없는 사실(바람 세기 등)은 쓰지 않는다. 행운 포인트의 시각·기온은 그 시각 slot 값 그대로(예: 해 질 녘 18시 10도를 8도로 쓰지 않는다).
|
||||
- 카드 그림을 계절에 맞출 필요는 없다(가을에 벚꽃 그림이어도 다시 그리지 않는다).
|
||||
- 인스타 API 가 `Application request limit reached` 를 돌려줘도 실제로는 올라갔을 수 있다. 다시 올리기 전에 `GET https://graph.instagram.com/v24.0/me/media?fields=permalink,caption,timestamp&limit=1` 로 최신 글 캡션을 확인하고, 없을 때만 다시 올린다(중복 게시 금지).
|
||||
- 캡션 해시태그가 이 포스트 내용(주제·카드·스타일·계절)과 맞는지 본다. 고정 태그만 있으면 올리지 않는다(`admin/src/cards/templates.tsx` `post`).
|
||||
- 무엇을 왜 바꿨는지·되돌렸는지는 한 번에 구체적으로 설명한다(파일 이름만 말하지 않는다).
|
||||
|
||||
## 순서
|
||||
1. 관리자 서버: `curl -s http://localhost:5175/api/targets` 에 `king` 이 있어야 한다. 없으면 `admin/` 에서 백그라운드로 켠다 (`admin/AGENTS.md` '켜기', 킹서버 키는 `ssh King_admin` 의 `~/proj/o2o-weather/.env` `ADMIN_API_KEY`, 값은 출력하지 않는다).
|
||||
2. 예보: `curl -s "https://weather.o2o.kr/v1/weather/today?region=1114000000"` 의 `day` 가 오늘인지 보고 slots 의 기온·하늘·비 확률을 적어 둔다.
|
||||
3. 만들기(승인 대기로 저장까지): `cd admin && VITE_API_BASE_URL=https://weather.o2o.kr ADMIN_URL=http://localhost:5175 npm run card -- tarot --topic "<주제>" --color sky --post-wait` (주제가 없으면 `--topic` 없이). 출력 끝의 `카드 N` 번호를 적어 둔다.
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
description: 이번주 코디 숏폼 영상(여자 → 남자 → 날씨각 마무리, 15초)을 날씨각 가상 모델과 무신사 스냅으로 만들어 검토받고 인스타 릴스·YouTube Shorts에 올린다
|
||||
argument-hint: "<나이대> 20·30·40 [스타일] minimal·casual·semi·formal·street (비우면 casual)"
|
||||
---
|
||||
|
||||
이번주 코디 영상을 만들어 올린다. 인자: `$ARGUMENTS` — 첫 번째는 나이대(`20`·`30`·`40`, 필수), 두 번째는 코디 스타일(minimal=꾸안꾸, casual, semi=오피스, formal, street, 비우면 casual).
|
||||
나이대별로 쓰는 것: `20`·`30` → 20대 모델(models.json age 20s)·무신사 20-30대 스냅(`f20`·`m20`)·타이틀 "20대"/"30대", `40` → 40대 모델(40s)·무신사 40대~ 스냅(`f40`·`m40`)·타이틀 "40대~"(`--age 40~`).
|
||||
작업 폴더 `W` = `admin/nalssigak/runs/<오늘 날짜>-<나이대>/` (커밋하지 않는다). 스크립트는 `admin/nalssigak/scripts/`, 템플릿은 `admin/nalssigak/templates/`.
|
||||
승인 지점(5·10번)에서는 반드시 멈추고 사용자 답을 기다린다. 업로드는 사용자가 "올려"라고 한 뒤에만 한다(올린 건 되돌릴 수 없다).
|
||||
|
||||
## 꼭 지킬 것
|
||||
- 얼굴은 `admin/nalssigak/models/` 의 가상 모델만 쓴다. 연예인·유명인·남의 사진, 그 사람을 닮게 만든 이미지는 사용자가 친구·본인 사진이라고 해도 기준 이미지로 쓰지 않는다. 새 모델이 필요하면 `models/prompts/` 처럼 글로만 만들고("ORIGINAL FICTIONAL … must not resemble any real celebrity"), 시안을 보여 주고 고르게 한다.
|
||||
- 올리는 문구(YouTube 제목·설명·태그, 인스타 캡션·해시태그, 말풍선)에 무신사 상품명·브랜드명·'무신사'·스냅 주소를 쓰지 않는다. 옷은 일반 이름(색·소재·종류)으로만 말한다. 예: `우먼즈 신세틱 스웨이드 블루종 재킷 [다크 브라운]` → `다크 브라운 스웨이드 블루종`, `BELLA QUILTED MARYJANES` → `블랙 메리제인 플랫`.
|
||||
- 옷은 무신사 인기 스냅에 태그된 상품만 쓴다(`admin/scripts/snap.mjs`). 에이블리는 공개 API 가 없어 쓸 수 없다. 요청에 있어도 처음에 말하고 무신사로 만든다.
|
||||
- 계절감: 아침 체감과 낮 최고 평균이 12도 미만(구간 chilly 이하)이면 두 사람 다 겉옷이 있어야 하고, 반팔 단독·미니·뮬·샌들은 안 된다(미니는 검은 스타킹과 롱부츠를 함께 신으면 된다). 여자 코디는 카고·백팩·등산화·바람막이 같은 고프코어를 피한다.
|
||||
- 움직임: 춤추지 않는다. 원래 자세에서 바람에 머리·옷이 날리고 손인사·머리 넘기기·옷깃 만지기 같은 작은 동작 하나만(`templates/actions.json`). 손가락 모양 동작(하트·V·OK·엄지)은 영상에서 다른 손 모양이 되니 쓰지 않는다. 낙엽 떨어지는 효과는 넣지 않는다. 여자는 키가 커 보이지 않게(158cm 정도, 머리:몸 1:7, 눈높이 카메라).
|
||||
- 화면: 프로필 그리드는 가운데 3:4(위 240 ~ 아래 1680), 피드는 4:5(위 285 ~ 아래 1635)만 보여 준다. 둥근 영상 창(132,240 · 816×1440)이 3:4 를 채우고 바깥은 같은 영상을 흐리게 깔아 빈 곳이 없게 한다. 칩·제목·자막은 창 왼쪽 아래, 4:5 안에 둔다. `templates/frame.html`·`title.html`·`bubble.html`·`scripts/compose.sh` 의 창 위치를 바꾸지 않는다.
|
||||
- 킹서버: 영상은 날씨각 전용 컨테이너 `nalssigak-ltx`(GPU 0)로만 만든다. menusong 서비스·파일은 건드리지 않는다. `server.sh down` 이 끌 때 서버의 입력·결과 파일을 지운다.
|
||||
- 비밀: OAuth·토큰은 `~/.config/nalssigak/`, 인스타 토큰은 `.env`. 값을 출력하거나 저장소에 넣지 않는다.
|
||||
|
||||
## 환경 점검 (1번에서 돌리고, 안 되면 해결 방법을 알려 준다)
|
||||
| 점검 | 명령 | 안 될 때 |
|
||||
|---|---|---|
|
||||
| 기본 도구 | `python3 --version; node --version; ffmpeg -version; ls "/Applications/Google Chrome.app"` | 없는 것을 설치한다(`brew install ffmpeg` 등). 크롬은 앱으로 설치. |
|
||||
| Codex(사진) | `codex --version` | Codex CLI 를 설치하고 `codex login`. 사용 한도 초과면 다음 날 다시. |
|
||||
| 관리자 서버(인스타) | `curl -s http://localhost:5175/api/targets` 에 `king` | `admin/` 에서 `npm install` 후 `admin/AGENTS.md` '켜기'대로 백그라운드로 켠다(킹서버 키는 `ssh King_admin` 의 `~/proj/o2o-weather/.env` `ADMIN_API_KEY`, 값은 출력하지 않는다). |
|
||||
| 킹서버 접속 | `ssh -o BatchMode=yes King_admin true` | `~/.ssh/config` 에 `Host King_admin`(HostName 172.30.1.36, User o2oadmin, ProxyJump Confluence)과 키가 있어야 한다. 사내망·키는 사용자가 확인. |
|
||||
| 영상 서버 | `admin/nalssigak/scripts/server.sh status` | 이미지 `jw/comfyui-ltx:latest`·모델 `/mnt/data2/dir/jw_playground/LTX-2.5` 가 서버에 있어야 한다(없으면 서버 담당자에게). GPU 0 을 menusong 이 쓰면 기다리거나 `OOTD_GPU=1`. |
|
||||
| YouTube 앱 | `ls ~/.config/nalssigak/client_secret.json` | Google Cloud 의 YouTube Data API v3 프로젝트에서 OAuth 클라이언트(데스크톱 앱) JSON 을 받아 그 경로에 두고 `chmod 600`. |
|
||||
| YouTube 로그인 | `ls ~/.config/nalssigak/youtube_token.json` | `python3 admin/nalssigak/scripts/youtube.py auth` → 사용자가 채널 계정으로 로그인. 'access_denied' 면 Google 인증 플랫폼 → 대상 → 테스트 사용자에 그 계정을 추가. 업로드 때 `invalid_grant` 면 토큰 만료(테스트 앱은 7일)라 auth 를 다시 하고, 앱을 '프로덕션으로 게시'하길 권한다. |
|
||||
| 인스타 토큰 | 킹서버 `.env` 의 `INSTAGRAM_ACCESS_TOKEN`·`INSTAGRAM_USER_ID` 가 있는지(값은 보지 않고 `grep -c`) | 없거나 만료면 `TODO.md` '인스타 연결' 행 순서대로 다시 발급해 킹서버 `.env` 에 넣는다(사용자 작업). |
|
||||
|
||||
## 순서
|
||||
1. 준비 확인: 아래 '환경 점검' 명령을 모두 돌린다. 안 되는 항목이 있으면 그 항목의 해결 방법을 사용자에게 그대로 알려 주고, 사용자가 할 일(로그인·키 발급 등)이 아니면 직접 고친 뒤 다시 점검한다. 다 통과해야 2번으로 간다.
|
||||
2. 날씨: `curl -s "https://weather.o2o.kr/v1/weather/today?region=1114000000"` 의 `slots` 중 6~21시로 아침(6시)·낮 최고 기온, 비(rain_type≠0 또는 rain_prob≥60), 하늘을 잡는다. 구간은 낮 최고로 hot≥28 · warm≥23 · mild≥17 · cool≥12 · chilly≥9 · cold≥5 · 그 아래 freezing. 배경 문장은 계절·날씨에 맞게 한 줄로(예: 맑은 가을이면 "a sunny clear late-October afternoon on a Seoul tree-lined sidewalk with golden ginkgo trees…", 비 오면 젖은 거리·우산).
|
||||
3. 코디: `cd admin && node scripts/snap.mjs --band <구간> --style <스타일> --out nalssigak/runs/<W 이름>/snaps`. 20·30 은 `f20`·`m20`, 40 은 `f40`·`m40` 을 쓴다. `snaps/picks.json` 의 상품(outer·top·bottom·shoes·bag)을 보고 위 계절감 규칙에 맞는지 본다. 안 맞으면 `--pages 3` 등으로 다시 고른다.
|
||||
4. 사진: `models/models.json` 에서 그 나이대(20·30 → 20s, 40 → 40s) 여자·남자를 하나씩 무작위로 고른다. `templates/photo_prompt.txt` 를 채워 `W/woman_photo.txt`·`W/man_photo.txt` 를 쓰고(옷은 태그된 상품을 색·소재·실루엣까지 영어로, 여자는 body_line 에 키 규칙), 둘을 동시에 만든다:
|
||||
`python3 admin/nalssigak/scripts/codex_image.py --prompt-file W/woman_photo.txt --output W/woman_photo.png --image admin/nalssigak/models/<id>.jpg --image W/snaps/f20/snap.jpg --image W/snaps/f20/goods-<n>.jpg …` (남자도 같게, 1~2분).
|
||||
5. 사진 검수 → **승인 대기**: 모델 기준 사진과 나란히 붙인 시트를 열어 보여 준다. 볼 것: 같은 얼굴인지, 태그된 옷이 다 있고 없는 옷이 없는지, 글자·워터마크, 전신(머리~신발, 신발 아래 여백), 손, 키 비율. 사용자가 고치라고 하면 그 사진만 다시 만든다.
|
||||
6. 동작 설명: 동작은 사람마다 무작위로 두 개를 고른다 — `python3 admin/nalssigak/scripts/actions.py --who woman --has outer,bag` (그 사람에게 겉옷·가방이 있을 때만 `--has` 에 넣는다, 남자는 `--who man`). 출력 첫 줄을 `W/woman_a.txt`, 둘째 줄을 `W/woman_b.txt` 의 `{action}` 에 그대로 넣어 `templates/motion_prompt.txt` 를 채운다(남자는 `W/man_a.txt`·`W/man_b.txt`). 손가락 모양 동작을 따로 덧붙이지 않는다.
|
||||
7. 클립: `admin/nalssigak/scripts/clips.sh W` (4초 4개, 하나에 4~5분, 총 20분 안팎). GPU 0 을 menusong 이 쓰고 있다며 시작하지 않으면 기다렸다 다시 하거나 비어 있으면 `OOTD_GPU=1` 로 한다.
|
||||
8. 클립 검수: 클립마다 `ffmpeg -vf "select='eq(n\,12)+eq(n\,36)+eq(n\,60)+eq(n\,84)',tile=4x1"` 로 얼굴을 확대해 본다. 눈 감음·고개 젖힘·얼굴 바뀜·손가락 뭉개짐·카메라 움직임이 있으면 그 클립만 `clips.sh W woman_b` 처럼 다시 만든다(최대 2번).
|
||||
9. 합성:
|
||||
- 타이틀: `python3 admin/nalssigak/scripts/render.py title --age <20|30|40~> --who 여성 --label <코디|하객룩 …> --out W/title_woman.png` (남성도). 제목은 '이번주 20대 / 여성 하객룩' 두 줄로 창 왼쪽 아래에 얹힌다.
|
||||
- 자막 4개: 그날 옷에서 한 줄로 짧게(20자 안팎, 옷 이름은 `*강조*`). 문구는 목록으로 먼저 확인받는다. 제목 아래 같은 자리(창 왼쪽, 발 바로 위 다리 높이)에 차례로 나오고, 창 오른쪽(948px)을 넘으면 문구를 줄인다. 자막·제목이 신발을 가리면 안 된다.
|
||||
`python3 admin/nalssigak/scripts/render.py bubble --text "…" --out W/bubbles/w1.png`, `W/bubbles.txt` 에 `w1 0.8 3.0` · `w2 3.4 6.1` · `m1 7.1 9.4` · `m2 9.8 12.4`.
|
||||
- 음악: `admin/nalssigak/music.json` 에서 직전 회차(`runs/*/publish.md` 의 Music 줄)와 다른 곡을 골라 `admin/nalssigak/runs/cache/music/<id>.mp3` 에 없으면 내려받는다. 새 곡은 Mixkit Stock Music Free License 곡을 후보로 영상에 입혀 들려 주고 사용자가 고른 것만 넣는다.
|
||||
- `admin/nalssigak/scripts/compose.sh W admin/nalssigak/runs/cache/music/<id>.mp3` → `W/final.mp4` (15초).
|
||||
- 확인: `admin/nalssigak/scripts/sheet.sh W/final.mp4 W/sheet.png 1.0 1.9 2.8 3.7 4.7 5.8 7.4 8.3 9.2 10.1 11.1 12.2 13.8` 로 자막·제목이 얼굴을 가리지 않는지 보고, `crop=1080:1440:0:240`(그리드)·`crop=1080:1350:0:285`(피드)로 잘라 칩·제목·자막·머리·신발이 다 보이는지 본다.
|
||||
10. 문구 → **승인 대기**: `W/publish.md` 에 YouTube 제목(`이번주 <나이>대 <계절> 코디 🍂 여자·남자 데일리룩 | 날씨각 #Shorts` 꼴, 나이는 타이틀과 같게 `20대`·`30대`·`40대~` — 40 은 반드시 `40대~`. 제목·설명·인스타 캡션 첫 줄 모두 같다)·설명(사람별 옷 목록 — 옷 이름은 '다크 브라운 스웨이드 블루종'·'와이드 치노 팬츠'처럼 색·소재·종류로만 쓴다, weather.o2o.kr, "※ 영상 속 인물은 AI로 만든 가상 모델이에요." 와 음악 credit, 해시태그)·태그, 인스타 캡션(첫 줄이 제목, 프로필 링크 → weather.o2o.kr, 토스 '날씨각' 검색 안내, AI 표기, 해시태그)을 쓴다. 해시태그는 나이대·스타일·계절에 맞춘다. 영상을 열고 문구 전체를 보여 준 뒤 "올려" 를 기다린다.
|
||||
11. 올리기(승인 후):
|
||||
- 인스타: 1초 프레임을 `W/cover.jpg` 로 뽑고, `POST http://localhost:5175/api/reel?target=king` 에 `{title, caption, hashtags, video(mp4 base64, 30MB 이하), cover(JPEG base64)}` → `reel_id`, 이어서 `POST http://localhost:5175/api/reel/<reel_id>/instagram?target=king` (`--max-time 600`) → `ig_media_id`. 링크는 `GET https://graph.instagram.com/v24.0/<ig_media_id>?fields=permalink,media_product_type` (토큰은 `~/projects/o2o-weather/.env` 또는 킹서버 `~/proj/o2o-weather/.env` 의 `INSTAGRAM_ACCESS_TOKEN`, 출력하지 않는다). `Application request limit reached` 면 `me/media?fields=permalink,caption,timestamp&limit=1` 로 이미 올라갔는지 보고, 없을 때만 다시 올린다.
|
||||
- YouTube: `W/youtube_meta.json` 에 `{title, description, tags, privacy}` 를 쓰고 `python3 admin/nalssigak/scripts/youtube.py upload W/final.mp4 W/youtube_meta.json`. 토큰이 없거나 만료면 `youtube.py auth` 로 사용자에게 채널 계정 로그인을 받는다(계정이 Google 인증 플랫폼 테스트 사용자여야 한다).
|
||||
- privacy: `~/.config/nalssigak/youtube_public` 파일이 있으면 `"public"`(API 감사 통과 뒤), 없으면 `"private"`. 감사 전에는 절대 public 으로 보내지 않는다(비공개로 잠길 수 있다).
|
||||
- 바로 반영: 비공개로 올렸으면 출력의 `studio` 주소를 `open` 으로 열고, 사용자에게 "공개 범위 → 공개 → 저장" 만 하면 된다고 알린다. 사용자가 공개로 바꿨다고 하면 `https://youtube.com/shorts/<id>` 링크를 다시 알려 주고 마친다.
|
||||
- public 으로 보냈는데 출력에 경고(요청과 다른 공개 상태)가 나오면 감사가 풀린 게 아니므로 `youtube_public` 파일을 지우라고 알리고, 스튜디오에서 상태를 확인하게 한다.
|
||||
- 감사 신청은 YouTube API Services 감사·할당량 양식(https://support.google.com/youtube/contact/yt_api_form)으로 사용자가 한다.
|
||||
12. 보고(한국어, 짧게): 인스타·YouTube 링크, 쓴 모델·스냅 주소, 검수에서 다시 만든 것, 남은 일(YouTube 는 비공개로 올라가니 스튜디오에서 공개 전환, 인스타는 앱에서 'AI 정보' 라벨 켜기).
|
||||
@@ -14,10 +14,9 @@ INSTAGRAM_USER_ID=
|
||||
PUBLIC_BASE_URL=https://weather.o2o.kr
|
||||
IMAGE_PROXY_HOSTS=tong.visitkorea.or.kr,www.culture.go.kr,culture.seoul.go.kr
|
||||
# 오늘 화면 쇼츠 줄 (YouTube Data API v3 키, console.cloud.google.com/apis/credentials 에서 발급·YouTube Data API v3 만 허용).
|
||||
# 비우면 채널 쇼츠를 자동으로 못 받고 YOUTUBE_SHORTS(영상 ID, 쉼표로 구분, 최신순)만 보여 준다. 둘 다 비우면 기본값(영상 3개)
|
||||
# 비우면 채널 쇼츠 RSS(키 없음, 최신 15개)로 받는다
|
||||
YOUTUBE_API_KEY=
|
||||
YOUTUBE_CHANNEL_ID=UCWdesmwvHFsnjMUWNcDaA9w
|
||||
YOUTUBE_SHORTS=
|
||||
|
||||
# ── 백엔드: DB·Redis (네이티브 실행 기준. compose 안에서는 compose.yaml 이 host·port 를 덮어쓴다)
|
||||
DB_HOST=localhost
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# 셸·파이썬 스크립트는 윈도우에서 받아도 LF 로 둔다 (CRLF 면 Git Bash 가 $'\r' 오류를 낸다)
|
||||
*.sh text eol=lf
|
||||
*.py text eol=lf
|
||||
*.mjs text eol=lf
|
||||
@@ -59,10 +59,18 @@
|
||||
| [ ] | 단풍 지도 '첫 단풍'은 절정 14일 전부터로 추정(발표에 시작일 없음). 예측 지점이 아닌 명소 32곳은 가장 가까운 예측 지점 날짜를 빌림(예: 남산공원·창덕궁 ← 수리산). 실제 관측과 다를 수 있음 | 사용자 결정 10/21 | `frontend/seo/foliage_2026.json` |
|
||||
| [ ] | 토스 미니앱 최신 버전 재등록 — 웹이 바뀌면 자동 반영 안 됨 | 10/21 회의 | |
|
||||
| [ ] | 유튜브 숏폼 자동화 진행 방안 협의 (김성경, 10/22) | 10/21 회의 | |
|
||||
| [ ] | 오늘 화면 쇼츠 줄 — YouTube Data API 키(`YOUTUBE_API_KEY`) 발급해 운영 .env 에 넣기. 없으면 `youtube_shorts`(영상 ID 3개 고정)만 나와 새 쇼츠가 자동으로 안 붙음 (https://console.cloud.google.com/apis/library/youtube.googleapis.com) | 채널 RSS가 404라 키 없이 채널 목록을 못 받음 | `backend/config/settings.py`, `backend/services/shorts_service.py` |
|
||||
| [x] | 오늘 화면 쇼츠 줄 — 영상 ID 고정 목록(`youtube_shorts`) 없앰. API 키가 없으면 채널 쇼츠 RSS(`UUSH…` 재생목록, 키 없음)로 자동으로 받음. 키(`YOUTUBE_API_KEY`)를 운영 .env 에 넣으면 Data API 로 바뀌어 퍼가기·길이까지 거름 (https://console.cloud.google.com/apis/library/youtube.googleapis.com) | 10/28 운영에 키가 없어 고정 목록만 나와 새 쇼츠가 안 붙음. 채널 RSS가 다시 200 | `backend/services/external/youtube.py`, `backend/services/shorts_service.py` |
|
||||
| [ ] | **[결정 필요]** 쇼츠 문구 검토: '소리 켜기'/'소리 끄기' (줄 제목은 없앰) | 화면 문구 규칙 | `frontend/src/b/Shorts.tsx` |
|
||||
| [ ] | 쇼츠를 올린 직후 목록 갱신(`ShortsService.refresh`) 부르기 — 지금은 워커가 07·12·18시 10분에만 받아 18시 넘어 올리면 다음 날 아침에 뜸. 자동 업로드면 끝난 뒤 호출, 손으로 올리면 관리자 갱신 API | 올리는 방식 확인 필요 | `backend/services/shorts_service.py`, `backend/worker_main.py` |
|
||||
| [ ] | 쇼츠 API 실패·빈 목록일 때 공유 링크로 들어오면 남색 빈 화면만 보임 — 그 영상 ID 하나라도 띄우거나 × 버튼·안내 문구 보이기 | 10/27 QA 실패 (`items` 가 비면 빈 div 만 그림) | `frontend/src/b/Shorts.tsx` |
|
||||
| [ ] | **[결정 필요]** 쇼츠 폰에서 유튜브 멈춤(\|\|) 버튼이 계속 남음 — 유튜브 플레이어 자체 버튼이라 코드로 못 지움. 우리 쇼츠 원본 mp4를 저장소에 올려 <video>로 틀지, 폰 연결해 유튜브로 더 시도할지 | 10/27 실기기 보고, 크롬·WebKit 흉내에선 재현 안 됨 | `frontend/src/b/Shorts.tsx` |
|
||||
| [ ] | 토스 ait 는 `feat/apps-in-toss` 브랜치(~/orca/workspaces/o2o-weather/main-3)에서 만들기 — main 에는 토스 로그인·웹뷰 자동재생·쇼츠 토스 처리가 없음. 최신 ait 20:03 콘솔 업로드 필요 | 10/27 main 에서 만든 ait 로 쇼츠가 멈춰 보임 | `~/orca/workspaces/o2o-weather/main-3/frontend/nalssigak.ait` |
|
||||
| [ ] | 운영 행사 주소(event.address) 채우기 — 팝가가 연속 요청을 막아(429) 로컬도 206개 중 80개만. 간격 두고 다시 | 10/27 주소 수집 추가 | `backend/scheduler/jobs.py` `refresh_popups` |
|
||||
| [ ] | `test_watch_summary_flags_thunder_within_2_hours` 가 전체로 돌릴 때만 실패(따로 돌리면 통과) — 순서 의존 원인 찾기 | 10/27 전체 테스트 | `backend/tests/test_watch.py` |
|
||||
| [ ] | 쇼츠 자동재생 아이폰 사파리 실기기 확인 — 소리 꺼도 자동재생을 막는다는 보고 있음 | 헤드리스 크롬에서만 확인 | `frontend/src/b/Shorts.tsx` |
|
||||
| [x] | 단풍 명소 `남이섬`이 두 번 들어감(절정 10-25·10-27) — 10-27(화목원) 쪽 지움, 67곳 | 10/27 전체 점검 | `frontend/seo/foliage_2026.json` |
|
||||
| [x] | 날짜 따라 깨지던 테스트 2개 — 노을 칸은 그날 해 지는 시각으로, 방위각은 한 해 범위(240~300°)로 확인 | 10/27 전체 점검 | `backend/tests/test_weather_today.py`, `backend/tests/test_sky_api.py` |
|
||||
| [x] | 빈 댓글 보완 — 포스트마다 날씨각 캐릭터(해님·구름·달님) 댓글 1~2개, '날씨각' 표시. 사람인 척하는 가짜 계정·부풀린 숫자는 안 함 | 10/27 결정 | `backend/services/bot_comment.py`, `backend/services/bot_comment.json` |
|
||||
| [ ] | 인스타 운영 관리자 페이지(자동 게시 전 승인 메일) + 초기 이야기형 피드(각 100개·빨래각·소맥각·점수 산정법) | 10/21 회의 | |
|
||||
| [ ] | 레이어 공유 아이디어 — 사용자 사진 위에 날씨각 정보를 얹어 공유(캐시워크식), 앱 기능으로 | 10/21 회의 (황 본부장 의견, 대표 방향) | |
|
||||
| [ ] | iOS 개발자 계정 — 소장에게 기존 계정 확인, 어려우면 회사 계정 새로 만들기. 안드로이드 앱 계속 준비 | 10/21 회의 결정 | |
|
||||
@@ -76,6 +84,22 @@
|
||||
| [ ] | 익명 댓글이 링크·하루 제한에 걸려도 '댓글을 올리지 못했어요'만 나옴 — 이유별 안내 | 익명 댓글 작업 중 발견 | `frontend/src/b/Sheets.tsx` |
|
||||
| [ ] | 매일 대표에게 진행 보고 (미완료 포함) | 10/21 회의 결정 | |
|
||||
|
||||
## 10/28 시장성 진단 (보고서는 채팅 첨부, 근거: 운영 DB 집계·첫 화면 캡처·회의록)
|
||||
|
||||
| 상태 | 할 일 | 이유 | 관련 파일 |
|
||||
|---|---|---|---|
|
||||
| [ ] | **[결정 필요]** 타깃을 2030 직장인으로 좁히기 — 기능은 지우지 않고 첫 화면·각 순서만 이 사람 기준으로. 9/29 '타깃 정하지 않음'을 바꾸는 일이라 대표 결정 | 콘텐츠가 2030·4050·반려인·동네 주민으로 흩어져 누구에게도 1순위가 아님 | `frontend/src/b/TodayPage.tsx`, `backend/services/feed_service.py` |
|
||||
| [ ] | 오늘 타로(오늘 한 장) — main 병합(10/28): 오늘 탭 아이콘 줄 → 오늘 타로 창. 타로 22장 하루 1장 + 행운(시간·장소·색·1위 각) + 연속 도장 + 저녁 체크인. 남은 것: 배포(운영 init.sql 로 표 fortune_draw·day_log·point_log, users.points 생김), 토스 ait(`feat/apps-in-toss`에 main 합친 뒤) | 10/28 사용자 결정 | `frontend/src/b/fortune.tsx`, `frontend/src/b/todayIcons.tsx` |
|
||||
| [ ] | **[결정 필요]** 아침 7시 웹 푸시 — 안드로이드 크롬은 바로, 아이폰은 홈 화면에 추가한 사람만(iOS 16.4+). 앱 위젯(10/21 결정)은 계속 | 다시 부르는 장치가 없음(코드에 웹 푸시 없음) → DAU가 쌓이지 않음 | `frontend/public/sw.js`, `frontend/src/b/install.ts` |
|
||||
| [ ] | **[결정 필요]** 좋아요·댓글 0이면 숫자 숨기기, 동네 이야기는 그날 글이 몇 개 넘을 때만 위에 | 첫 화면 '좋아요 0개'·동네 글 1개가 "아무도 안 쓴다"는 신호 | `frontend/src/b/TodayPage.tsx`, `frontend/src/b/talk.tsx` |
|
||||
| [ ] | **[결정 필요]** 4주 새 기능 동결 목록 — 후보: 나만의 각 피드 올리기, 동네 이야기 사진, 캐시워크·통신사 위젯, 새 각 추가, 지역 페이지 추가 확장(10/21 '모든 지역 추가'와 충돌) | 2명이 기능 폭을 넓히는 중, 바깥 사용자 반응은 거의 없음(계정 7개 대부분 팀 추정) | |
|
||||
| [ ] | 첫 화면에 '지금 10°'(시간대 줄)와 '오전 10시 5°'(히어로 문장·오늘의 각)가 함께 보임 — 원인 확인(체감온도인지). 오늘의 각 5줄 설명도 모두 같은 문장 | 10/28 11시 운영 캡처(마포구), 숫자 어긋나면 첫 방문자 신뢰 잃음 | `frontend/src/b/TodayPage.tsx` |
|
||||
| [ ] | GA4 사내 IP 제외 필터 + 주간 지표 4개(신규 방문, 1일·7일 재방문, 공유→방문, 홈 화면 추가→알림 허용) | 바깥 사용자 수를 아무도 모름, 이게 없으면 진단이 가설로 남음 | `docs/이벤트_추적.md` |
|
||||
| [ ] | 계정 레벨 — main 병합(10/28, 배포 남음). 사용자 결정 10/28: **레벨 제도**(포인트 소비형 아님). 단위는 '각'(출석 +10각 등 서비스 전체 행동으로 적립), 레벨은 모은 총량 기준이라 나중에 각을 쓰는 기능을 붙여도 안 내려감. 지금 있는 기능·캐릭터·색·기분은 잠그지 않고, 새로 생기는 것(날씨 사주 연애운·궁합 등, 새 캐릭터·테두리, 댓글 레벨 배지)만 레벨로 열림. 내 정보는 기존 화면에 레벨·각만 더함. 정할 것: 레벨 이름·단계·필요 각, 행동별 각·하루 한도, 해금 목록 | 기획서 '계정 레벨(각)·날씨 사주 UI 기획'(10/28 채팅 첨부) | `frontend/src/b/Sheets.tsx` `MeSheet` |
|
||||
| [ ] | 날씨 사주 해석 기준 — 사용자가 맡김(10/28 "니 알아서 하라"), 바꿀 수 있게 기록: 날씨 접목은 조후(한난조습) · 연애운은 열 때 성별 선택 입력(남/여/선택 안 함, 안 하면 도화·배우자궁만으로 본다고 표시) · 도화는 연지·일지 삼합 둘 다 · 홍염은 일간표(甲乙午 丙寅 丁未 戊己辰 庚戌 辛酉 壬子 癸申, 이견 있음 표시) · 합충형파해원진은 원국 네 지지 모두, 일지에 걸리면 연애 가중 · 절입 시각은 천문 계산식으로 1900~2100 표를 만들고 천문연 값으로 검증(패키지 안 씀) · 진태양시(출생지 경도)·서머타임 반영, 자시는 자정 기준(설정으로 변경) · 음력은 다음 단계(천문연 API) | 사용자 위임 10/28 | |
|
||||
| [ ] | **[결정 필요]** 날씨 사주 화면·문구 — '내 기운'(계절·날씨 장면 16종), 점수 → 사주 풀이 → 계절·날씨 한 스푼, 하루 풀이를 '오늘의 결정 카드'(언제·미룰 것·입을 것/갈 곳·이번 주 날짜)로 줄지, 규칙별 의미 사전·문구 검토, 기운 장면 그림 | 사용자 피드백 10/28 | 기획서 '날씨 사주 기획 v2', '계정 레벨·날씨 사주 UI 기획' |
|
||||
| [ ] | **[결정 필요]** 날씨 사주 Codex 검수(10/28) 중 반영 안 한 것: ① 금전·일 날짜 추천("큰돈 쓰거나 계약할 일은 10/31(토)") — Codex는 운세로 계약·면접 날짜를 정해 주지 말고 점검 행동만 주라고 했으나, 사주 앱 장르상 날짜가 핵심이라 유지하고 그날 점수 60 이상일 때만 고르게 함 ② 점수를 '참고 점수'로 부를지 ③ 결과 위에 출생 정보 요약·칸 이동 메뉴, 사주 글자 표 접기 ④ 11월부터 올해 운 자리에 내년 미리 보기 — 올해·내년을 따로 고르게 할지 ⑤ 연애운 성별 기준(남 재성·여 관성)을 '전통 기준'이라고 더 밝힐지 | Codex 검수 `/tmp/sweep/codex-review.md` | `backend/services/saju_service.py`, `frontend/src/b/SajuPage.tsx` |
|
||||
|
||||
## 진행 순서
|
||||
|
||||
결정이 필요 없는 것부터, 사용자 눈에 틀린 정보가 보이는 것 → 기능 → 다듬기 순.
|
||||
@@ -292,6 +316,15 @@
|
||||
| [x] | 코디 카드 매일 다르게 — 고정 옷 데이터 대신 무신사 스냅 공개 API에서 오늘 구간 인기 코디를 사람별(40대~ 단정 태그 우선)로 골라 Claude가 옷 목록 추출, Codex가 참고 사진 첨부로 플랫레이 생성(`npm run card -- ootd --daily`, `/daily-cards`). 10/26 4장 검수 통과. 에이블리는 공개 API 없음(앱 전용)이라 미사용 | 사용자 요청 (10/26) | `admin/scripts/daily-ootd.mjs`, `snap.mjs`, `outfit.mjs`, `codex-image.mjs` |
|
||||
| [x] | 10/26 세미정장 코디(그날 코디 첫 게시) — 킹서버 카드 12→포스트 4275, 인스타 https://www.instagram.com/p/De8O2kqATrl/. 무신사 스냅 4개 참고, 4장 1:1 검수 | 사용자 요청 (10/26) | `admin/scripts/daily-ootd.mjs` |
|
||||
| [x] | 10/26 몸 컨디션 타로(건강: 등산각·자전거각·산책각) — 킹서버 카드 13→포스트 4276, 인스타 https://www.instagram.com/p/De8Zw7MIEVW/. 기획에서 3번 산책각 비 시점 틀린 것 피드백으로 고침. card.mjs --post-wait 가 ECONNRESET 으로 두 번 실패해 post-king.py 로 저장 | 사용자 요청 (10/26) | `admin/scripts/card.mjs` |
|
||||
| [x] | 10/27 계좌 타로(철회: 경제와 무관한 각이라는 피드백, 포스트 4587 숨김 필요·인스타 앱에서 삭제 필요 / 경제 주식: 멍뭉산책각·꽃구경각·사진산책각) — 킹서버 카드 14→포스트 4587, 인스타 https://www.instagram.com/p/De-eiqPgZ7K/. 검수에서 2번 예보에 없는 바람 문구 빼고, 3번 '해 질 녘 8도'를 '저녁 6시 10도'로 고침, 5번 장식 점이 아래 문구를 가려 위로 옮김. card.mjs --post-wait 는 또 ECONNRESET 이라 post-king.py 로 저장 | 사용자 요청 (10/27) | `admin/scripts/card.mjs` |
|
||||
| [x] | 10/27 계좌 타로 다시(철회: 제목을 '오늘 내 주식'으로, 포스트 4590 숨김 필요·인스타 앱에서 삭제 필요 / 경제 전용 카드: 분할매수각·적금각·배당각) — 킹서버 카드 20→포스트 4590, 인스타 https://www.instagram.com/p/De-p3dygf1K/. 경제 전용 카드 10장(`admin/money-deck.json`, 그림 `gak-card/money_*.webp`) 새로 만듦, 경제 주제는 이 카드에서 오늘 날씨에 맞는 3장을 고름 | 사용자 요청 (10/27) | `admin/money-deck.json`, `admin/scripts/plan.mjs` |
|
||||
| [x] | 10/27 주식 타로(경제 전용 카드: 분할매수각·적금각·배당각) — 킹서버 카드 21→포스트 4591, 인스타 https://www.instagram.com/p/De-qodJAXp9/ | 사용자 요청 (10/27) | `admin/topics.json` |
|
||||
| [x] | 10/27 스트릿 코디(철회: 겉옷 없는 사람 2명·남성적이라는 피드백, 포스트 4588 숨김 필요·인스타 앱에서 삭제 필요) — 킹서버 카드 16→포스트 4588, 인스타 https://www.instagram.com/p/De-hDoVge1N/. 참고 스냅 f20 https://www.musinsa.com/snap/1554718501896708736 · m20 https://www.musinsa.com/snap/1561558258020785611 · f40 https://www.musinsa.com/snap/1552178778683619999 · m40 https://www.musinsa.com/snap/1549383828670555308. 사용자 요청으로 옷은 스냅에 태그된 무신사 상품만(사진에만 보이는 f20 레드 니트집업·m40 백팩 뺌). 에이블리는 공개 API 없음. 카드 15(고치기 전)는 승인 대기로 남음. 인스타 게시 API가 'Application request limit reached'를 돌려줬지만 실제 게시는 됨 | 사용자 요청 (10/27) | `admin/scripts/outfit.mjs`, `snap.mjs` |
|
||||
| [x] | 10/27 캐주얼 코디(스트릿 대체) — 킹서버 카드 19→포스트 4589, 인스타 https://www.instagram.com/p/De-oLGagZRB/. 참고 스냅 f20 https://www.musinsa.com/snap/1555508873710779888 · m20 https://www.musinsa.com/snap/1555156725005269012 · f40 https://www.musinsa.com/snap/1555157672544679299 · m40 https://www.musinsa.com/snap/1552193811640384198. 구간을 아침 체감·낮 최고 평균으로 정해 chilly, 쌀쌀한 날 겉옷 필수·미니·뮬/슬링백 제외, 여자 코디는 고프코어 감점. 카드 15·16·17·18은 버린 판 | 사용자 요청 (10/27) | `admin/scripts/snap.mjs`, `daily-ootd.mjs` |
|
||||
| [x] | 10/27 서울 근교 단풍 TOP 10 카드뉴스(매주 목요일 시리즈 첫 회) — 킹서버 카드 22→포스트 4592, 인스타 https://www.instagram.com/p/De-1vM_gVN8/. 캡션 첫 줄에 제목이 두 번 나옴(서버가 제목을 붙이는데 캡션도 제목으로 시작), 인스타 API가 request limit을 돌려줘 ig_media_id 미기록 | 사용자 요청 (10/27) | `admin/src/cards/templates.tsx` |
|
||||
| [x] | 10/28 세미정장 코디(철회: 20-30대 남자에 나팔바지라는 피드백, 포스트 4903 10/28 삭제함(deleted=true)·인스타 앱에서 삭제 필요) — 킹서버 카드 23→포스트 4903, 인스타 https://www.instagram.com/p/DfBIhUdAbbV/. 참고 스냅 f20 https://www.musinsa.com/snap/1560205304641814679 · m20 https://www.musinsa.com/snap/1551785083122597386 · f40 https://www.musinsa.com/snap/1551572173880406114 · m40 https://www.musinsa.com/snap/1556284432455808475. 4장 1:1 검수. 크롬이 2번째 장 렌더에서 멈춰 장마다 프로필을 따로 써서 다시 찍음, 인스타 API는 request limit을 돌려줬지만 실제 게시됨(ig_media_id 미기록) | 사용자 요청 (10/28) | `admin/scripts/card.mjs` |
|
||||
| [x] | 10/28 세미정장 코디 다시(20-30대 남자만 교체: 오피서 코트·헨리넥 니트·다크 브라운 와이드 팬츠·헤비 부츠·토트백, 코디 구성을 먼저 확인받고 그림) — 킹서버 카드 24→포스트 4904, 인스타 https://www.instagram.com/p/DfBJ4SlAaok/. 참고 스냅 m20 https://www.musinsa.com/snap/1562338908609136514 (나머지 3명은 카드 23과 같음). 첫 그림은 상품 썸네일을 따라 바지가 베이지로 나와 스냅 색(브라운)으로 다시 그림 | 사용자 요청 (10/28) | `admin/scripts/daily-ootd.mjs` |
|
||||
| [x] | 10/28 연애 타로(단풍각·데이트각·별보기각, 새 표지: 주제 배지 + 큰 질문) — 킹서버 카드 26→포스트 4906, 인스타 https://www.instagram.com/p/DfBQCW0ARgL/ (ig_media_id 17953447719320497). 처음 올린 카드 25→포스트 4905(인스타 DfBPIHJAR0m)는 행운 포인트가 날씨 정보뿐이라는 피드백으로 철회: 포스트 4905 deleted=true, 인스타 글은 앱에서 삭제됨. 행운 포인트를 "시각 · 행운 아이템"(리딩 속 행동에 쓰는 물건)으로 바꿔 다시 게시. 문구를 먼저 확인받음: 첫 기획의 행운 포인트(6시 1도·10시 바람)를 예보 slot 값으로 고치고, 연애와 관련 없는 카드(해돋이각·테니스각)를 데이트각·별보기각으로 바꿈. 5장 1:1 검수. 인스타 API는 두 번 다 request limit을 돌려줬지만 실제 게시됨(최신 글 확인 후 재시도 안 함) | 사용자 요청 (10/28) | `admin/src/cards/templates.tsx`, `admin/scripts/plan.mjs` |
|
||||
| [x] | 각 카드 그림 미리 생성 — 가을에 나올 만한 28장(피크닉·캠핑·놀이공원·빨래·단풍·억새·테니스·골프·군고구마·붕어빵·군밤·사진산책·별보기·환기·세차·이불빨래·데이트·치맥·막걸리·파전·우산·넷플릭스·집콕·한강밤바람·멍뭉산책·센치·감성노래·낚시) + 기존 8 = 36/68. 여름·한겨울 전용 32장은 철 되면 생성 | 사용자 요청 (10/26) | `admin/src/assets/gak-card/` |
|
||||
| [ ] | 카드 자동화 다음 단계 — ① 생성 직후 자동 검사(Claude 비전: 옷 개수·사람·글자·추가 옷, 불합격 1회 재생성) ② 승인 대기 카드 메일/Teams 알림 + 서명 토큰 승인 링크(`GET /v1/card/{id}/approve`) ③ 맥 launchd 매일 06:30 `claude -p "/daily-cards"` ④ 그림 세트가 차면 킹서버로 이전 | 사용자 요청 (10/26) | `backend/router/v1/card/card.py`, `admin/scripts/` |
|
||||
| [ ] | 앱 헤더가 400~448px 폭에서 컨테이너를 넘쳐 로그인 버튼이 잘림(`frontend/src/b/BLayout.tsx` TopBar). 캡처는 456px로 찍어 피했지만 실제 폰(430·440px)에서도 잘릴 수 있음 | 10/24 캡처 중 발견 | `frontend/src/b/BLayout.tsx` |
|
||||
@@ -342,3 +375,14 @@
|
||||
| [x] | `mobile/` 템플릿 예제 화면·`.vscode`·`LICENSE`·README 지움, `AGENTS.md`·`.claude`는 둠 | 사용자 결정 | `mobile/` |
|
||||
| [ ] | `frontend-dev` 개발 컨테이너 실제로 띄워 확인 (이미지 빌드만 확인, 5173이 사용 중이라 실행은 못 함) | 볼륨 경로 바뀜 | `compose.yaml` |
|
||||
| [ ] | 운영 서버가 git pull 뒤 루트 `package-lock.json`으로 빌드되는지 배포 때 확인 | 빌드 대상이 `./frontend` → `.` | `deploy.sh`, `compose.yaml` |
|
||||
|
||||
## 날씨게임 — 구름 합치기 (10/28)
|
||||
|
||||
| 상태 | 할 일 | 이유 | 관련 파일 |
|
||||
|---|---|---|---|
|
||||
| [ ] | 바람 방향 — API에 풍향이 없어 날짜 홀짝으로 왼쪽/오른쪽을 정함. 실제 풍향(기상청 VEC)을 내려줄지 결정 | 첫 구현 (10/28) | `frontend/src/b/cloudMerge.ts` `windDir`, `backend/router/v1/weather/protocol.py` |
|
||||
| [ ] | 오늘의 판(모두 같은 순서)·구별 순위·구 대항전·공유 카드·판 깨면 각 카드 열기 — 백엔드 필요, 재미 확인 뒤 | 기획 v2 DAU 장치 | — |
|
||||
| [ ] | **[결정 필요]** 앱인토스에 넣으면 게임물 등급분류·게임 카테고리 재등록 대상인지 토스에 확인 | 앱인토스 8월 공지 | — |
|
||||
| [ ] | 들어가는 길 — 지금은 `/game` 주소로만 열림. 피드 카드·메뉴 노출 여부 결정 | 사용자 선택 (10/28) | `frontend/src/App.tsx` |
|
||||
| [ ] | 라운드 목표 점수(200 + 라운드마다 80) — 시간 제한은 없앰(사용자 10/28). 1초에 1번 아무 데나 떨어뜨리면 4~13라운드에서 넘침. 실제 사람 플레이 보고 조정 | 라운드 추가 (10/28) | `frontend/src/b/cloudMerge.ts` `roundTarget` |
|
||||
| [x] | 라운드 각 — 라운드를 깰 때마다 2각, 하루 20각(사용자 결정 10/28). 로그인한 사람만, 판 시작 표(서명)로 남의 판·위조 거절, 라운드당 15초 안 지나면 거절. 레벨업 창은 판이 끝난 뒤에 | 계정 레벨과 연결 (10/28) | `backend/services/level_service.py` `game_token`, `frontend/src/b/CloudMergePage.tsx` `claimRound` |
|
||||
@@ -28,3 +28,6 @@ out
|
||||
|
||||
# 그날 코디 그림 (scripts/daily-ootd.mjs 가 만들고 카드가 /daily/... 로 읽는다)
|
||||
public/daily
|
||||
|
||||
# 날씨각 코디 영상 작업 폴더 (nalssigak/scripts 가 만든다)
|
||||
nalssigak/runs
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"about": "경제(주식·재테크) 타로 전용 카드. topics.json 에서 deck 이 money 인 대주제는 날씨각 각 대신 이 카드에서 오늘 날씨(when)에 맞는 3장을 고른다. 그림은 src/assets/gak-card/<code>.webp (npm run gen-image -- gak-card <code>).",
|
||||
"cards": [
|
||||
{ "code": "money_bull", "name": "불장각", "icon": "sun", "description": "맑고 따뜻해 마음이 들뜨는 날, 덩달아 사고 싶어지는 정도", "when": "하루 종일 맑고 낮이 따뜻한 날(낮 최고 20도 안팎 이상)", "scene": "the rabbit and bear cheering on top of a big glossy RED upward arrow shaped like a hill, bright sunny sky, a few gold coins bouncing around" },
|
||||
{ "code": "money_hold", "name": "존버각", "icon": "umbrella", "description": "흐리거나 비 오는 날, 팔지 않고 버티기 좋은 정도", "when": "흐리거나 비 소식이 있는 날", "scene": "the bear sitting firmly on a small pile of gold coins holding an umbrella in gentle rain, calm and determined, the rabbit hugging the bear's arm" },
|
||||
{ "code": "money_split", "name": "분할매수각", "icon": "sun_cloud", "description": "아침저녁과 낮 기온 차가 큰 날, 한 번에 말고 나눠 사기 좋은 정도", "when": "아침·저녁과 낮의 기온 차가 큰 날(7도 이상)", "scene": "the rabbit carefully dropping one gold coin at a time into three small glass jars lined up in a row, morning light on one side and noon light on the other" },
|
||||
{ "code": "money_takeprofit", "name": "익절각", "icon": "gold", "description": "맑은 낮, 오른 만큼 챙겨 두기 좋은 정도", "when": "낮이 맑은 날(가장 따뜻한 시간대)", "scene": "the rabbit picking shiny golden coin-fruits from a small tree at bright noon and handing them to the bear who holds a basket" },
|
||||
{ "code": "money_stoploss", "name": "손절각", "icon": "coldwind", "description": "기온이 뚝 떨어지거나 바람이 찬 날, 미련을 끊기 좋은 정도", "when": "어제보다 기온이 크게 떨어지거나 바람이 차가운 날", "scene": "the bear calmly snipping the string of a drooping balloon with small scissors while the rabbit waves goodbye, cool wind with a few falling leaves" },
|
||||
{ "code": "money_watch", "name": "관망각", "icon": "jipkok", "description": "나가기 싫은 날, 사고팔기보다 지켜보기 좋은 정도", "when": "춥거나 흐려서 집에 있고 싶은 날", "scene": "the rabbit and bear wrapped in a blanket on a sofa, looking out the window through a toy binocular at rolling hills shaped like a gentle zigzag line" },
|
||||
{ "code": "money_avgdown", "name": "물타기각", "icon": "rain", "description": "비 오는 날, 평단 낮추기를 신중히 따져 볼 정도", "when": "비가 오는 날", "scene": "the bear carefully watering a small potted plant whose leaves are gold coins with a little watering can while light rain falls outside, the rabbit holding a tiny umbrella over the pot" },
|
||||
{ "code": "money_dividend", "name": "배당각", "icon": "sunset", "description": "해가 일찍 지는 가을·겨울 저녁, 따박따박 쌓이는 돈이 반가운 정도", "when": "가을·겨울의 맑은 저녁(해 질 녘)", "scene": "at sunset the rabbit and bear holding a basket under a tree that gently drops gold coins like acorns, warm orange sky" },
|
||||
{ "code": "money_savings", "name": "적금각", "icon": "bronze", "description": "쌀쌀하고 맑은 아침, 꾸준히 넣기 좋은 정도", "when": "아침이 쌀쌀하고(체감 10도 안팎 이하) 맑은 날", "scene": "in a crisp clear morning the rabbit wearing a small scarf dropping a plain gold coin (no symbols or marks) into a cute pastel piggy bank while the bear watches with a mug" },
|
||||
{ "code": "money_broke", "name": "텅장각", "icon": "delivery", "description": "비나 추위에 배달이 몰리는 날, 지출을 조심할 정도", "when": "비가 오거나 아주 추워 배달 주문이 몰리는 날", "scene": "the bear sitting among a stack of delivery food boxes holding an empty open wallet upside down, the rabbit peeking in surprised" }
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 246 KiB |
|
After Width: | Height: | Size: 260 KiB |
|
After Width: | Height: | Size: 251 KiB |
|
After Width: | Height: | Size: 262 KiB |
|
After Width: | Height: | Size: 264 KiB |
|
After Width: | Height: | Size: 239 KiB |
|
After Width: | Height: | Size: 261 KiB |
|
After Width: | Height: | Size: 226 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 236 KiB |
|
After Width: | Height: | Size: 240 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 236 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 267 KiB |
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"about": "날씨각 가상 모델(실존 인물을 닮지 않게 만든 얼굴). 20s 는 20-30대 코디(나이대 20·30), 40s 는 40대~ 코디(나이대 40)에 쓴다. 사진 프롬프트의 첫 참고 이미지로 쓰고, look 은 동작 설명에 넣는다. 만든 프롬프트는 prompts/",
|
||||
"women": [
|
||||
{
|
||||
"id": "f1",
|
||||
"age": "20s",
|
||||
"look": "long straight black hair, a soft innocent face with a gentle closed-lip smile"
|
||||
},
|
||||
{
|
||||
"id": "f2",
|
||||
"age": "20s",
|
||||
"look": "long wavy light brown hair, a bright cheerful face with a lively smile"
|
||||
},
|
||||
{
|
||||
"id": "f3",
|
||||
"age": "20s",
|
||||
"look": "a chic chin-length black bob with blunt bangs, a cool calm expression"
|
||||
},
|
||||
{
|
||||
"id": "f4",
|
||||
"age": "20s",
|
||||
"look": "long dark brown hair with see-through bangs, an elegant face with a soft smile"
|
||||
},
|
||||
{
|
||||
"id": "f41",
|
||||
"age": "40s",
|
||||
"look": "long soft wavy brown hair, an elegant refined face with a gentle closed-lip smile"
|
||||
},
|
||||
{
|
||||
"id": "f42",
|
||||
"age": "40s",
|
||||
"look": "a shoulder-length straight dark brown bob with a center part, a calm natural face"
|
||||
},
|
||||
{
|
||||
"id": "f43",
|
||||
"age": "40s",
|
||||
"look": "medium-length tousled wavy black hair, a chic confident face with a warm smile"
|
||||
}
|
||||
],
|
||||
"men": [
|
||||
{
|
||||
"id": "m2",
|
||||
"age": "20s",
|
||||
"look": "soft brown hair with fluffy bangs, a friendly face with a warm smile"
|
||||
},
|
||||
{
|
||||
"id": "m3",
|
||||
"age": "20s",
|
||||
"look": "a short neat black two-block haircut, a clean composed face"
|
||||
},
|
||||
{
|
||||
"id": "m5",
|
||||
"age": "20s",
|
||||
"look": "golden blond hair with soft bangs, a bright cheerful smile"
|
||||
},
|
||||
{
|
||||
"id": "m6",
|
||||
"age": "20s",
|
||||
"look": "jaw-length layered jet black hair parted in the middle, calm sharp eyes"
|
||||
},
|
||||
{
|
||||
"id": "m7",
|
||||
"age": "20s",
|
||||
"look": "short textured spiky jet black hair with piecey bangs, sharp eyes, a cool composed face"
|
||||
},
|
||||
{
|
||||
"id": "m41",
|
||||
"age": "40s",
|
||||
"look": "short neat black hair with a slight side sweep, a gentle calm face with a soft smile"
|
||||
},
|
||||
{
|
||||
"id": "m42",
|
||||
"age": "40s",
|
||||
"look": "well-groomed short side-parted black hair, thin black-rimmed glasses, a confident warm smile"
|
||||
},
|
||||
{
|
||||
"id": "m43",
|
||||
"age": "40s",
|
||||
"look": "short slicked-back black hair, a sharp confident face with a composed expression"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: long straight black hair past the shoulders, soft innocent face with a gentle closed-lip smile.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: long wavy light brown hair, bright cheerful face with a lively smile.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: chic chin-length black bob with blunt bangs, cool calm expression.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: long dark brown hair with see-through bangs, elegant graceful face with a soft smile.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: long soft wavy brown hair past the shoulders, an elegant refined face with a gentle closed-lip smile.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: shoulder-length straight dark brown bob with a center part, a calm natural face with a soft expression.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Woman: medium-length tousled wavy black hair, a chic confident face with a warm smile.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: soft brown hair with fluffy bangs, friendly puppy-like face with a warm smile.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: short neat black two-block haircut, clean dandy look, composed expression.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: short neat black hair with a slight side sweep, a gentle calm face with a soft smile.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: handsome and stylish, well-groomed short side-parted black hair, thin modern black-rimmed glasses, a defined jawline, clear skin, fit slim build, a confident warm smile, a refined smart office look.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early-to-mid 40s who must not resemble any real celebrity, actor, idol or public figure. Natural mature skin with subtle fine lines, healthy and well-groomed. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: short slicked-back black hair, a sharp confident face with a composed expression.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: golden blond hair with soft bangs, bright big cheerful smile showing a little teeth, friendly eyes.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man: jaw-length layered jet black hair parted in the middle, sharp calm eyes, composed cool expression, slim tall build.
|
||||
@@ -0,0 +1 @@
|
||||
Photorealistic full-body fashion lookbook photo, vertical 2:3 portrait, of an ORIGINAL FICTIONAL Korean person in their early 20s who must not resemble any real celebrity, idol or public figure. Standing straight facing the camera, whole body from head to shoes in frame with a little space above the head, arms relaxed, face clearly visible with natural skin texture, soft even studio light, plain light gray seamless studio background. Simple base outfit: plain white t-shirt, straight blue jeans and white sneakers. No text, no logo, no watermark. Man in his late 20s: short textured spiky jet black hair with piecey bangs, sharp narrow eyes, a defined jawline, a cool slightly serious expression.
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"about": "배경음악은 상업 영상에 쓸 수 있고 출처 표기가 필요 없는 Mixkit Stock Music Free License 곡만 쓴다. 음원은 저장소에 넣지 않고 runs/cache/music 에 내려받는다. 사람이 들어 보고 고른 곡만 추가한다.",
|
||||
"tracks": [
|
||||
{"id": "mixkit-839", "title": "Tears of Joy", "artist": "Michael Ramir C.", "url": "https://assets.mixkit.co/music/839/839.mp3", "credit": "🎵 Music: Tears of Joy (Mixkit)"},
|
||||
{"id": "mixkit-493", "title": "Beautiful Dream", "artist": "Diego Nava", "url": "https://assets.mixkit.co/music/493/493.mp3", "credit": "🎵 Music: Beautiful Dream (Mixkit)"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
"""클립 동작을 templates/actions.json 에서 무작위로 고른다. 한 사람의 a·b 클립이 같은 동작이 되지 않게 겹치지 않게 뽑는다.
|
||||
|
||||
python3 actions.py --who woman --has outer,bag # 두 줄 출력: a 클립 동작, b 클립 동작
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import random
|
||||
from pathlib import Path
|
||||
|
||||
ACTIONS = Path(__file__).resolve().parent.parent / "templates" / "actions.json"
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--who", choices=["woman", "man"], required=True)
|
||||
parser.add_argument("--has", default="", help="그 사람에게 있는 것 (outer, bag 을 쉼표로)")
|
||||
parser.add_argument("--n", type=int, default=2)
|
||||
args = parser.parse_args()
|
||||
|
||||
has = {h.strip() for h in args.has.split(",") if h.strip()}
|
||||
pool = [a["text"] for a in json.loads(ACTIONS.read_text(encoding="utf-8"))[args.who] if set(a.get("needs", [])) <= has]
|
||||
if len(pool) < args.n:
|
||||
raise SystemExit(f"{args.who} 동작 후보가 {len(pool)}개라 {args.n}개를 고를 수 없어요")
|
||||
print("\n".join(random.SystemRandom().sample(pool, args.n)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# usage: clips.sh <작업 폴더> [woman_a woman_b man_a man_b 중 다시 만들 것]
|
||||
# 작업 폴더에 woman_photo.png·man_photo.png(코디 사진)와 woman_a.txt·woman_b.txt·man_a.txt·man_b.txt(동작 설명)를 두면
|
||||
# 4초 클립 4개(woman_a.mp4 …)를 만든다. 이미 있는 클립은 건너뛰고, 이름을 주면 그 클립만 지우고 다시 만든다.
|
||||
set -euo pipefail
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
WORK=$(cd "$1" && pwd); shift
|
||||
cd "$WORK"
|
||||
for name in "$@"; do rm -f "$name.mp4" "$name.workflow.json"; done
|
||||
trap '"$HERE/server.sh" down' EXIT
|
||||
negative=$(cat "$HERE/../templates/negative.txt")
|
||||
for who in woman man; do
|
||||
[ -s ${who}_first.png ] || ffmpeg -hide_banner -loglevel error -y -i ${who}_photo.png \
|
||||
-vf "scale=1088:1920:force_original_aspect_ratio=increase:flags=lanczos,crop=1088:1920" -frames:v 1 ${who}_first.png
|
||||
done
|
||||
for name in woman_a woman_b man_a man_b; do
|
||||
[ -s "$name.mp4" ] && { echo "$name 이미 있음"; continue; }
|
||||
echo "== $name 시작 $(date +%H:%M:%S)"
|
||||
python3 "$HERE/generate.py" --image "${name%_*}_first.png" --prompt-file "$name.txt" --negative "$negative" \
|
||||
--duration 4 --seed $((RANDOM % 9000 + 100)) --anchor-end --keep-running --output "$name.mp4"
|
||||
echo "== $name 완료 $(date +%H:%M:%S)"
|
||||
done
|
||||
@@ -0,0 +1,55 @@
|
||||
"""Codex CLI의 내장 이미지 생성 도구로 그림 한 장을 만들어 PNG로 저장한다 (날씨각 sns/admin codex-image.mjs와 같은 방식).
|
||||
|
||||
usage: python3 codex_image.py --prompt-file p.txt --output out.png [--image ref.jpg ...]
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
# 도구 호출·저장만 하므로 중간 모델·낮은 추론으로 고정한다 (sns/admin과 같은 이유)
|
||||
IMAGE_MODEL = os.environ.get("CODEX_IMAGE_MODEL", "gpt-6-sol")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument("--prompt-file", required=True)
|
||||
parser.add_argument("--output", required=True)
|
||||
parser.add_argument("--image", action="append", default=[], help="참고 이미지 (여러 번 줄 수 있다)")
|
||||
args = parser.parse_args()
|
||||
|
||||
work = Path(tempfile.mkdtemp(prefix="codex-image-"))
|
||||
task = "\n".join([
|
||||
"내장 이미지 생성 도구로 아래 프롬프트대로 이미지를 만든다."
|
||||
+ (" 첨부한 참고 이미지는 프롬프트가 말한 용도로만 따른다." if args.image else ""),
|
||||
"만든 이미지를 직접 열어 확인한다: 프롬프트와 다르거나 손·얼굴이 일그러졌거나 글자·로고가 있으면 한 번만 다시 만든다 (최대 2장).",
|
||||
"통과한 한 장만 이 폴더에 result.png 로 저장한다. 다른 파일은 만들지 않는다.",
|
||||
"",
|
||||
Path(args.prompt_file).read_text(encoding="utf-8").strip(),
|
||||
])
|
||||
command = ["codex", "exec", "--skip-git-repo-check", "-C", str(work), "-s", "workspace-write", "-m", IMAGE_MODEL,
|
||||
"-c", 'model_reasoning_effort="low"']
|
||||
for image in args.image:
|
||||
command += ["-i", str(Path(image).resolve())]
|
||||
try:
|
||||
subprocess.run(command, input=task, text=True, stdout=subprocess.DEVNULL, check=True)
|
||||
result = work / "result.png"
|
||||
if not result.is_file():
|
||||
pngs = sorted(work.glob("*.png"))
|
||||
if not pngs:
|
||||
sys.exit(f"Codex가 그림을 저장하지 않았어요: {work}")
|
||||
result = pngs[0]
|
||||
Path(args.output).parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copyfile(result, args.output)
|
||||
print("saved", args.output)
|
||||
except subprocess.CalledProcessError as error:
|
||||
sys.exit(f"Codex 실행이 실패했어요 ({error}). 사용 한도나 로그인을 확인하세요.")
|
||||
finally:
|
||||
shutil.rmtree(work, ignore_errors=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
# usage: compose.sh <작업 폴더> [음악 mp3]
|
||||
# 여자(woman_a+woman_b) 6.7초 → 남자(man_a+man_b) 6.7초 → 날씨각 마무리 2.4초, 0.4초 크로스페이드로 15초 final.mp4 를 만든다.
|
||||
# 작업 폴더에 title_woman.png·title_man.png(render.py title)와 bubbles.txt("이름 시작초 끝초" 줄, PNG는 bubbles/이름.png)가 있어야 한다.
|
||||
# 두 클립 이음새의 멈춘 구간은 빨리 감아 잇는다. 영상 창은 프로필 그리드 3:4(위 240 ~ 아래 1680)를 채우고 바깥은 같은 영상을 흐리게 깔며, 글자는 피드 4:5(위 285 ~ 아래 1635) 안에 둔다.
|
||||
set -euo pipefail
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
WORK=$(cd "$1" && pwd)
|
||||
MUSIC=${2:-}
|
||||
cd "$WORK"
|
||||
[ -s mask.png ] || python3 "$HERE/render.py" mask --out mask.png
|
||||
[ -s frame.png ] || python3 "$HERE/render.py" frame --out frame.png
|
||||
[ -s outro.png ] || python3 "$HERE/render.py" outro --out outro.png
|
||||
part=6.7; outro=2.4; fade=0.4
|
||||
o1=$(python3 -c "print($part - $fade)"); o2=$(python3 -c "print(2 * $part - 2 * $fade)")
|
||||
card="scale=816:1440:flags=lanczos,format=rgba"
|
||||
blur="scale=272:480,boxblur=10:2,scale=1088:1920,crop=1080:1920:4:0,eq=brightness=0.03:saturation=0.9,format=rgba"
|
||||
join() { # 클립a 클립b 이름
|
||||
echo "[$1:v]split[$3a1][$3a2];[$3a1]trim=end=3.25,setpts=PTS-STARTPTS[$3x0];[$3a2]trim=start=3.25,setpts=(PTS-STARTPTS)/3[$3x1];[$2:v]split[$3b1][$3b2];[$3b1]trim=end=0.25,setpts=(PTS-STARTPTS)/2[$3x2];[$3b2]trim=start=0.25,setpts=PTS-STARTPTS[$3x3];[$3x0][$3x1][$3x2][$3x3]concat=n=4:v=1:a=0,fps=24,trim=duration=$part,setpts=PTS-STARTPTS,split[$3s1][$3s2];[$3s1]$card[$3v];[$3s2]$blur[$3g];"
|
||||
}
|
||||
ffmpeg -hide_banner -loglevel error -y -i woman_a.mp4 -i woman_b.mp4 -i man_a.mp4 -i man_b.mp4 \
|
||||
-loop 1 -framerate 24 -i title_woman.png -loop 1 -framerate 24 -i title_man.png -loop 1 -framerate 24 -i mask.png \
|
||||
-loop 1 -framerate 24 -i outro.png -loop 1 -framerate 24 -i frame.png -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -filter_complex "\
|
||||
$(join 0 1 w)$(join 2 3 m)\
|
||||
[6:v]format=rgba,alphaextract,split[k1][k2];[wv][k1]alphamerge[wr];[mv][k2]alphamerge[mr];\
|
||||
[4:v]trim=duration=$part,format=rgba[wb];[5:v]trim=duration=$part,format=rgba[mb];\
|
||||
[8:v]trim=duration=$part,format=rgba,split[fw][fm];\
|
||||
[wg][fw]overlay=0:0[wbg];[wbg][wr]overlay=132:240[wf];[wf][wb]overlay=0:0,format=yuv420p,setpts=PTS-STARTPTS[a];\
|
||||
[mg][fm]overlay=0:0[mbg];[mbg][mr]overlay=132:240[mf];[mf][mb]overlay=0:0,format=yuv420p,setpts=PTS-STARTPTS[b];\
|
||||
[7:v]trim=duration=$outro,format=yuv420p,setpts=PTS-STARTPTS[c];\
|
||||
[a][b]xfade=transition=fade:duration=$fade:offset=$o1[ab];[ab][c]xfade=transition=fade:duration=$fade:offset=$o2,format=yuv420p[out]" \
|
||||
-map "[out]" -map 9:a -t 15 -r 24 -c:v libx264 -preset slow -crf 18 -profile:v high -pix_fmt yuv420p \
|
||||
-c:a aac -b:a 128k -ar 44100 -movflags +faststart base.mp4
|
||||
|
||||
# 자막: 0.2초 페이드 + 살짝 올라오며 등장
|
||||
inputs=(); chain=""; prev="0:v"; k=1
|
||||
while read -r name start end; do
|
||||
[ -n "${name:-}" ] || continue
|
||||
inputs+=(-loop 1 -framerate 24 -t 15 -i "bubbles/$name.png")
|
||||
fo=$(python3 -c "print(round($end - 0.2, 2))")
|
||||
chain+="[$k:v]format=rgba,fade=in:st=$start:d=0.2:alpha=1,fade=out:st=$fo:d=0.2:alpha=1[b$k];"
|
||||
chain+="[$prev][b$k]overlay=x=0:y='max(0\,20*(1-(t-$start)/0.2))':enable='between(t,$start,$end)'[v$k];"
|
||||
prev="v$k"; k=$((k+1))
|
||||
done < bubbles.txt
|
||||
if [ $k -eq 1 ]; then cp base.mp4 bubbles.mp4; else
|
||||
ffmpeg -hide_banner -loglevel error -y -i base.mp4 "${inputs[@]}" -filter_complex "${chain%;}" -map "[$prev]" -map 0:a \
|
||||
-c:v libx264 -preset slow -crf 17 -profile:v high -pix_fmt yuv420p -c:a copy -movflags +faststart bubbles.mp4
|
||||
fi
|
||||
|
||||
if [ -n "$MUSIC" ]; then
|
||||
ffmpeg -hide_banner -loglevel error -y -i bubbles.mp4 -i "$MUSIC" -filter_complex \
|
||||
"[1:a]atrim=start=0.3:end=15.3,asetpts=PTS-STARTPTS,afade=t=in:st=0:d=0.2,afade=t=out:st=14.0:d=1.0,loudnorm=I=-14:TP=-1.5:LRA=11,aresample=44100[a]" \
|
||||
-map 0:v -map "[a]" -c:v copy -c:a aac -b:a 192k -ar 44100 -ac 2 -t 15 -movflags +faststart final.mp4
|
||||
else
|
||||
mv bubbles.mp4 final.mp4
|
||||
fi
|
||||
rm -f base.mp4 bubbles.mp4
|
||||
ffprobe -v error -show_entries format=duration:stream=codec_name,width,height -of compact final.mp4
|
||||
@@ -0,0 +1,208 @@
|
||||
"""사진 한 장으로 LTX 춤 영상을 만든다. 전용 컨테이너(server.sh)에 SSH 터널로 그래프를 보낸다.
|
||||
|
||||
menusong 그래프(ltx_graph.json)와 달리 고화질 단계에서도 원본 사진을 첫 프레임에 다시 고정한다.
|
||||
|
||||
usage: python3 generate.py --image first.png --prompt-file prompt.txt --output clip.mp4 [--duration 6 --width 1088 --height 1920]
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import uuid
|
||||
from pathlib import Path
|
||||
|
||||
HERE = Path(__file__).resolve().parent
|
||||
DEFAULT_NEGATIVE = "distorted anatomy, extra limbs, flicker, blurry, watermark, text"
|
||||
UNUSED_NODES = ("409", "405:380", "405:381", "405:382", "405:383", "405:393")
|
||||
|
||||
|
||||
def call(method, url, body=None, headers=None, timeout=60):
|
||||
request = urllib.request.Request(url, data=body, method=method, headers=headers or {})
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=timeout) as response:
|
||||
return response.status, response.read()
|
||||
except urllib.error.HTTPError as error:
|
||||
return error.code, error.read()
|
||||
|
||||
|
||||
def upload_image(base, path):
|
||||
boundary = uuid.uuid4().hex
|
||||
data = Path(path).read_bytes()
|
||||
body = (f"--{boundary}\r\nContent-Disposition: form-data; name=\"image\"; filename=\"{Path(path).name}\"\r\n"
|
||||
f"Content-Type: image/png\r\n\r\n").encode() + data + f"\r\n--{boundary}--\r\n".encode()
|
||||
status, raw = call("POST", base + "/upload/image", body, {"Content-Type": f"multipart/form-data; boundary={boundary}"})
|
||||
if status != 200:
|
||||
sys.exit(f"이미지 업로드 실패 {status}: {raw[:200]!r}")
|
||||
uploaded = json.loads(raw)
|
||||
return "/".join(filter(None, (uploaded.get("subfolder", ""), uploaded["name"])))
|
||||
|
||||
|
||||
def build_graph(base, args, image_name):
|
||||
graph = json.loads((HERE / "ltx_graph.json").read_text(encoding="utf-8"))
|
||||
graph["405:376"]["inputs"]["value"] = Path(args.prompt_file).read_text(encoding="utf-8").strip()
|
||||
graph["405:373"]["inputs"]["text"] = args.negative
|
||||
for node in ("405:338", "405:339"):
|
||||
graph[node]["inputs"]["noise_seed"] = args.seed
|
||||
graph["405:361"]["inputs"]["value"] = 24
|
||||
graph["405:362"]["inputs"]["value"] = math.ceil(args.duration)
|
||||
graph["405:372"]["inputs"]["value"] = args.width
|
||||
graph["405:360"]["inputs"]["value"] = args.height
|
||||
graph["405:364"]["inputs"]["text"] = ["405:376", 0]
|
||||
for unused in UNUSED_NODES:
|
||||
graph.pop(unused, None)
|
||||
if args.refine_sigmas:
|
||||
graph["405:395"]["inputs"]["sigmas"] = args.refine_sigmas
|
||||
|
||||
save = graph["75"]["inputs"]
|
||||
save.update({"filename_prefix": "nalssigak/ootd", "format": "mp4", "codec": "h264",
|
||||
"format.codec": "h264", "format.codec.encoding": "auto", "codec.encoding": "auto"})
|
||||
status, raw = call("GET", base + "/object_info/SaveVideo")
|
||||
allowed = json.loads(raw)["SaveVideo"]["input"]["required"] if status == 200 else {}
|
||||
for field in ("format", "codec"):
|
||||
choices = allowed.get(field, [None])[0]
|
||||
if isinstance(choices, list) and save[field] not in choices:
|
||||
save[field] = "auto"
|
||||
|
||||
# 저해상도 단계: menusong과 같은 방식으로 첫 프레임 가이드를 붙였다가 업스케일 전에 떼어낸다.
|
||||
graph["_img_load"] = {"class_type": "LoadImage", "inputs": {"image": image_name}}
|
||||
graph["_img_guide"] = {"class_type": "LTXVAddGuide", "inputs": {
|
||||
"positive": ["405:365", 0], "negative": ["405:365", 1], "vae": ["405:385", 0],
|
||||
"latent": ["405:356", 0], "image": ["_img_load", 0], "frame_idx": 0, "strength": 1.0}}
|
||||
# 처음 말고도 가운데·마지막 프레임을 원본 사진으로 잡아 움직이는 동안 얼굴이 멀어지는 것을 막는다.
|
||||
frames = 24 * math.ceil(args.duration)
|
||||
anchors = [round(frames * k / (args.anchor_mid + 1) / 8) * 8 for k in range(1, args.anchor_mid + 1)]
|
||||
if args.anchor_end:
|
||||
anchors.append(-1)
|
||||
|
||||
def chain(prefix, source, latent):
|
||||
for number, frame in enumerate(anchors):
|
||||
name = f"{prefix}{number}"
|
||||
graph[name] = {"class_type": "LTXVAddGuide", "inputs": {
|
||||
"positive": [source, 0], "negative": [source, 1], "vae": ["405:385", 0], "latent": latent,
|
||||
"image": ["_img_load", 0], "frame_idx": frame, "strength": args.end_strength}}
|
||||
source, latent = name, [name, 2]
|
||||
return source, latent
|
||||
|
||||
low, low_latent = chain("_img_anchor", "_img_guide", ["_img_guide", 2])
|
||||
graph["405:377"]["inputs"]["video_latent"] = low_latent
|
||||
graph["405:388"]["inputs"].update(positive=[low, 0], negative=[low, 1])
|
||||
graph["_crop_guides"] = {"class_type": "LTXVCropGuides", "inputs": {
|
||||
"positive": [low, 0], "negative": [low, 1], "latent": ["405:367", 0]}}
|
||||
graph["405:348"]["inputs"]["samples"] = ["_crop_guides", 2]
|
||||
graph["405:391"]["inputs"].update(positive=["_crop_guides", 0], negative=["_crop_guides", 1])
|
||||
|
||||
# 고화질 단계: 업스케일한 latent의 첫 프레임을 원본 사진으로 다시 고정한다.
|
||||
graph["_hd_inplace"] = {"class_type": "LTXVImgToVideoInplace", "inputs": {
|
||||
"vae": ["405:385", 0], "image": ["_img_load", 0], "latent": ["405:348", 0],
|
||||
"strength": args.hd_strength, "bypass": False}}
|
||||
graph["405:340"]["inputs"]["video_latent"] = ["_hd_inplace", 0]
|
||||
if anchors:
|
||||
high, high_latent = chain("_hd_anchor", "_crop_guides", ["_hd_inplace", 0])
|
||||
graph["405:340"]["inputs"]["video_latent"] = high_latent
|
||||
graph["405:391"]["inputs"].update(positive=[high, 0], negative=[high, 1])
|
||||
graph["_hd_crop"] = {"class_type": "LTXVCropGuides", "inputs": {
|
||||
"positive": [high, 0], "negative": [high, 1], "latent": ["405:369", 0]}}
|
||||
graph["405:374"]["inputs"]["samples"] = ["_hd_crop", 2]
|
||||
return graph
|
||||
|
||||
|
||||
def wait_result(base, prompt_id, timeout):
|
||||
deadline = time.monotonic() + timeout
|
||||
started = time.monotonic()
|
||||
while time.monotonic() < deadline:
|
||||
status, raw = call("GET", base + "/history/" + prompt_id)
|
||||
entry = json.loads(raw).get(prompt_id) if status == 200 else None
|
||||
if entry:
|
||||
state = entry.get("status", {})
|
||||
if state.get("status_str") == "error":
|
||||
sys.exit("생성 실패: " + json.dumps(state.get("messages", []), ensure_ascii=False)[:2000])
|
||||
for items in entry.get("outputs", {}).get("75", {}).values():
|
||||
for item in items if isinstance(items, list) else []:
|
||||
if isinstance(item, dict) and str(item.get("filename", "")).endswith(".mp4"):
|
||||
print(f"생성 완료 {time.monotonic() - started:.0f}s", flush=True)
|
||||
return item
|
||||
if state.get("completed"):
|
||||
sys.exit("완료됐지만 MP4가 없습니다")
|
||||
time.sleep(5)
|
||||
sys.exit("시간 초과: 서버에서 계속 생성 중일 수 있습니다. server.sh status로 확인하세요")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument("--image", required=True, help="첫 프레임 PNG (width×height와 같은 비율)")
|
||||
parser.add_argument("--prompt-file", required=True)
|
||||
parser.add_argument("--output", required=True)
|
||||
parser.add_argument("--negative", default=DEFAULT_NEGATIVE)
|
||||
parser.add_argument("--duration", type=int, default=6)
|
||||
parser.add_argument("--seed", type=int, default=42)
|
||||
parser.add_argument("--width", type=int, default=1088)
|
||||
parser.add_argument("--height", type=int, default=1920)
|
||||
parser.add_argument("--hd-strength", type=float, default=1.0, help="고화질 단계 첫 프레임 고정 강도 0~1")
|
||||
parser.add_argument("--anchor-end", action="store_true", help="마지막 프레임도 원본 사진으로 고정 (처음·끝 자세가 같아진다)")
|
||||
parser.add_argument("--anchor-mid", type=int, default=0, help="중간에 원본 사진으로 고정할 프레임 수 (고르게 나눔)")
|
||||
parser.add_argument("--end-strength", type=float, default=1.0, help="중간·마지막 프레임 고정 강도")
|
||||
parser.add_argument("--refine-sigmas", default="", help="고화질 단계 sigma 목록. 비우면 menusong 기본값")
|
||||
parser.add_argument("--timeout", type=int, default=1800)
|
||||
parser.add_argument("--keep-running", action="store_true", help="끝난 뒤 컨테이너를 내리지 않는다")
|
||||
args = parser.parse_args()
|
||||
for side in (args.width, args.height):
|
||||
if side % 64 or not 256 <= side <= 2048:
|
||||
sys.exit("width와 height는 256~2048 사이 64의 배수여야 합니다")
|
||||
|
||||
server = [str(HERE / "server.sh")]
|
||||
if subprocess.run(server + ["up"]).returncode != 0:
|
||||
sys.exit("전용 컨테이너를 시작하지 못했습니다")
|
||||
with socket.socket() as sock:
|
||||
sock.bind(("127.0.0.1", 0))
|
||||
port = sock.getsockname()[1]
|
||||
remote_port = int(os.environ.get("OOTD_SERVER_PORT", "32681"))
|
||||
host = os.environ.get("OOTD_SERVER_HOST", "King_admin")
|
||||
tunnel = subprocess.Popen(["ssh", "-N", "-T", "-o", "BatchMode=yes", "-o", "ExitOnForwardFailure=yes",
|
||||
"-o", "ServerAliveInterval=15", "-L", f"127.0.0.1:{port}:127.0.0.1:{remote_port}", host],
|
||||
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
base = f"http://127.0.0.1:{port}"
|
||||
finished = False
|
||||
try:
|
||||
for _ in range(100):
|
||||
try:
|
||||
if call("GET", base + "/system_stats", timeout=2)[0] == 200:
|
||||
break
|
||||
except OSError:
|
||||
time.sleep(0.3)
|
||||
else:
|
||||
sys.exit("SSH 터널 연결 실패")
|
||||
graph = build_graph(base, args, upload_image(base, args.image))
|
||||
Path(args.output).with_suffix(".workflow.json").write_text(json.dumps(graph, ensure_ascii=False, indent=1), encoding="utf-8")
|
||||
status, raw = call("POST", base + "/prompt", json.dumps({"prompt": graph, "client_id": uuid.uuid4().hex}).encode(),
|
||||
{"Content-Type": "application/json"})
|
||||
if status != 200:
|
||||
sys.exit(f"그래프 제출 실패 {status}: {raw[:1500].decode(errors='replace')}")
|
||||
prompt_id = json.loads(raw)["prompt_id"]
|
||||
print("prompt", prompt_id, flush=True)
|
||||
item = wait_result(base, prompt_id, args.timeout)
|
||||
query = urllib.parse.urlencode({k: item[k] for k in ("filename", "subfolder", "type") if k in item})
|
||||
status, data = call("GET", base + "/view?" + query, timeout=300)
|
||||
if status != 200 or not data:
|
||||
sys.exit(f"결과 다운로드 실패 {status}")
|
||||
Path(args.output).write_bytes(data)
|
||||
print("saved", args.output, flush=True)
|
||||
finished = True
|
||||
finally:
|
||||
tunnel.terminate()
|
||||
tunnel.wait(timeout=5)
|
||||
# 실패·중단 때도 GPU를 놓아주도록 컨테이너를 멈춘다.
|
||||
if not args.keep_running:
|
||||
subprocess.run(server + ["down"])
|
||||
if not finished:
|
||||
print("중단됨: 결과를 받지 못했습니다", file=sys.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,641 @@
|
||||
{
|
||||
"75": {
|
||||
"inputs": {
|
||||
"filename_prefix": "menusong/clip",
|
||||
"format": "auto",
|
||||
"format.codec": "auto",
|
||||
"codec": "auto",
|
||||
"video": [
|
||||
"405:370",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "SaveVideo",
|
||||
"_meta": {
|
||||
"title": "비디오 저장"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"inputs": {
|
||||
"aspect_ratio": "16:9 (Widescreen)",
|
||||
"megapixels": 0.9,
|
||||
"multiple": 32
|
||||
},
|
||||
"class_type": "ResolutionSelector",
|
||||
"_meta": {
|
||||
"title": "해상도 선택기"
|
||||
}
|
||||
},
|
||||
"405:370": {
|
||||
"inputs": {
|
||||
"fps": [
|
||||
"405:359",
|
||||
0
|
||||
],
|
||||
"bit_depth": 8,
|
||||
"images": [
|
||||
"405:374",
|
||||
0
|
||||
],
|
||||
"audio": [
|
||||
"405:358",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "CreateVideo",
|
||||
"_meta": {
|
||||
"title": "비디오 생성"
|
||||
}
|
||||
},
|
||||
"405:340": {
|
||||
"inputs": {
|
||||
"video_latent": [
|
||||
"405:348",
|
||||
0
|
||||
],
|
||||
"audio_latent": [
|
||||
"405:367",
|
||||
1
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVConcatAVLatent",
|
||||
"_meta": {
|
||||
"title": "LTXVConcatAVLatent"
|
||||
}
|
||||
},
|
||||
"405:395": {
|
||||
"inputs": {
|
||||
"sigmas": "0.85, 0.7250, 0.4219, 0.0"
|
||||
},
|
||||
"class_type": "ManualSigmas",
|
||||
"_meta": {
|
||||
"title": "ManualSigmas"
|
||||
}
|
||||
},
|
||||
"405:348": {
|
||||
"inputs": {
|
||||
"samples": [
|
||||
"405:367",
|
||||
0
|
||||
],
|
||||
"upscale_model": [
|
||||
"405:371",
|
||||
0
|
||||
],
|
||||
"vae": [
|
||||
"405:385",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVLatentUpsampler",
|
||||
"_meta": {
|
||||
"title": "LTXVLatentUpsampler"
|
||||
}
|
||||
},
|
||||
"405:358": {
|
||||
"inputs": {
|
||||
"samples": [
|
||||
"405:369",
|
||||
1
|
||||
],
|
||||
"audio_vae": [
|
||||
"405:386",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVAudioVAEDecode",
|
||||
"_meta": {
|
||||
"title": "LTXV 오디오 VAE 디코드"
|
||||
}
|
||||
},
|
||||
"405:341": {
|
||||
"inputs": {
|
||||
"sampler_name": "euler_ancestral"
|
||||
},
|
||||
"class_type": "KSamplerSelect",
|
||||
"_meta": {
|
||||
"title": "KSampler (선택)"
|
||||
}
|
||||
},
|
||||
"405:391": {
|
||||
"inputs": {
|
||||
"video_cfg": 1.0,
|
||||
"audio_cfg": 1.0,
|
||||
"model": [
|
||||
"405:384",
|
||||
0
|
||||
],
|
||||
"positive": [
|
||||
"405:365",
|
||||
0
|
||||
],
|
||||
"negative": [
|
||||
"405:365",
|
||||
1
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVDualCFGGuider",
|
||||
"_meta": {
|
||||
"title": "LTXV Dual CFG Guider"
|
||||
}
|
||||
},
|
||||
"405:368": {
|
||||
"inputs": {
|
||||
"noise": [
|
||||
"405:338",
|
||||
0
|
||||
],
|
||||
"guider": [
|
||||
"405:391",
|
||||
0
|
||||
],
|
||||
"sampler": [
|
||||
"405:341",
|
||||
0
|
||||
],
|
||||
"sigmas": [
|
||||
"405:395",
|
||||
0
|
||||
],
|
||||
"latent_image": [
|
||||
"405:340",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "SamplerCustomAdvanced",
|
||||
"_meta": {
|
||||
"title": "고급 사용자 정의 샘플러"
|
||||
}
|
||||
},
|
||||
"405:338": {
|
||||
"inputs": {
|
||||
"noise_seed": 42
|
||||
},
|
||||
"class_type": "RandomNoise",
|
||||
"_meta": {
|
||||
"title": "무작위 노이즈"
|
||||
}
|
||||
},
|
||||
"405:367": {
|
||||
"inputs": {
|
||||
"av_latent": [
|
||||
"405:344",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVSeparateAVLatent",
|
||||
"_meta": {
|
||||
"title": "LTXVSeparateAVLatent"
|
||||
}
|
||||
},
|
||||
"405:369": {
|
||||
"inputs": {
|
||||
"av_latent": [
|
||||
"405:368",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVSeparateAVLatent",
|
||||
"_meta": {
|
||||
"title": "LTXVSeparateAVLatent"
|
||||
}
|
||||
},
|
||||
"405:374": {
|
||||
"inputs": {
|
||||
"tile_size": 512,
|
||||
"overlap": 64,
|
||||
"temporal_size": 64,
|
||||
"temporal_overlap": 16,
|
||||
"samples": [
|
||||
"405:369",
|
||||
0
|
||||
],
|
||||
"vae": [
|
||||
"405:385",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "VAEDecodeTiled",
|
||||
"_meta": {
|
||||
"title": "VAE 디코드 (타일)"
|
||||
}
|
||||
},
|
||||
"405:344": {
|
||||
"inputs": {
|
||||
"noise": [
|
||||
"405:339",
|
||||
0
|
||||
],
|
||||
"guider": [
|
||||
"405:388",
|
||||
0
|
||||
],
|
||||
"sampler": [
|
||||
"405:352",
|
||||
0
|
||||
],
|
||||
"sigmas": [
|
||||
"405:404",
|
||||
0
|
||||
],
|
||||
"latent_image": [
|
||||
"405:377",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "SamplerCustomAdvanced",
|
||||
"_meta": {
|
||||
"title": "고급 사용자 정의 샘플러"
|
||||
}
|
||||
},
|
||||
"405:404": {
|
||||
"inputs": {
|
||||
"sigmas": "1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0"
|
||||
},
|
||||
"class_type": "ManualSigmas",
|
||||
"_meta": {
|
||||
"title": "ManualSigmas"
|
||||
}
|
||||
},
|
||||
"405:388": {
|
||||
"inputs": {
|
||||
"video_cfg": 1.0,
|
||||
"audio_cfg": 1.0,
|
||||
"model": [
|
||||
"405:384",
|
||||
0
|
||||
],
|
||||
"positive": [
|
||||
"405:365",
|
||||
0
|
||||
],
|
||||
"negative": [
|
||||
"405:365",
|
||||
1
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVDualCFGGuider",
|
||||
"_meta": {
|
||||
"title": "LTXV Dual CFG Guider"
|
||||
}
|
||||
},
|
||||
"405:352": {
|
||||
"inputs": {
|
||||
"sampler_name": "euler_ancestral"
|
||||
},
|
||||
"class_type": "KSamplerSelect",
|
||||
"_meta": {
|
||||
"title": "KSampler (선택)"
|
||||
}
|
||||
},
|
||||
"405:339": {
|
||||
"inputs": {
|
||||
"noise_seed": 903463531924076
|
||||
},
|
||||
"class_type": "RandomNoise",
|
||||
"_meta": {
|
||||
"title": "무작위 노이즈"
|
||||
}
|
||||
},
|
||||
"405:365": {
|
||||
"inputs": {
|
||||
"frame_rate": [
|
||||
"405:359",
|
||||
0
|
||||
],
|
||||
"positive": [
|
||||
"405:364",
|
||||
0
|
||||
],
|
||||
"negative": [
|
||||
"405:373",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVConditioning",
|
||||
"_meta": {
|
||||
"title": "LTXV 조건 설정"
|
||||
}
|
||||
},
|
||||
"405:377": {
|
||||
"inputs": {
|
||||
"video_latent": [
|
||||
"405:356",
|
||||
0
|
||||
],
|
||||
"audio_latent": [
|
||||
"405:366",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVConcatAVLatent",
|
||||
"_meta": {
|
||||
"title": "LTXVConcatAVLatent"
|
||||
}
|
||||
},
|
||||
"405:373": {
|
||||
"inputs": {
|
||||
"text": "distorted anatomy, extra limbs, flicker, blurry, watermark, text",
|
||||
"clip": [
|
||||
"405:387",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "CLIPTextEncode",
|
||||
"_meta": {
|
||||
"title": "CLIP 텍스트 인코딩 (프롬프트)"
|
||||
}
|
||||
},
|
||||
"405:356": {
|
||||
"inputs": {
|
||||
"width": [
|
||||
"405:353",
|
||||
1
|
||||
],
|
||||
"height": [
|
||||
"405:355",
|
||||
1
|
||||
],
|
||||
"length": [
|
||||
"405:378",
|
||||
1
|
||||
],
|
||||
"batch_size": 1
|
||||
},
|
||||
"class_type": "EmptyLTXVLatentVideo",
|
||||
"_meta": {
|
||||
"title": "빈 잠재 비디오 (LTXV)"
|
||||
}
|
||||
},
|
||||
"405:366": {
|
||||
"inputs": {
|
||||
"frames_number": [
|
||||
"405:378",
|
||||
1
|
||||
],
|
||||
"frame_rate": [
|
||||
"405:359",
|
||||
1
|
||||
],
|
||||
"batch_size": 1,
|
||||
"audio_vae": [
|
||||
"405:386",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "LTXVEmptyLatentAudio",
|
||||
"_meta": {
|
||||
"title": "LTXV 빈 latent 오디오"
|
||||
}
|
||||
},
|
||||
"405:381": {
|
||||
"inputs": {
|
||||
"source": [
|
||||
"405:382",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "PreviewAny",
|
||||
"_meta": {
|
||||
"title": "미리보기 아무거나"
|
||||
}
|
||||
},
|
||||
"405:382": {
|
||||
"inputs": {
|
||||
"switch": [
|
||||
"405:383",
|
||||
0
|
||||
],
|
||||
"on_false": [
|
||||
"405:376",
|
||||
0
|
||||
],
|
||||
"on_true": [
|
||||
"405:380",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "ComfySwitchNode",
|
||||
"_meta": {
|
||||
"title": "스위치"
|
||||
}
|
||||
},
|
||||
"405:371": {
|
||||
"inputs": {
|
||||
"model_name": "ltx-2.5-latent-spatial-upscaler-x2-bf16-1.0.safetensors"
|
||||
},
|
||||
"class_type": "LatentUpscaleModelLoader",
|
||||
"_meta": {
|
||||
"title": "Latent 업스케일 모델 불러오기"
|
||||
}
|
||||
},
|
||||
"405:384": {
|
||||
"inputs": {
|
||||
"unet_name": "ltx-2.5-22b-distilled-transformer-comfy-int8-convrot.safetensors",
|
||||
"weight_dtype": "default"
|
||||
},
|
||||
"class_type": "UNETLoader",
|
||||
"_meta": {
|
||||
"title": "확산 모델 로드"
|
||||
}
|
||||
},
|
||||
"405:385": {
|
||||
"inputs": {
|
||||
"vae_name": "ltx-2.5-video-vae-bf16.safetensors"
|
||||
},
|
||||
"class_type": "VAELoader",
|
||||
"_meta": {
|
||||
"title": "VAE 로드"
|
||||
}
|
||||
},
|
||||
"405:386": {
|
||||
"inputs": {
|
||||
"vae_name": "ltx-2.5-audio-vae-bf16.safetensors"
|
||||
},
|
||||
"class_type": "VAELoader",
|
||||
"_meta": {
|
||||
"title": "VAE 로드"
|
||||
}
|
||||
},
|
||||
"405:387": {
|
||||
"inputs": {
|
||||
"clip_name": "gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors",
|
||||
"type": "ltxv",
|
||||
"device": "default"
|
||||
},
|
||||
"class_type": "CLIPLoader",
|
||||
"_meta": {
|
||||
"title": "CLIP 로드"
|
||||
}
|
||||
},
|
||||
"405:380": {
|
||||
"inputs": {
|
||||
"prompt": [
|
||||
"405:376",
|
||||
0
|
||||
],
|
||||
"max_length": 600,
|
||||
"sampling_mode": "on",
|
||||
"sampling_mode.temperature": 0.7,
|
||||
"sampling_mode.top_k": 64,
|
||||
"sampling_mode.top_p": 0.95,
|
||||
"sampling_mode.min_p": 0.05,
|
||||
"sampling_mode.repetition_penalty": 1.15,
|
||||
"sampling_mode.seed": 0,
|
||||
"sampling_mode.presence_penalty": 0.0,
|
||||
"thinking": false,
|
||||
"use_default_template": true,
|
||||
"clip": [
|
||||
"405:393",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "TextGenerateLTX2Prompt",
|
||||
"_meta": {
|
||||
"title": "TextGenerateLTX2Prompt"
|
||||
}
|
||||
},
|
||||
"405:378": {
|
||||
"inputs": {
|
||||
"expression": "a * b + 1",
|
||||
"values.a": [
|
||||
"405:362",
|
||||
0
|
||||
],
|
||||
"values.b": [
|
||||
"405:361",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "ComfyMathExpression",
|
||||
"_meta": {
|
||||
"title": "Math Expression (length)"
|
||||
}
|
||||
},
|
||||
"405:353": {
|
||||
"inputs": {
|
||||
"expression": "a/2",
|
||||
"values.a": [
|
||||
"405:372",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "ComfyMathExpression",
|
||||
"_meta": {
|
||||
"title": "수학식"
|
||||
}
|
||||
},
|
||||
"405:355": {
|
||||
"inputs": {
|
||||
"expression": "a/2",
|
||||
"values.a": [
|
||||
"405:360",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "ComfyMathExpression",
|
||||
"_meta": {
|
||||
"title": "수학식"
|
||||
}
|
||||
},
|
||||
"405:359": {
|
||||
"inputs": {
|
||||
"expression": "a",
|
||||
"values.a": [
|
||||
"405:361",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "ComfyMathExpression",
|
||||
"_meta": {
|
||||
"title": "Math Expression (fps)"
|
||||
}
|
||||
},
|
||||
"405:360": {
|
||||
"inputs": {
|
||||
"value": [
|
||||
"409",
|
||||
1
|
||||
]
|
||||
},
|
||||
"class_type": "PrimitiveInt",
|
||||
"_meta": {
|
||||
"title": "Height"
|
||||
}
|
||||
},
|
||||
"405:361": {
|
||||
"inputs": {
|
||||
"value": 24
|
||||
},
|
||||
"class_type": "PrimitiveInt",
|
||||
"_meta": {
|
||||
"title": "Frame Rate"
|
||||
}
|
||||
},
|
||||
"405:362": {
|
||||
"inputs": {
|
||||
"value": 5
|
||||
},
|
||||
"class_type": "PrimitiveInt",
|
||||
"_meta": {
|
||||
"title": "Duration"
|
||||
}
|
||||
},
|
||||
"405:372": {
|
||||
"inputs": {
|
||||
"value": [
|
||||
"409",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "PrimitiveInt",
|
||||
"_meta": {
|
||||
"title": "Width"
|
||||
}
|
||||
},
|
||||
"405:376": {
|
||||
"inputs": {
|
||||
"value": "A single cute rounded rice-cake mascot waves hello on a colorful stage, gentle toy-like 3D animation, warm soft lighting, stable camera."
|
||||
},
|
||||
"class_type": "PrimitiveStringMultiline",
|
||||
"_meta": {
|
||||
"title": "Prompt"
|
||||
}
|
||||
},
|
||||
"405:393": {
|
||||
"inputs": {
|
||||
"clip_name": "gemma4-12b-with-proj-ltx-2.5-comfy-int8-convrot.safetensors",
|
||||
"type": "ltxv",
|
||||
"device": "default"
|
||||
},
|
||||
"class_type": "CLIPLoader",
|
||||
"_meta": {
|
||||
"title": "CLIP 로드"
|
||||
}
|
||||
},
|
||||
"405:383": {
|
||||
"inputs": {
|
||||
"value": false
|
||||
},
|
||||
"class_type": "PrimitiveBoolean",
|
||||
"_meta": {
|
||||
"title": "Boolean (Enable Prompt Enhance)"
|
||||
}
|
||||
},
|
||||
"405:364": {
|
||||
"inputs": {
|
||||
"text": [
|
||||
"405:382",
|
||||
0
|
||||
],
|
||||
"clip": [
|
||||
"405:387",
|
||||
0
|
||||
]
|
||||
},
|
||||
"class_type": "CLIPTextEncode",
|
||||
"_meta": {
|
||||
"title": "CLIP 텍스트 인코딩 (프롬프트)"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
"""templates/ 의 HTML을 헤드리스 크롬으로 PNG로 찍는다.
|
||||
|
||||
usage:
|
||||
python3 render.py title --age 30 --who 여성 --label 하객룩 --out title_woman.png
|
||||
python3 render.py bubble --text "*크롭 재킷*으로 시크하게" --out bubbles/w1.png
|
||||
python3 render.py frame --out frame.png
|
||||
python3 render.py outro --out outro.png
|
||||
python3 render.py mask --out mask.png
|
||||
자막: *단어* 는 주황 강조, | 는 띄어쓰기로 바뀐다(한 줄). title·bubble 은 영상 위에 얹는 투명 PNG, frame 은 흐린 배경과 영상 사이의 창 그림자.
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import urllib.parse
|
||||
from pathlib import Path
|
||||
|
||||
TEMPLATES = Path(__file__).resolve().parent.parent / "templates"
|
||||
CHROME = os.environ.get("CHROME_BIN", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome")
|
||||
# compose.sh 의 영상 창 크기와 같아야 한다
|
||||
CARD = (816, 1440)
|
||||
|
||||
|
||||
def shoot(url, out, size=(1080, 1920), transparent=False):
|
||||
profile = tempfile.mkdtemp(prefix="render-")
|
||||
command = [CHROME, "--headless=new", "--disable-gpu", "--hide-scrollbars", f"--user-data-dir={profile}",
|
||||
"--force-device-scale-factor=1", f"--window-size={size[0]},{size[1]}", "--virtual-time-budget=6000",
|
||||
f"--screenshot={Path(out).resolve()}", url]
|
||||
if transparent:
|
||||
command.insert(-1, "--default-background-color=00000000")
|
||||
Path(out).parent.mkdir(parents=True, exist_ok=True)
|
||||
Path(out).unlink(missing_ok=True)
|
||||
try:
|
||||
# 크롬이 가끔 멈추므로 40초에서 끊는다
|
||||
subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, timeout=40)
|
||||
except subprocess.TimeoutExpired:
|
||||
pass
|
||||
finally:
|
||||
shutil.rmtree(profile, ignore_errors=True)
|
||||
if not Path(out).is_file():
|
||||
sys.exit(f"찍지 못했어요: {out}")
|
||||
print("saved", out)
|
||||
|
||||
|
||||
def page(name, **query):
|
||||
return (TEMPLATES / name).as_uri() + ("?" + urllib.parse.urlencode(query) if query else "")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument("kind", choices=["title", "bubble", "frame", "outro", "mask"])
|
||||
parser.add_argument("--out", required=True)
|
||||
parser.add_argument("--age", default="20")
|
||||
parser.add_argument("--who", default="여성")
|
||||
parser.add_argument("--label", default="코디")
|
||||
parser.add_argument("--text")
|
||||
args = parser.parse_args()
|
||||
if args.kind == "title":
|
||||
shoot(page("title.html", age=args.age, who=args.who, label=args.label), args.out, transparent=True)
|
||||
elif args.kind == "bubble":
|
||||
if args.text is None:
|
||||
sys.exit("bubble 은 --text 가 필요해요")
|
||||
shoot(page("bubble.html", t=args.text), args.out, transparent=True)
|
||||
elif args.kind == "frame":
|
||||
shoot(page("frame.html"), args.out, transparent=True)
|
||||
elif args.kind == "outro":
|
||||
shoot(page("outro.html"), args.out)
|
||||
else:
|
||||
html = f"<body style='margin:0;background:transparent'><div style='width:{CARD[0]}px;height:{CARD[1]}px;border-radius:40px;background:white'></div></body>"
|
||||
shoot("data:text/html," + urllib.parse.quote(html), args.out, size=CARD, transparent=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
# King_admin에 날씨각 코디 영상 전용 ComfyUI(LTX) 컨테이너를 띄우고 내린다. menusong 서비스·파일은 건드리지 않는다.
|
||||
# usage: server.sh up | down | status | remove
|
||||
set -euo pipefail
|
||||
|
||||
HOST=${OOTD_SERVER_HOST:-King_admin}
|
||||
PORT=${OOTD_SERVER_PORT:-32681}
|
||||
NAME=nalssigak-ltx
|
||||
ROOT=/mnt/data2/nalssigak
|
||||
MODELS=/mnt/data2/dir/jw_playground/LTX-2.5
|
||||
IMAGE=jw/comfyui-ltx:latest
|
||||
GPU=${OOTD_GPU:-0}
|
||||
|
||||
remote() { ssh -o BatchMode=yes -o ConnectTimeout=15 "$HOST" "$@"; }
|
||||
|
||||
up() {
|
||||
remote "NAME=$NAME ROOT=$ROOT MODELS=$MODELS IMAGE=$IMAGE GPU=$GPU PORT=$PORT bash -s" <<'EOF'
|
||||
set -euo pipefail
|
||||
running() { docker inspect -f '{{.State.Running}}' "$1" 2>/dev/null | tr -d '[:space:]' || true; }
|
||||
state=$(running "$NAME"); state=${state:-missing}
|
||||
if [ "$state" != true ]; then
|
||||
# menusong은 GPU 0에 qwen·image·tts, GPU 1에 video·music을 띄운다.
|
||||
if [ "$GPU" = 0 ]; then busy="menusong-qwen menusong-image menusong-tts"; else busy="menusong-video menusong-music"; fi
|
||||
for other in $busy; do
|
||||
if [ "$(running "$other")" = true ]; then
|
||||
echo "$other 가 GPU $GPU 를 쓰는 중이라 시작하지 않습니다. 끝난 뒤 다시 실행하세요." >&2; exit 3
|
||||
fi
|
||||
done
|
||||
used=$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -i "$GPU" | tr -d ' ')
|
||||
if [ "$used" -gt 2000 ]; then
|
||||
echo "GPU $GPU 사용 중(${used}MiB)이라 시작하지 않습니다." >&2; exit 3
|
||||
fi
|
||||
# 멈춘 컨테이너는 GPU 설정이 다를 수 있어 새로 만든다.
|
||||
docker rm "$NAME" >/dev/null 2>&1 || true
|
||||
mkdir -p "$ROOT"/comfy/{input,output,temp,user}
|
||||
docker run -d --name "$NAME" --init --gpus "device=$GPU" --shm-size 2g \
|
||||
-p "127.0.0.1:$PORT:8188" --label nalssigak.ootd=true \
|
||||
-e HF_HUB_OFFLINE=1 -e TRANSFORMERS_OFFLINE=1 -e PYTHONUNBUFFERED=1 \
|
||||
-v "$MODELS/vae:/app/models/vae:ro" -v "$MODELS/model_patches:/app/models/model_patches:ro" \
|
||||
-v "$MODELS/latent_upscale_models:/app/models/latent_upscale_models:ro" \
|
||||
-v "$MODELS/diffusion_models:/app/models/diffusion_models:ro" -v "$MODELS/text_encoders:/app/models/text_encoders:ro" \
|
||||
-v "$ROOT/comfy/input:/app/input" -v "$ROOT/comfy/output:/app/output" \
|
||||
-v "$ROOT/comfy/temp:/app/temp" -v "$ROOT/comfy/user:/app/user" \
|
||||
--entrypoint python "$IMAGE" main.py --listen 0.0.0.0 --port 8188 --lowvram >/dev/null
|
||||
fi
|
||||
for _ in $(seq 1 150); do
|
||||
curl -sf "http://127.0.0.1:$PORT/system_stats" >/dev/null && { echo ready; exit 0; }
|
||||
[ "$(running "$NAME")" = true ] || { docker logs --tail 30 "$NAME" >&2; exit 1; }
|
||||
sleep 2
|
||||
done
|
||||
echo "$NAME 이(가) 5분 안에 준비되지 않았습니다." >&2; exit 1
|
||||
EOF
|
||||
}
|
||||
|
||||
# 결과는 PC로 내려받았으므로 끌 때 서버의 입력·결과 파일을 지운다 (컨테이너가 root로 써서 같은 이미지로 지운다).
|
||||
down() {
|
||||
remote "docker stop -t 30 $NAME >/dev/null 2>&1 && echo stopped || echo 'not running'; \
|
||||
[ -d $ROOT/comfy ] && docker run --rm -v $ROOT/comfy:/c --entrypoint sh $IMAGE -c 'rm -rf /c/input/* /c/output/* /c/temp/*' || true"
|
||||
}
|
||||
|
||||
status() {
|
||||
remote "docker ps -a --filter name=^/$NAME\$ --format '{{.Names}} {{.Status}}'; \
|
||||
nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader -i $GPU; du -sh $ROOT 2>/dev/null || true"
|
||||
}
|
||||
|
||||
remove() {
|
||||
# 컨테이너가 root로 쓴 파일이 있어 같은 이미지로 지운다.
|
||||
remote "docker rm -f $NAME nalssigak-music >/dev/null 2>&1 || true; \
|
||||
if [ -d $ROOT ]; then docker run --rm -v $ROOT:/target --entrypoint sh $IMAGE -c 'rm -rf /target/* /target/.[!.]*' && rmdir $ROOT; fi; \
|
||||
echo removed"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
up) up ;;
|
||||
down) down ;;
|
||||
status) status ;;
|
||||
remove) remove ;;
|
||||
*) echo "usage: $0 up|down|status|remove" >&2; exit 2 ;;
|
||||
esac
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# usage: sheet.sh <영상> <출력.png> <초> [초 ...] — 그 시각 프레임을 가로로 붙인 확인용 시트
|
||||
set -euo pipefail
|
||||
video=$1; out=$2; shift 2
|
||||
tmp=$(mktemp -d); inputs=(); n=0
|
||||
for t in "$@"; do ffmpeg -hide_banner -loglevel error -y -ss "$t" -i "$video" -frames:v 1 -vf scale=270:480 "$tmp/$n.png"; inputs+=(-i "$tmp/$n.png"); n=$((n+1)); done
|
||||
ffmpeg -hide_banner -loglevel error -y "${inputs[@]}" -filter_complex "hstack=inputs=$n" "$out"
|
||||
rm -rf "$tmp"; echo "saved $out"
|
||||
@@ -0,0 +1,140 @@
|
||||
"""YouTube Shorts 업로드. 표준 라이브러리만 쓴다 (OAuth 데스크톱 앱 + resumable upload).
|
||||
|
||||
usage:
|
||||
python3 youtube.py auth # 채널 계정으로 한 번 로그인해 refresh token을 저장
|
||||
python3 youtube.py upload video.mp4 meta.json # meta: {title, description, tags[], privacy}
|
||||
비밀 파일은 저장소 밖 ~/.config/nalssigak/ 에 둔다 (client_secret.json, youtube_token.json).
|
||||
감사를 통과해 공개로 올릴 수 있게 되면 ~/.config/nalssigak/youtube_public 파일을 만든다(스킬이 privacy 를 public 으로 쓴다).
|
||||
"""
|
||||
import base64
|
||||
import hashlib
|
||||
import http.server
|
||||
import json
|
||||
import os
|
||||
import secrets
|
||||
import socket
|
||||
import sys
|
||||
import threading
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import webbrowser
|
||||
from pathlib import Path
|
||||
|
||||
CONFIG = Path(os.environ.get("NALSSIGAK_CONFIG", Path.home() / ".config" / "nalssigak"))
|
||||
CLIENT = CONFIG / "client_secret.json"
|
||||
TOKEN = CONFIG / "youtube_token.json"
|
||||
SCOPE = "https://www.googleapis.com/auth/youtube.upload"
|
||||
TOKEN_URL = "https://oauth2.googleapis.com/token"
|
||||
|
||||
|
||||
def client():
|
||||
data = json.loads(CLIENT.read_text(encoding="utf-8"))
|
||||
return data.get("installed") or data["web"]
|
||||
|
||||
|
||||
def post_form(url, fields):
|
||||
body = urllib.parse.urlencode(fields).encode()
|
||||
request = urllib.request.Request(url, data=body, headers={"Content-Type": "application/x-www-form-urlencoded"})
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=30) as response:
|
||||
return json.loads(response.read())
|
||||
except urllib.error.HTTPError as error:
|
||||
sys.exit(f"토큰 요청 실패 {error.code}: {error.read()[:300].decode(errors='replace')}")
|
||||
|
||||
|
||||
def auth():
|
||||
c = client()
|
||||
verifier = secrets.token_urlsafe(64)
|
||||
challenge = base64.urlsafe_b64encode(hashlib.sha256(verifier.encode()).digest()).rstrip(b"=").decode()
|
||||
state = secrets.token_urlsafe(16)
|
||||
with socket.socket() as sock:
|
||||
sock.bind(("127.0.0.1", 0))
|
||||
port = sock.getsockname()[1]
|
||||
redirect = f"http://127.0.0.1:{port}"
|
||||
result = {}
|
||||
|
||||
class Handler(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
query = urllib.parse.parse_qs(urllib.parse.urlparse(self.path).query)
|
||||
if query.get("state", [""])[0] == state:
|
||||
result.update({k: v[0] for k, v in query.items()})
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/html; charset=utf-8")
|
||||
self.end_headers()
|
||||
self.wfile.write("로그인 완료. 이 창은 닫아도 돼요.".encode())
|
||||
|
||||
def log_message(self, *_):
|
||||
pass
|
||||
|
||||
server = http.server.HTTPServer(("127.0.0.1", port), Handler)
|
||||
url = c["auth_uri"] + "?" + urllib.parse.urlencode({
|
||||
"client_id": c["client_id"], "redirect_uri": redirect, "response_type": "code", "scope": SCOPE,
|
||||
"access_type": "offline", "prompt": "consent", "state": state,
|
||||
"code_challenge": challenge, "code_challenge_method": "S256"})
|
||||
print("브라우저에서 채널 계정으로 로그인하세요:\n" + url, flush=True)
|
||||
webbrowser.open(url)
|
||||
thread = threading.Thread(target=server.handle_request)
|
||||
thread.start()
|
||||
thread.join(timeout=600)
|
||||
server.server_close()
|
||||
if "code" not in result:
|
||||
sys.exit(f"로그인이 끝나지 않았어요: {result.get('error', '시간 초과')}")
|
||||
token = post_form(c["token_uri"], {"client_id": c["client_id"], "client_secret": c["client_secret"], "code": result["code"],
|
||||
"code_verifier": verifier, "grant_type": "authorization_code", "redirect_uri": redirect})
|
||||
if "refresh_token" not in token:
|
||||
sys.exit("refresh token을 받지 못했어요. 다시 auth를 실행하세요.")
|
||||
CONFIG.mkdir(parents=True, exist_ok=True)
|
||||
TOKEN.write_text(json.dumps({"refresh_token": token["refresh_token"], "scope": token.get("scope")}), encoding="utf-8")
|
||||
TOKEN.chmod(0o600)
|
||||
print("저장했어요:", TOKEN)
|
||||
|
||||
|
||||
def access_token():
|
||||
if not TOKEN.is_file():
|
||||
sys.exit("먼저 python3 youtube.py auth 로 로그인하세요.")
|
||||
c = client()
|
||||
refresh = json.loads(TOKEN.read_text(encoding="utf-8"))["refresh_token"]
|
||||
return post_form(TOKEN_URL, {"client_id": c["client_id"], "client_secret": c["client_secret"],
|
||||
"refresh_token": refresh, "grant_type": "refresh_token"})["access_token"]
|
||||
|
||||
|
||||
def upload(video_path, meta_path):
|
||||
meta = json.loads(Path(meta_path).read_text(encoding="utf-8"))
|
||||
video = Path(video_path).read_bytes()
|
||||
body = {
|
||||
"snippet": {"title": meta["title"], "description": meta["description"], "tags": meta.get("tags", []),
|
||||
"categoryId": meta.get("category", "26"), "defaultLanguage": "ko", "defaultAudioLanguage": "ko"},
|
||||
"status": {"privacyStatus": meta.get("privacy", "private"), "selfDeclaredMadeForKids": False,
|
||||
"containsSyntheticMedia": True},
|
||||
}
|
||||
token = access_token()
|
||||
start = urllib.request.Request(
|
||||
"https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet,status",
|
||||
data=json.dumps(body).encode(), method="POST",
|
||||
headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json; charset=UTF-8",
|
||||
"X-Upload-Content-Type": "video/mp4", "X-Upload-Content-Length": str(len(video))})
|
||||
try:
|
||||
with urllib.request.urlopen(start, timeout=60) as response:
|
||||
location = response.headers["Location"]
|
||||
put = urllib.request.Request(location, data=video, method="PUT",
|
||||
headers={"Authorization": f"Bearer {token}", "Content-Type": "video/mp4"})
|
||||
with urllib.request.urlopen(put, timeout=600) as response:
|
||||
result = json.loads(response.read())
|
||||
except urllib.error.HTTPError as error:
|
||||
sys.exit(f"업로드 실패 {error.code}: {error.read()[:600].decode(errors='replace')}")
|
||||
asked, got = body["status"]["privacyStatus"], result["status"]["privacyStatus"]
|
||||
print(json.dumps({"id": result["id"], "privacy": got, "url": f"https://youtube.com/shorts/{result['id']}",
|
||||
"studio": f"https://studio.youtube.com/video/{result['id']}/edit"}, ensure_ascii=False))
|
||||
if asked != got:
|
||||
# 감사 전 API 프로젝트는 공개 요청도 비공개로 바뀐다
|
||||
print(f"경고: {asked} 로 요청했지만 {got} 로 올라갔어요. API 감사가 필요해요.", file=sys.stderr)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) >= 2 and sys.argv[1] == "auth":
|
||||
auth()
|
||||
elif len(sys.argv) == 4 and sys.argv[1] == "upload":
|
||||
upload(sys.argv[2], sys.argv[3])
|
||||
else:
|
||||
sys.exit(__doc__)
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"about": "클립 동작 후보. scripts/actions.py 가 사람마다 겹치지 않게 무작위로 고른다. 손가락 모양(하트·V·OK·엄지)은 영상 모델이 다른 손 모양으로 그려서 넣지 않는다. needs 는 그 옷·가방이 있어야 쓸 수 있는 동작",
|
||||
"woman": [
|
||||
{ "text": "She smiles brightly and gives a cute little wave to the camera with her free hand at shoulder height, then lowers her hand back to her starting pose." },
|
||||
{ "text": "She smiles and slowly tucks a strand of hair behind her ear with her free hand without looking away from the camera, then lowers her hand back to her starting pose." },
|
||||
{ "text": "She smiles and lightly brushes her hair back from her face with her free hand, keeping her whole face visible, then lowers her hand back to her starting pose." },
|
||||
{ "text": "She smiles and with her free hand gently draws the front of her open outer layer a little closed at chest height without looking down, then lets go and lowers her hand back to her starting pose.", "needs": ["outer"] },
|
||||
{ "text": "She smiles and lifts her free hand to lightly touch the collar of her outer layer near her neck, then lowers her hand back to her starting pose.", "needs": ["outer"] },
|
||||
{ "text": "She smiles and with her free hand lightly adjusts the strap of her bag on her shoulder without looking at it, then lowers her hand back to her starting pose.", "needs": ["bag"] },
|
||||
{ "text": "She smiles and shifts her weight gently onto one leg with a small relaxed shoulder shrug, then settles back into her starting pose." }
|
||||
],
|
||||
"man": [
|
||||
{ "text": "He smiles and gives a friendly small wave to the camera with his free hand at shoulder height, then lowers his hand back to his starting pose." },
|
||||
{ "text": "He gives a slight confident smile and with his free hand at waist level lightly tugs the bottom front edge of his outer layer once to straighten it without looking at it, then lowers his hand back to his starting pose.", "needs": ["outer"] },
|
||||
{ "text": "He gives a slight confident smile and with his free hand straightens the collar of his outer layer near his neck without looking down, then lowers his hand back to his starting pose.", "needs": ["outer"] },
|
||||
{ "text": "He gives a slight confident smile and slowly runs his free hand through the side of his hair, keeping his whole face visible, then lowers his hand back to his starting pose." },
|
||||
{ "text": "He gives a slight confident smile and with his free hand slowly adjusts the cuff of his other sleeve at waist height without looking at it, then lowers his hand back to his starting pose." },
|
||||
{ "text": "He gives a slight confident smile and with his free hand lightly adjusts the strap of his bag on his shoulder without looking at it, then lowers his hand back to his starting pose.", "needs": ["bag"] },
|
||||
{ "text": "He gives a relaxed half-smile and slides his free hand into his trouser pocket in one easy motion, keeping it there until the end." }
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 37 KiB |
@@ -0,0 +1,15 @@
|
||||
<!doctype html><html lang="ko"><head><meta charset="utf-8">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css">
|
||||
<style>
|
||||
/* 제목(title.html) 바로 아래 한 줄 자막. 창 오른쪽(948px) 안에서 끝나야 한다 */
|
||||
* { margin: 0; box-sizing: border-box; }
|
||||
html, body { width: 1080px; height: 1920px; background: transparent; overflow: hidden; }
|
||||
.t { position: absolute; left: 176px; top: 1397px; max-width: 748px; padding: 14px 24px; border-radius: 22px; background: rgb(255 255 255 / .92);
|
||||
color: #28304a; font: 600 32px/1.3 'Pretendard Variable', Pretendard, sans-serif; letter-spacing: -.5px; white-space: nowrap; }
|
||||
.t em { font-style: normal; color: #d4552a; }
|
||||
</style></head><body>
|
||||
<div class="t" id="t"></div>
|
||||
<script>
|
||||
const q = new URLSearchParams(location.search);
|
||||
document.getElementById('t').innerHTML = q.get('t').replace(/\*([^*]+)\*/g, '<em>$1</em>').split('|').join(' ');
|
||||
</script></body></html>
|
||||
@@ -0,0 +1,10 @@
|
||||
<!doctype html>
|
||||
<html lang="ko"><head><meta charset="utf-8">
|
||||
<style>
|
||||
/* 흐린 영상 배경 위에 얹는 투명 레이어(영상 창 그림자). 창은 프로필 그리드 3:4(위 240 ~ 아래 1680)를 채우고, 위치는 compose.sh 와 같아야 한다 */
|
||||
* { margin: 0; box-sizing: border-box; }
|
||||
html, body { width: 1080px; height: 1920px; overflow: hidden; }
|
||||
body { position: relative; background: transparent; }
|
||||
.win { position: absolute; left: 132px; top: 240px; width: 816px; height: 1440px; border-radius: 40px; background: #dfeaf6; box-shadow: 0 24px 60px rgb(20 30 60 / .35); }
|
||||
</style></head>
|
||||
<body><div class="win"></div></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
A static tripod shot of {a_person} with {look} standing in {pronoun} pose in {scene}. {Pronoun} wears {outfit}. {action} A steady breeze clearly blows {pronoun} hair and makes {pronoun} clothes move lightly. {Pronoun} head stays upright facing the camera and {pronoun} eyes stay open with the same smile. The camera is completely still on a tripod at the same full-body framing, and {pronoun} face, outfit and proportions stay identical to the first frame.
|
||||
@@ -0,0 +1 @@
|
||||
falling leaves, dancing, walking, turning, big movement, camera movement, dolly in, zoom in, close-up, closed eyes, head tilt, long neck, stretched neck, different face, changing face, changing outfit, distorted anatomy, extra limbs, extra fingers, morphing, flicker, blurry, watermark, text, subtitles
|
||||
@@ -0,0 +1,15 @@
|
||||
<!doctype html>
|
||||
<html lang="ko"><head><meta charset="utf-8">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Jua&display=swap">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css">
|
||||
<style>
|
||||
* { margin: 0; box-sizing: border-box; }
|
||||
html, body { width: 1080px; height: 1920px; overflow: hidden; }
|
||||
body { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 44px; color: #1f2d3d;
|
||||
font-family: 'Pretendard Variable', Pretendard, sans-serif;
|
||||
background: radial-gradient(circle at 10% 4%, #dcebff 0, transparent 34%), radial-gradient(circle at 92% 97%, #d6e7fd 0, transparent 36%), #f4f9ff; }
|
||||
img { width: 340px; height: 340px; border-radius: 80px; box-shadow: 0 22px 48px rgba(43, 108, 184, .25); }
|
||||
.name { font: 120px/1 Jua, sans-serif; letter-spacing: -2px; }
|
||||
.url { padding: 18px 44px 16px; border-radius: 999px; background: #4f97e3; color: #fff; font: 700 54px/1 'Pretendard Variable', Pretendard, sans-serif; box-shadow: 0 6px 0 #2b6cb8; }
|
||||
</style></head>
|
||||
<body><img src="app_icon.png" alt=""><div class="name">날씨각</div><div class="url">weather.o2o.kr</div></body></html>
|
||||
@@ -0,0 +1,5 @@
|
||||
Make a photo of the {person} from the first reference image wearing today's outfit in {scene}.
|
||||
Outfit: {outfit}
|
||||
{hair_line}
|
||||
{body_line}
|
||||
Rules: keep the person's face, hairstyle and body exactly like the FIRST reference image (same person). Copy the outfit items, colors, materials and silhouettes from the other reference images (outfit snap and product photos), but do NOT copy the face of the person in the outfit snap and do NOT copy any text, logo, watermark or "AI" badge. Photorealistic vertical 9:16 full-body fashion photo, the person stands facing the camera in a relaxed natural pose, whole body from head to shoes in frame with some space above the head, both hands visible and natural, eyes open, gentle expression. No text, no logo, no watermark anywhere.
|
||||
@@ -0,0 +1,23 @@
|
||||
<!doctype html>
|
||||
<html lang="ko"><head><meta charset="utf-8">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Jua&display=swap">
|
||||
<style>
|
||||
/* 영상 위에 얹는 투명 레이어. 창(132,240 · 816×1440) 왼쪽 아래, 신발이 보이도록 발 위(다리 높이)에 칩·제목을 두고, 그 아래 1397px 줄은 자막(bubble.html) 자리 */
|
||||
:root { --main: #4f97e3; --deep: #2b6cb8; --ink: #28304a; }
|
||||
* { margin: 0; box-sizing: border-box; }
|
||||
html, body { width: 1080px; height: 1920px; overflow: hidden; background: transparent; }
|
||||
.win { position: absolute; left: 132px; top: 240px; width: 816px; height: 1440px; border-radius: 40px; overflow: hidden; }
|
||||
.shade { position: absolute; left: 0; right: 0; bottom: 0; height: 700px; background: linear-gradient(transparent, rgb(40 48 74 / .45) 55%, rgb(40 48 74 / .2)); }
|
||||
.title { position: absolute; left: 176px; bottom: 543px; }
|
||||
.chip { display: inline-block; padding: 9px 22px 7px; border-radius: 999px; background: var(--main); color: #fff; font: 30px/1.1 Jua, sans-serif; box-shadow: 0 4px 0 var(--deep); }
|
||||
.headline { margin-top: 16px; font: 66px/1.12 Jua, sans-serif; color: #fff; letter-spacing: -1px; text-shadow: 0 3px 16px rgb(40 48 74 / .35); }
|
||||
</style></head>
|
||||
<body>
|
||||
<div class="win"><div class="shade"></div></div>
|
||||
<div class="title"><div class="chip">날씨각</div><div class="headline" id="h"></div></div>
|
||||
<script>
|
||||
const q = new URLSearchParams(location.search);
|
||||
const age = q.get('age'); // 40~ 이면 '40대~'
|
||||
document.getElementById('h').innerHTML = `이번주 ${age.replace(/~$/, '')}대${age.endsWith('~') ? '~' : ''}<br>${q.get('who')} ${q.get('label') || '코디'}`;
|
||||
</script>
|
||||
</body></html>
|
||||
@@ -9,7 +9,7 @@ import { execFileSync } from 'node:child_process'
|
||||
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { resolve } from 'node:path'
|
||||
|
||||
const SLIDES = { tarot: 5, ootd: 4, intro: 8 }
|
||||
const SLIDES = { tarot: 5, ootd: 4, intro: 8, foliage: 5 }
|
||||
// 기본 문구가 서비스 데이터 그대로라 Claude 기획이 꼭 필요한 템플릿 (src/cards/templates.tsx autoPlan)
|
||||
const AUTO_PLAN = ['tarot']
|
||||
// src/cards/themes.ts THEMES 의 id
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// 그날 코디: 오늘 예보 → 무신사 인기 스냅에서 사람별 코디 선정 → Claude 가 옷 목록 추출 → Codex 가 참고 사진대로 플랫레이 그림 → 카드용 copy.
|
||||
// 사용: node scripts/daily-ootd.mjs [--out out/<날짜>] (npm run card -- ootd --daily 가 부른다)
|
||||
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
import { join, resolve } from 'node:path'
|
||||
import { drawWithCodex } from './codex-image.mjs'
|
||||
import { extractOutfit } from './outfit.mjs'
|
||||
@@ -22,8 +22,11 @@ export async function weatherToday() {
|
||||
const day = withTemp.filter((s) => hour(s) >= 6 && hour(s) <= 21)
|
||||
const t = day.length ? day : withTemp
|
||||
const maxC = Math.round(Math.max(...t.map((s) => s.temp_c)))
|
||||
const morningC = Math.round((t.find((s) => hour(s) === 6) ?? t[0]).temp_c)
|
||||
const band = spec.bands.find((b) => maxC >= b.from) ?? spec.bands[spec.bands.length - 1]
|
||||
const morning = t.find((s) => hour(s) === 6) ?? t[0]
|
||||
const morningC = Math.round(morning.temp_c)
|
||||
// 낮 최고만 보면 아침·저녁 추위를 놓친다: 아침 체감과 낮 최고의 평균으로 구간을 정한다
|
||||
const feelC = ((morning.feels_c ?? morning.temp_c) + maxC) / 2
|
||||
const band = spec.bands.find((b) => feelC >= b.from) ?? spec.bands[spec.bands.length - 1]
|
||||
return { day: d.day, morningC, maxC, band: band.id, layering: band.layering ?? '' }
|
||||
}
|
||||
|
||||
@@ -38,7 +41,7 @@ function layoutFor(slots) {
|
||||
return `top row: ${topRow}; bottom row: ${bottomRow}. Clearly separate spots, nothing else in between.`
|
||||
}
|
||||
|
||||
function buildPrompt(persona, outfit, weather) {
|
||||
export function buildPrompt(persona, outfit, weather) {
|
||||
const by = Object.fromEntries(outfit.items.map((it) => [it.slot, it]))
|
||||
const drawn = DRAW_ORDER.filter((s) => by[s])
|
||||
const items = drawn.map((s, i) => `(${i + 1}) ${by[s].prompt}${s === 'outer' ? ' as the outer layer' : ''}`).join(', ')
|
||||
@@ -60,7 +63,9 @@ export async function runDailyOotd({ outDir, style = 'minimal', log = console.lo
|
||||
const weather = await weatherToday()
|
||||
log(`오늘 ${weather.day}: 아침 ${weather.morningC}° · 낮 ${weather.maxC}° → 구간 ${weather.band} · 스타일 ${styleLabel}`)
|
||||
mkdirSync(outDir, { recursive: true })
|
||||
const picks = await pickSnaps({ band: weather.band, style, outDir: join(outDir, 'snaps'), log })
|
||||
// 사용자가 먼저 확인한 코디(snap.mjs 가 쓴 picks.json)가 있으면 다시 고르지 않고 그대로 그린다
|
||||
const picksFile = join(outDir, 'snaps', 'picks.json')
|
||||
const picks = existsSync(picksFile) ? JSON.parse(readFileSync(picksFile, 'utf8')) : await pickSnaps({ band: weather.band, style, outDir: join(outDir, 'snaps'), log })
|
||||
const dailyDir = resolve('public/daily')
|
||||
mkdirSync(dailyDir, { recursive: true })
|
||||
const outfits = []
|
||||
|
||||
@@ -21,7 +21,8 @@ const spec = JSON.parse(readFileSync(promptFile, 'utf8'))
|
||||
// 각 카드는 그림 목록을 따로 적지 않고 서비스의 각 목록에서 만든다
|
||||
if (spec.deck === 'gak') {
|
||||
const defs = JSON.parse(readFileSync(resolve('../backend/seed/index_definition.json'), 'utf8'))
|
||||
spec.items = defs.map((g) => ({ id: g.code, motif: spec.scene.replaceAll('{name}', g.name).replaceAll('{meaning}', g.description), name: g.name, meaning: g.description }))
|
||||
const money = JSON.parse(readFileSync(resolve('money-deck.json'), 'utf8')).cards
|
||||
spec.items = [...defs, ...money].map((g) => ({ id: g.code, motif: (g.scene ?? spec.scene).replaceAll('{name}', g.name).replaceAll('{meaning}', g.description), name: g.name, meaning: g.description }))
|
||||
}
|
||||
const outDir = resolve(`src/assets/${kind}`)
|
||||
mkdirSync(outDir, { recursive: true })
|
||||
|
||||
@@ -43,9 +43,10 @@ function buildPrompt(pick, persona, weather) {
|
||||
goods,
|
||||
'',
|
||||
'규칙:',
|
||||
'- 자리(slot)는 top·bottom·shoes 는 반드시, 사진에서 겉옷(outer)을 입거나 걸쳤으면 outer 도, 가방이 있으면 bag 도 넣는다. 최대 5개, 자리마다 하나.',
|
||||
'- 태그된 상품에 있는 옷만 넣는다. 사진에 보여도 상품 목록에 없는 옷·가방은 넣지 않는다.',
|
||||
'- 자리(slot)는 top·bottom·shoes 는 반드시, 상품 목록에 겉옷이 있으면 outer 도, 가방이 있으면 bag 도 넣는다. 최대 5개, 자리마다 하나.',
|
||||
'- 원피스면 top 으로 넣고 bottom 은 생략하지 말고 같은 원피스를 bottom 에 다시 넣지 않는다 → 원피스는 top, bottom 자리에는 사진의 다른 하의가 없으면 shoes·bag 으로 4개를 채운다.',
|
||||
'- 상품 목록에 있는 옷은 그 상품명 기준으로, 없는 옷은 사진에서 보이는 대로. 색은 사진 기준.',
|
||||
'- 옷 이름은 상품명 기준, 색은 사진 기준.',
|
||||
'- label 은 카드 이름표라 짧고 쉬운 한글(브랜드·영어 금지). prompt 는 영어 한 구절, 색은 대문자.',
|
||||
'- style 은 코디 분위기 한 단어.',
|
||||
'JSON 으로만 답한다.',
|
||||
|
||||
@@ -20,6 +20,10 @@ const questionOf = (topic) => {
|
||||
}
|
||||
// 날씨 타로 카드 = 날씨각 각 카드 (서비스와 같은 각 목록)
|
||||
const DECK = JSON.parse(readFileSync(resolve(import.meta.dirname, '../../backend/seed/index_definition.json'), 'utf8')).map((g) => ({ id: g.code, name: g.name, icon: g.icon, meaning: g.description }))
|
||||
// 경제 전용 카드: topics.json 에서 deck 이 money 인 대주제는 이 카드에서만 고른다
|
||||
const MONEY_DECK = JSON.parse(readFileSync(resolve(import.meta.dirname, '../money-deck.json'), 'utf8')).cards.map((g) => ({ id: g.code, name: g.name, icon: g.icon, meaning: g.description, when: g.when }))
|
||||
const ALL_CARDS = [...DECK, ...MONEY_DECK]
|
||||
const deckOf = (topic) => (categoryOf(topic ?? '')?.deck === 'money' ? MONEY_DECK : DECK)
|
||||
// 최근에 쓴 각은 빼서 매일 같은 카드가 나오지 않게 한다 (card.mjs 가 기획할 때마다 적는다)
|
||||
const HISTORY_FILE = resolve(import.meta.dirname, '../out/tarot-history.json')
|
||||
const HISTORY_DAYS = 7
|
||||
@@ -43,7 +47,7 @@ const RULES = [
|
||||
'카드에 들어가야 하니 칸마다 지금 문구와 비슷한 길이(최대 1.3배)로 쓴다(날씨 타로 리딩은 아래 길이 규칙을 따른다). 줄바꿈은 " ⏎ "로 표시하고, 개수를 지금 문구와 맞춘다.',
|
||||
'강조할 말은 *별표*로 감싼다. 지금 문구에 별표가 있으면 같은 자리에 둔다.',
|
||||
`아이콘 칸(i1·i2·i3)은 다음 중 하나의 파일 이름만 쓴다: ${ICONS.join(', ')}`,
|
||||
'쓰지 않는 것: 투자 권유(종목, 매수·매도, 수익·손실 단정), 건강·의료 단정, 사고·재난·정치, 특정 집단 비하, 욕설.',
|
||||
'쓰지 않는 것: 투자 권유(종목 추천, 수익·손실 단정), 건강·의료 단정, 사고·재난·정치, 특정 집단 비하, 욕설.',
|
||||
'"재미로"라는 말이 지금 문구에 있으면 남긴다.',
|
||||
'주제가 있으면 제목·카드 이름·문장을 모두 그 주제의 말로 바꾼다. 오늘 날씨 사실은 주제에 빗대는 근거로만 쓴다.',
|
||||
'날씨각의 각 요약 문장("오전 10시 14°, 바람 조금")을 그대로 옮기지 않는다. 날씨 사실은 쉬운 말로 다시 쓴다.',
|
||||
@@ -66,18 +70,21 @@ const TAROT_TONE = [
|
||||
'하지 않는 것: "~이면 ~해요/~하면 ~돼요" 공식, 모든 문장이 같은 어미("~해요"만 세 번), "~할 수 있어요/~일 수 있어요" 두 번 이상, "~것이 중요합니다", "도움이 되길", 명사 나열형 조언, 설명조("이 카드는 ~을 뜻해요"는 세 장 통틀어 한 번만), 이모지, 느낌표 두 개 이상, 리딩 본문에 기온·시각 숫자(숫자는 행운 포인트에만), 뻔한 덕담("기대해도 좋은 하루").',
|
||||
'좋은 예: "오늘 그 사람, 님 생각보다 가까이 와 있어요. 겉으론 평소랑 똑같이 굴어도 말 걸 타이밍만 재는 중이거든요. 해 지고 선선해질 때 \'잠깐 걸을래?\' 한마디면 돼요."',
|
||||
'나쁜 예(쓰지 말 것): "커피 한 잔이면 말문이 열려요. 아침 인사부터 먼저 건네요." / "걷다 보면 거리가 가까워져요. 저녁 산책을 먼저 제안해요."',
|
||||
'키워드(k)는 4~8자 명사구("같이 걷는 시간", "먼저 보내는 한 줄"). 행운 포인트(l)는 시간·날씨·행동 한 줄 22자 이내("저녁 8시, 17도로 걷기 딱 좋아요").',
|
||||
'키워드(k)는 4~8자 명사구("같이 걷는 시간", "먼저 보내는 한 줄"). 행운 포인트(l)는 "시각 · 행운 아이템" 한 줄 18자 이내("밤 9시 · 무릎 덮을 담요"). 시각은 예보 시각 그대로, 아이템은 리딩에서 권한 행동에 쓰거나 그 장면에 있는, 그 시각 날씨에 맞는 물건 하나(단풍 사진을 보내라는 리딩이면 "빨간 단풍잎 한 장"). 기온 숫자·날씨 설명은 쓰지 않는다.',
|
||||
]
|
||||
|
||||
/** 오늘 고를 수 있는 각: 최근 7일에 쓴 각은 뺀다 (관리자가 고정한 카드는 남긴다) */
|
||||
function availableDeck(fixed = {}) {
|
||||
/** 오늘 고를 수 있는 각: 최근 7일에 쓴 각은 뺀다 (관리자가 고정한 카드는 남긴다). 경제 카드는 10장뿐이라 날씨로만 고른다 */
|
||||
function availableDeck(fixed = {}, topic = '') {
|
||||
const deck = deckOf(topic)
|
||||
if (deck === MONEY_DECK) return deck
|
||||
const recent = new Set(recentCodes())
|
||||
const keep = new Set(fixed.cards ?? [])
|
||||
return DECK.filter((c) => !recent.has(c.id) || keep.has(c.id))
|
||||
return deck.filter((c) => !recent.has(c.id) || keep.has(c.id))
|
||||
}
|
||||
|
||||
function tarotSection(topic, fixed = {}) {
|
||||
const deck = availableDeck(fixed)
|
||||
const deck = availableDeck(fixed, topic)
|
||||
if (deck === MONEY_DECK) return moneySection(topic)
|
||||
const excluded = DECK.filter((c) => !deck.includes(c)).map((c) => c.name)
|
||||
return [
|
||||
'',
|
||||
@@ -91,6 +98,20 @@ function tarotSection(topic, fixed = {}) {
|
||||
]
|
||||
}
|
||||
|
||||
function moneySection(topic) {
|
||||
return [
|
||||
'',
|
||||
'## 경제 카드 (이 목록에서만 고른다. card1·card2·card3에 서로 다른 code)',
|
||||
`표지 질문(question)은 이것을 쓴다(피드백이 바꾸라고 하면 바꾼다): ${questionOf(topic)}`,
|
||||
'표지 배지(title)는 "주식 타로", 표지 큰 질문(headline) 첫 줄은 질문의 쉼표 앞부분을 그대로 쓴다(예: "오늘 내 주식, ⏎ 어떤 마음으로 볼까요?"). 계좌·지갑처럼 돌려 말하지 않는다.',
|
||||
'각 카드의 "어울리는 날씨"가 오늘 날씨 데이터와 맞는 카드만 고른다. 맞는 카드가 많으면 더 잘 맞는 것, 아침·낮·저녁으로 이어지는 것을 고른다. 날씨와 안 맞는 카드는 고르지 않는다.',
|
||||
'리딩은 카드 이름(불장·존버·분할매수·익절·손절·관망·물타기·배당·적금·텅장)의 뜻을 주식·돈 관리 이야기로 직접 풀고, 오늘 날씨를 그 근거로 든다. 산책·꽃구경 같은 날씨 활동 이야기로 새지 않는다. 종목 추천·수익 단정은 하지 않는다.',
|
||||
...TAROT_TONE,
|
||||
'',
|
||||
...MONEY_DECK.map((c) => `- ${c.id}: ${c.name} — ${c.meaning} / 어울리는 날씨: ${c.when}`),
|
||||
]
|
||||
}
|
||||
|
||||
function buildPrompt(ctx, { topic, feedback, fixed = {} }) {
|
||||
// 줄바꿈은 ⏎ 로 보여 주고 받을 때 되돌린다 (JSON 안의 \\n 을 글자로 따라 쓰는 일을 막는다)
|
||||
const fields = ctx.fields.map((f) => `- ${f.key} (${f.label}): ${String(ctx.current[f.key] ?? '').replaceAll('\n', ' ⏎ ')}`).join('\n')
|
||||
@@ -116,16 +137,16 @@ function buildPrompt(ctx, { topic, feedback, fixed = {} }) {
|
||||
].join('\n')
|
||||
}
|
||||
|
||||
function schema(ctx, fixed = {}) {
|
||||
function schema(ctx, fixed = {}, topic = '') {
|
||||
const properties = { topic: { type: 'string' } }
|
||||
for (const f of ctx.fields) if (!(isTarot(ctx) && DECK_KEY.test(f.key))) properties[f.key] = { type: 'string' }
|
||||
if (isTarot(ctx)) for (const k of ['card1', 'card2', 'card3']) properties[k] = { type: 'string', enum: availableDeck(fixed).map((c) => c.id) }
|
||||
if (isTarot(ctx)) for (const k of ['card1', 'card2', 'card3']) properties[k] = { type: 'string', enum: availableDeck(fixed, topic).map((c) => c.id) }
|
||||
return { type: 'object', properties, required: Object.keys(properties), additionalProperties: false }
|
||||
}
|
||||
|
||||
/** @returns {Promise<{ topic: string, copy: Record<string, string> }>} */
|
||||
export function runPlan(ctx, { topic = '', feedback = '', fixed = {} } = {}) {
|
||||
const args = ['-p', buildPrompt(ctx, { topic, feedback, fixed }), '--output-format', 'json', '--json-schema', JSON.stringify(schema(ctx, fixed)), '--tools', '', '--no-session-persistence', '--model', 'sonnet']
|
||||
const args = ['-p', buildPrompt(ctx, { topic, feedback, fixed }), '--output-format', 'json', '--json-schema', JSON.stringify(schema(ctx, fixed, topic)), '--tools', '', '--no-session-persistence', '--model', 'sonnet']
|
||||
return new Promise((done, fail) => {
|
||||
execFile('claude', args, { cwd: tmpdir(), timeout: 180_000, maxBuffer: 10 * 1024 * 1024 }, (err, stdout) => {
|
||||
if (err) return fail(new Error(`Claude CLI 실행 실패: ${err.message}. 터미널에서 claude 로그인 상태를 확인하세요.`))
|
||||
@@ -142,7 +163,7 @@ export function runPlan(ctx, { topic = '', feedback = '', fixed = {} } = {}) {
|
||||
if (fixed.question) result.question = fixed.question
|
||||
fixed.cards?.forEach((code, i) => (result[`card${i + 1}`] = code))
|
||||
;['card1', 'card2', 'card3'].forEach((k, i) => {
|
||||
const card = DECK.find((c) => c.id === result[k])
|
||||
const card = ALL_CARDS.find((c) => c.id === result[k])
|
||||
if (card) Object.assign(result, { [`c${i + 1}`]: card.id, [`n${i + 1}`]: card.name, [`i${i + 1}`]: card.icon })
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,15 +36,17 @@ export const PERSONAS = {
|
||||
const HEAVY = /패딩|푸퍼|다운|롱코트|울코트|무스탕|플리스|기모|헤비|퍼 /i
|
||||
const MID = /코트|자켓|재킷|점퍼|블루종|집업/i
|
||||
const SHORTS = /쇼츠|반바지|shorts|숏팬츠|버뮤다/i
|
||||
const OPEN_SHOES = /뮬|슬링백|샌들|슬리퍼|mule|slingback|sandal/i
|
||||
const MINI = /미니 ?(스커트|드레스|원피스)|mini (skirt|dress)/i
|
||||
const SHORT_SLEEVE = /반팔|하프 슬리브|half sleeve|슬리브리스|민소매|sleeveless/i
|
||||
const BAND = {
|
||||
hot: { tags: ['여름코디', '간절기코디'], rejectGoods: [HEAVY, MID], rejectTags: [/겨울|패딩|코트/] },
|
||||
warm: { tags: ['간절기코디', '가을코디'], rejectGoods: [HEAVY, MID], rejectTags: [/겨울|패딩|코트/] },
|
||||
mild: { tags: ['가을코디', '간절기코디'], rejectGoods: [HEAVY, SHORTS], rejectTags: [/겨울|패딩/] },
|
||||
cool: { tags: ['가을코디', '가을아우터'], rejectGoods: [HEAVY, SHORTS, SHORT_SLEEVE], rejectTags: [/겨울/] },
|
||||
chilly: { tags: ['가을코디', '겨울코디'], rejectGoods: [/롱패딩|헤비/, SHORTS, SHORT_SLEEVE], rejectTags: [] },
|
||||
cold: { tags: ['겨울코디'], rejectGoods: [SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔/] },
|
||||
freezing: { tags: ['겨울코디', '롱패딩'], rejectGoods: [SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔|가을/] },
|
||||
cool: { needOuter: true, tags: ['가을코디', '가을아우터'], rejectGoods: [HEAVY, SHORTS, SHORT_SLEEVE], rejectTags: [/겨울/] },
|
||||
chilly: { needOuter: true, tags: ['가을코디', '겨울코디'], rejectGoods: [MINI, OPEN_SHOES, /롱패딩|헤비/, SHORTS, SHORT_SLEEVE], rejectTags: [] },
|
||||
cold: { needOuter: true, tags: ['겨울코디'], rejectGoods: [MINI, OPEN_SHOES, SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔/] },
|
||||
freezing: { needOuter: true, tags: ['겨울코디', '롱패딩'], rejectGoods: [MINI, OPEN_SHOES, SHORTS, SHORT_SLEEVE], rejectTags: [/여름|반팔|가을/] },
|
||||
}
|
||||
// 철 지난 스냅은 뺀다
|
||||
const MAX_AGE_DAYS = 45
|
||||
@@ -141,6 +143,7 @@ function fits(snap, band) {
|
||||
const slots = new Set(snap.goods.map((g) => g.slot))
|
||||
const hasTop = slots.has('top') || slots.has('onepiece')
|
||||
const hasBottom = slots.has('bottom') || slots.has('onepiece')
|
||||
if (rule.needOuter && !slots.has('outer')) return false
|
||||
return hasTop && hasBottom && slots.has('shoes') && !!snap.image
|
||||
}
|
||||
|
||||
@@ -154,6 +157,12 @@ function score(snap, persona) {
|
||||
if (goods.some((g) => /슬랙스|로퍼|니트|블라우스|코트|자켓|재킷|셔츠/.test(g.name + g.category2))) s += 0.5
|
||||
if (goods.some((g) => /카고|후드|조거|스웨트/.test(g.name + g.category2))) s -= 1
|
||||
} else if (MATURE_TAG.test(tagBlob) && !/꾸안꾸|데일리/.test(tagBlob)) s -= 0.3
|
||||
// 여자 코디는 남성적인 고프코어보다 여성스러운 쪽을 고른다
|
||||
if (PERSONAS[persona].gender === 'WOMEN') {
|
||||
if (/페미닌|러블리|걸리시|여리여리|하객룩|오피스룩/.test(tagBlob)) s += 1
|
||||
if (goods.some((g) => /블라우스|가디건|스커트|원피스|로퍼|플랫|메리제인|니트/.test(g.name + g.category2))) s += 0.7
|
||||
if (goods.some((g) => /카고|백팩|트레일|고프코어|바람막이/.test(g.name + g.category2)) || /고프코어/.test(tagBlob)) s -= 1.5
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -170,7 +179,7 @@ export async function pickSnaps({ band, style, outDir, pages = 2, log = console.
|
||||
const styleTags = STYLE_TAGS[style] ?? []
|
||||
const pool = new Map()
|
||||
const add = (list) => list.forEach((s) => s.goodsNos.length >= 3 && !pool.has(s.id) && pool.set(s.id, s))
|
||||
for (const tag of styleTags) add(await listSnaps({ tags: tag }, pages))
|
||||
for (const tag of styleTags) add(await listSnaps({ tags: tag }, pages * 3))
|
||||
for (const tag of rule.tags) add(await listSnaps({ tags: tag }, pages))
|
||||
for (const gender of ['WOMEN', 'MEN']) for (const kw of MATURE_KEYWORDS[gender]) add(await listSnaps({ keyword: kw }, 1))
|
||||
const hasStyle = (s) => styleTags.length === 0 || s.tags.some((t) => styleTags.some((st) => t.includes(st)))
|
||||
@@ -186,7 +195,7 @@ export async function pickSnaps({ band, style, outDir, pages = 2, log = console.
|
||||
const candidates = [...pool.values()]
|
||||
.filter((s) => s.gender === gender && !used.has(s.id))
|
||||
.sort((a, b) => Number(hasStyle(b)) - Number(hasStyle(a)) || score(b, persona) - score(a, persona))
|
||||
.slice(0, 25)
|
||||
.slice(0, 60)
|
||||
let best = null
|
||||
for (const c of candidates) {
|
||||
const full = c.goods ? c : await withGoods(c)
|
||||
|
||||
|
After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 132 KiB |
|
After Width: | Height: | Size: 299 KiB |
|
After Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 469 KiB |
|
After Width: | Height: | Size: 318 KiB |
|
After Width: | Height: | Size: 363 KiB |
|
After Width: | Height: | Size: 263 KiB |
|
After Width: | Height: | Size: 305 KiB |
|
After Width: | Height: | Size: 302 KiB |
@@ -0,0 +1,125 @@
|
||||
{
|
||||
"source": "한국관광공사 관광사진(공공누리 제1유형, 출처표시)",
|
||||
"spots": [
|
||||
{
|
||||
"file": "yongmunsa",
|
||||
"name": "용문사 은행나무",
|
||||
"region": "경기 양평",
|
||||
"kind": "ginkgo",
|
||||
"peak": "2026-10-29",
|
||||
"photo": {
|
||||
"title": "양평 용문사",
|
||||
"by": "한국관광공사 김지호",
|
||||
"shot": "2012.10"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "namiseom",
|
||||
"name": "남이섬",
|
||||
"region": "강원 춘천",
|
||||
"kind": "ginkgo",
|
||||
"peak": "2026-10-27",
|
||||
"photo": {
|
||||
"title": "남이섬",
|
||||
"by": "김효서",
|
||||
"shot": "2023.11"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "myeongnyundang",
|
||||
"name": "성균관 명륜당",
|
||||
"region": "서울 종로",
|
||||
"kind": "ginkgo",
|
||||
"peak": "2026-10-31",
|
||||
"photo": {
|
||||
"title": "성균관",
|
||||
"by": "한국관광공사 박성근",
|
||||
"shot": "2011.10"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "gyeongbokgung",
|
||||
"name": "경복궁",
|
||||
"region": "서울 종로",
|
||||
"kind": "maple",
|
||||
"peak": "2026-11-02",
|
||||
"photo": {
|
||||
"title": "경복궁",
|
||||
"by": "라이브스튜디오",
|
||||
"shot": "2020.11"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "namsan",
|
||||
"name": "남산공원",
|
||||
"region": "서울 중구",
|
||||
"kind": "maple",
|
||||
"peak": "2026-11-02",
|
||||
"photo": {
|
||||
"title": "남산성곽길",
|
||||
"by": "한국관광공사 이범수",
|
||||
"shot": "2011.11"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "childrenpark",
|
||||
"name": "어린이대공원",
|
||||
"region": "서울 광진",
|
||||
"kind": "maple",
|
||||
"peak": "2026-11-02",
|
||||
"photo": {
|
||||
"title": "서울 어린이대공원",
|
||||
"by": "최민희",
|
||||
"shot": "2023.11"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "changdeokgung",
|
||||
"name": "창덕궁",
|
||||
"region": "서울 종로",
|
||||
"kind": "maple",
|
||||
"peak": "2026-11-02",
|
||||
"photo": {
|
||||
"title": "창덕궁",
|
||||
"by": "최린",
|
||||
"shot": "2023.11"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "deoksugung",
|
||||
"name": "덕수궁 돌담길",
|
||||
"region": "서울 중구",
|
||||
"kind": "ginkgo",
|
||||
"peak": "2026-11-04",
|
||||
"photo": {
|
||||
"title": "덕수궁",
|
||||
"by": "한국관광공사 이범수",
|
||||
"shot": "2019.11"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "seoulforest",
|
||||
"name": "서울숲",
|
||||
"region": "서울 성동",
|
||||
"kind": "ginkgo",
|
||||
"peak": "2026-11-04",
|
||||
"photo": {
|
||||
"title": "서울숲",
|
||||
"by": "임태원",
|
||||
"shot": "2023.11"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "mulhyanggi",
|
||||
"name": "물향기수목원",
|
||||
"region": "경기 오산",
|
||||
"kind": "ginkgo",
|
||||
"peak": "2026-11-06",
|
||||
"photo": {
|
||||
"title": "물향기수목원",
|
||||
"by": "박아름",
|
||||
"shot": "2025.10"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
After Width: | Height: | Size: 438 KiB |
|
After Width: | Height: | Size: 430 KiB |
|
After Width: | Height: | Size: 313 KiB |
|
After Width: | Height: | Size: 247 KiB |
|
After Width: | Height: | Size: 173 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 219 KiB |
|
After Width: | Height: | Size: 220 KiB |
|
After Width: | Height: | Size: 199 KiB |
|
After Width: | Height: | Size: 188 KiB |
|
After Width: | Height: | Size: 239 KiB |
|
After Width: | Height: | Size: 231 KiB |
|
After Width: | Height: | Size: 203 KiB |
@@ -222,6 +222,33 @@
|
||||
color: var(--rust);
|
||||
text-shadow: 0 6px 0 var(--soft);
|
||||
}
|
||||
/* 날씨 타로 표지: 주제 배지 + 큰 질문 두 줄 */
|
||||
.slide .cover-chip {
|
||||
position: absolute;
|
||||
top: 160px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
padding: 8px 30px 12px;
|
||||
border-radius: 99px;
|
||||
background: var(--rust);
|
||||
color: #fff;
|
||||
font: 54px/1.07 Jua, sans-serif;
|
||||
letter-spacing: -2px;
|
||||
white-space: nowrap;
|
||||
z-index: 3;
|
||||
}
|
||||
.cover-headline {
|
||||
position: absolute;
|
||||
top: 262px;
|
||||
left: 100px;
|
||||
width: 880px;
|
||||
text-align: center;
|
||||
font: 86px/1.12 Jua, sans-serif;
|
||||
letter-spacing: -4px;
|
||||
text-shadow: 0 5px 0 var(--soft);
|
||||
white-space: nowrap;
|
||||
z-index: 3;
|
||||
}
|
||||
/* 타로 질문: 이 질문에 카드가 답한다 */
|
||||
.slide .cover-question {
|
||||
position: absolute;
|
||||
@@ -334,7 +361,7 @@
|
||||
.slide .deco.d3 { left: 58px; top: 905px; width: 26px; height: 26px; background: var(--blue); }
|
||||
.slide .deco.d4 { right: 64px; top: 880px; width: 32px; height: 32px; }
|
||||
.slide .deco.d5 { left: 330px; top: 1160px; width: 24px; height: 24px; background: var(--blue); }
|
||||
.slide .deco.d6 { right: 330px; top: 1175px; width: 28px; height: 28px; }
|
||||
.slide .deco.d6 { right: 330px; top: 1148px; width: 28px; height: 28px; }
|
||||
|
||||
.slide[data-skin='heart'] :is(.sparkle, .deco) {
|
||||
clip-path: none;
|
||||
@@ -668,3 +695,51 @@
|
||||
.intro-cta .intro-sub { top: 470px; font-size: 48px; color: var(--rust); }
|
||||
.intro-cta .intro-note { left: 240px; right: 240px; text-align: center; }
|
||||
.intro-cta .intro-note { top: 1250px; font-size: 36px; text-align: center; }
|
||||
|
||||
/* 서울 근교 단풍 TOP 10 */
|
||||
.slide.foliage { background: #fff8eb; color: #322d32; }
|
||||
.foliage .foliage-meta { position: absolute; top: 174px; left: 80px; color: #94694e; font-size: 32px; font-weight: 700; }
|
||||
.foliage .foliage-title,
|
||||
.foliage .foliage-list-title,
|
||||
.foliage .foliage-cta-title { position: absolute; left: 80px; right: 80px; font-family: Jua, sans-serif; letter-spacing: -2px; }
|
||||
.foliage .foliage-title { top: 222px; max-width: 920px; color: #b43e29; font-size: 96px; line-height: 1.04; }
|
||||
.foliage .foliage-subtitle { position: absolute; top: 330px; left: 84px; right: 80px; color: #69584d; font-size: 38px; font-weight: 700; letter-spacing: -1px; }
|
||||
.foliage-cover-panel,
|
||||
.foliage-cta-panel { position: absolute; background: linear-gradient(140deg, #fbd0a0, #f5a96d 54%, #dd7657); border-radius: 64px; }
|
||||
.foliage-cover-panel { left: 80px; right: 80px; top: 410px; bottom: 70px; }
|
||||
.foliage .foliage-phone { position: absolute; overflow: hidden; box-sizing: content-box; width: 338px; aspect-ratio: 47 / 100; border: 15px solid #242327; border-radius: 53px; background: #fff; box-shadow: 0 28px 52px #59331c61, inset 0 0 0 2px #555; z-index: 2; }
|
||||
.foliage .foliage-phone img { display: block; width: 100%; height: 100%; object-fit: contain; }
|
||||
.foliage-cover .foliage-phone { top: 436px; left: 340px; width: 370px; transform: rotate(-4deg); }
|
||||
.foliage .foliage-leaf { position: absolute; width: 110px; height: 110px; object-fit: contain; z-index: 1; filter: drop-shadow(0 12px 10px #963c2929); }
|
||||
.foliage .foliage-leaf-a { top: 585px; left: 145px; transform: rotate(-21deg); }
|
||||
.foliage .foliage-leaf-b { top: 725px; right: 150px; transform: rotate(18deg); }
|
||||
.foliage .foliage-leaf-c { bottom: 132px; left: 165px; transform: rotate(15deg); }
|
||||
.foliage .foliage-list-title { top: 229px; font-size: 80px; line-height: 1.05; }
|
||||
.foliage .foliage-list-title em { font-style: normal; color: #c6462b; }
|
||||
.foliage .foliage-board { position: absolute; left: 80px; right: 80px; top: 350px; bottom: 160px; display: grid; gap: 22px; }
|
||||
.foliage-duo .foliage-board { grid-template-rows: repeat(2, minmax(0, 1fr)); }
|
||||
.foliage-grid .foliage-board { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
|
||||
.foliage .foliage-tile { position: relative; overflow: hidden; min-width: 0; border-radius: 38px; background: #aa7254; box-shadow: 0 12px 28px #5c382b26; }
|
||||
.foliage .foliage-tile::after { content: ''; position: absolute; inset: 20% 0 0; background: linear-gradient(transparent 18%, #1c1719c4 76%, #120f11e8); }
|
||||
.foliage .foliage-photo { display: block; width: 100%; height: 100%; object-fit: cover; }
|
||||
.foliage .foliage-rank { position: absolute; top: 22px; left: 23px; z-index: 2; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: #fff9ec; color: #b43e29; font: 64px/1 Jua, sans-serif; box-shadow: 0 5px 15px #0003; }
|
||||
.foliage .foliage-tile-copy { position: absolute; left: 28px; right: 20px; bottom: 24px; z-index: 2; color: #fff; }
|
||||
.foliage .foliage-name { display: block; overflow: hidden; color: #fff; font: 72px/1.08 Jua, sans-serif; letter-spacing: -1.7px; white-space: nowrap; text-overflow: clip; }
|
||||
.foliage-grid .foliage-name { font-size: 49px; letter-spacing: -2px; }
|
||||
.foliage .foliage-facts { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: #fff; font-size: 29px; font-weight: 750; white-space: nowrap; }
|
||||
.foliage-grid .foliage-facts { gap: 7px; font-size: 22px; letter-spacing: -1px; }
|
||||
.foliage .foliage-facts > span:not(:first-child)::before { content: '·'; margin-right: 12px; opacity: .8; }
|
||||
.foliage-grid .foliage-facts > span:not(:first-child)::before { margin-right: 7px; }
|
||||
.foliage .foliage-kind { display: inline-flex; align-items: center; gap: 3px; }
|
||||
.foliage .foliage-kind img { width: 30px; height: 30px; object-fit: contain; }
|
||||
.foliage-grid .foliage-kind img { width: 23px; height: 23px; }
|
||||
.foliage .foliage-line { margin-top: 6px; color: #fff8ed; font-size: 30px; font-weight: 650; white-space: nowrap; }
|
||||
.foliage .foliage-credit { position: absolute; left: 80px; right: 80px; bottom: 70px; color: #795e4d; font-size: 23px; font-weight: 600; line-height: 1.3; }
|
||||
.foliage .foliage-cta-title { top: 220px; color: #b43e29; font-size: 82px; line-height: 1.1; }
|
||||
.foliage .foliage-cta-body { position: absolute; left: 84px; right: 80px; top: 330px; color: #69584d; font-size: 36px; font-weight: 700; }
|
||||
.foliage-cta-panel { left: 80px; right: 80px; top: 410px; bottom: 105px; }
|
||||
.foliage-cta .foliage-phone { top: 440px; left: 124px; width: 330px; transform: rotate(-4deg); }
|
||||
.foliage .foliage-actions { position: absolute; top: 790px; left: 460px; right: 112px; z-index: 3; display: flex; flex-direction: column; gap: 20px; }
|
||||
.foliage .foliage-actions span { display: block; padding: 24px 18px; border-radius: 25px; background: #fffaf0; color: #a8402d; font-size: 31px; font-weight: 800; text-align: center; box-shadow: 0 8px 18px #703c252b; white-space: nowrap; }
|
||||
.foliage .foliage-actions span + span { background: #a8402d; color: #fff; }
|
||||
.foliage .foliage-source { position: absolute; left: 80px; right: 80px; bottom: 51px; color: #795e4d; font-size: 21px; font-weight: 600; }
|
||||
@@ -1,8 +1,9 @@
|
||||
import defs from '../../../backend/seed/index_definition.json'
|
||||
import money from '../../money-deck.json'
|
||||
|
||||
/** 날씨 타로 카드 덱 = 날씨각 각 카드 (서비스와 같은 목록) */
|
||||
/** 날씨 타로 카드 덱 = 날씨각 각 카드 (서비스와 같은 목록) + 경제 전용 카드(money-deck.json) */
|
||||
export type GakCard = { code: string; name: string; icon: string; meaning: string }
|
||||
export const GAK_DECK: GakCard[] = defs.map((g) => ({ code: g.code, name: g.name, icon: g.icon, meaning: g.description }))
|
||||
export const GAK_DECK: GakCard[] = [...defs, ...money.cards].map((g) => ({ code: g.code, name: g.name, icon: g.icon, meaning: g.description }))
|
||||
export const gakByCode = (code?: string) => GAK_DECK.find((g) => g.code === code)
|
||||
|
||||
// 각 카드 앞면 그림 (Codex, npm run gen-image -- gak-card <code>). 없으면 각 아이콘
|
||||
|
||||
@@ -10,14 +10,47 @@ import { Frame, Lines } from './Frame'
|
||||
import { tidy } from './text'
|
||||
import { DEFAULT_STYLE, dailyOutfits, needsOuter, ootdBand, ootdOutfits, styleLabel } from './ootd'
|
||||
import { gakArt, gakByCode } from './gaks'
|
||||
import foliageData from '../assets/foliage/seoul-2026-10-29.json'
|
||||
|
||||
// 대주제(skin)마다 한 번 만든 배경 그림 (npm run gen-image -- tarot-bg <skin>). 없으면 민무늬 배경
|
||||
const TAROT_BG = import.meta.glob<string>('../assets/tarot-bg/*.webp', { eager: true, import: 'default' })
|
||||
// 인스타 해시태그: 고정 태그 앞에 그 포스트의 주제·카드·스타일 태그를 붙인다
|
||||
const SKIN_TAGS: Record<string, string[]> = {
|
||||
coin: ['#주식', '#주식타로', '#재테크', '#투자', '#경제', '#돈관리'],
|
||||
heart: ['#연애', '#연애타로', '#썸', '#데이트'],
|
||||
clover: ['#건강', '#건강타로', '#운동', '#다이어트'],
|
||||
star: ['#공부', '#직장인', '#취업', '#일타로'],
|
||||
sparkle: ['#관계', '#친구', '#가족', '#관계타로'],
|
||||
}
|
||||
const STYLE_TAGS: Record<string, string[]> = {
|
||||
minimal: ['#꾸안꾸', '#꾸안꾸룩', '#꾸안꾸코디'],
|
||||
casual: ['#캐주얼룩', '#캐주얼코디', '#데일리코디'],
|
||||
semi: ['#오피스룩', '#출근룩', '#세미정장'],
|
||||
formal: ['#정장코디', '#포멀룩', '#하객룩'],
|
||||
street: ['#스트릿룩', '#스트릿패션', '#스트릿코디'],
|
||||
}
|
||||
const seasonTag = () => {
|
||||
const m = new Date(Date.now() + 9 * 3600_000).getUTCMonth() + 1
|
||||
return m >= 3 && m <= 5 ? '#봄코디' : m <= 8 && m >= 6 ? '#여름코디' : m >= 9 && m <= 11 ? '#가을코디' : '#겨울코디'
|
||||
}
|
||||
const tags = (...lists: (string | undefined)[][]) => [...new Set(lists.flat().filter((t): t is string => !!t))].join(' ')
|
||||
|
||||
const tarotBg = (skin?: string) => (skin ? TAROT_BG[`../assets/tarot-bg/${skin}.webp`] : undefined)
|
||||
export const hasTarotBg = (skin?: string) => !!tarotBg(skin)
|
||||
import { iconUrl } from './icons'
|
||||
import { toneVars } from './themes'
|
||||
|
||||
const FOLIAGE_IMAGES = import.meta.glob<string>('../assets/foliage/*.webp', { eager: true, import: 'default' })
|
||||
const foliageImage = (file: string) => FOLIAGE_IMAGES[`../assets/foliage/${file}.webp`]
|
||||
// 카드에 날짜 숫자는 쓰지 않는다: 오늘이 든 주(월~일) 안이면 '이번 주 절정', 그 뒤면 '다음 주 절정'
|
||||
const foliagePeak = (date: string) => {
|
||||
const today = new Date()
|
||||
const sunday = new Date(today.getFullYear(), today.getMonth(), today.getDate() + ((7 - today.getDay()) % 7))
|
||||
return new Date(`${date}T00:00:00`) <= sunday ? '이번 주 절정' : '다음 주 절정'
|
||||
}
|
||||
const foliageCredit = (spots: typeof foliageData.spots, firstRank: number) =>
|
||||
`사진: 한국관광공사 · ${spots.map((spot, i) => `${firstRank + i}위 ${spot.photo.by.replace(/^한국관광공사\s*/, '')}`).join(' · ')}`
|
||||
|
||||
|
||||
export type Copy = Record<string, string>
|
||||
export type Field = { key: string; label: string }
|
||||
@@ -62,7 +95,7 @@ const ootd: Template = {
|
||||
post: (d, c) => ({
|
||||
title: `오늘의 코디 · ${styleLabel(c.style)}`,
|
||||
caption: `낮 최고 ${d.maxC}도, 20대부터 40대~까지 오늘 입을 옷을 넘겨 보세요`,
|
||||
hashtags: '#날씨각 #오늘의코디 #OOTD #데일리룩 #옷차림 #코디추천 #날씨 #오늘날씨 #서울날씨 #일상',
|
||||
hashtags: tags(STYLE_TAGS[c.style ?? DEFAULT_STYLE] ?? [], [seasonTag(), '#여자코디', '#남자코디', '#20대코디', '#40대코디'], ['#날씨각', '#오늘의코디', '#OOTD', '#데일리룩', '#코디추천', '#오늘날씨']),
|
||||
}),
|
||||
warnings: (d, c) => {
|
||||
if (dailyOutfits(c)) return []
|
||||
@@ -111,9 +144,9 @@ const ootd: Template = {
|
||||
const tarot: Template = {
|
||||
id: 'tarot',
|
||||
post: (_d, c) => ({
|
||||
title: c.title.replaceAll('\n', ' ').replaceAll('*', ''),
|
||||
title: `오늘의 ${c.title.replaceAll('\n', ' ').replaceAll('*', '')}`,
|
||||
caption: `Q. ${c.question} 1·2·3 중 한 장을 골라 보세요`,
|
||||
hashtags: '#날씨각 #날씨타로 #타로 #오늘의타로 #오늘의운세 #날씨 #오늘날씨 #서울날씨 #오늘뭐하지 #일상',
|
||||
hashtags: tags(SKIN_TAGS[c.skin ?? ''] ?? [], [c.n1, c.n2, c.n3].map((n) => (n ? `#${n.replace(/각$/, '').replace(/\s/g, '')}` : undefined)), ['#날씨각', '#날씨타로', '#타로', '#오늘의타로', '#오늘의운세', '#오늘날씨']),
|
||||
}),
|
||||
name: '날씨 타로',
|
||||
autoPlan: true,
|
||||
@@ -121,17 +154,19 @@ const tarot: Template = {
|
||||
how: [
|
||||
'카드는 날씨각의 각 카드다(산책각·빨래각·치맥각… 53장). 타로 덱(컵·펜타클 등)은 쓰지 않는다.',
|
||||
'표지 질문(question)에 1·2·3번 각 카드로 답한다. 소주제마다 질문이 정해져 있다(topics.json questions).',
|
||||
'표지 배지(title)는 "주식 타로"·"썸 타로"처럼 "<소주제> 타로" 한 줄. 표지 큰 질문(headline)은 질문(question)을 뜻은 그대로 두 줄로 줄인 것, 줄마다 공백 포함 11자 이내(예: "오늘 내 주식, ⏎ 어떤 마음으로 볼까요?").',
|
||||
'카드는 오늘 서울(중구) 예보로 점수가 높은 각, 즉 오늘 실제로 하기 좋은 각 가운데 질문과 엮을 수 있는 것을 고른다. 세 장은 서로 다른 각.',
|
||||
'리딩(r)은 진짜 타로 리더 말투로 3문장(70~95자): 그 사람의 겉과 속 → 한 번 꺾기(다만) → 오늘 할 행동 하나(각 카드의 활동). 질문자는 "님", 상대는 "그 사람". 규칙과 좋은·나쁜 예는 scripts/plan.mjs TAROT_TONE.',
|
||||
'행운 포인트(l)는 한 줄: 그 각이 좋은 오늘의 시간·기온·날씨 사실.',
|
||||
'행운 포인트(l)는 한 줄 "<시각> · <행운 아이템>": 시각은 그 각이 좋은 오늘 예보 시각 그대로, 아이템은 리딩에서 권한 행동에 쓰거나 그 장면에 있는, 그 시각 날씨에 맞는 손에 잡히는 물건 하나(예: 단풍 사진을 보내라는 리딩이면 "낮 12시 · 빨간 단풍잎 한 장"). 기온 숫자·날씨 설명은 쓰지 않는다.',
|
||||
'카드 그림은 Codex가 그린 각 카드 그림(그날 뽑힌 카드만 그리고 다시 씀, 없으면 각 아이콘), 카드 이름은 각 이름 그대로.',
|
||||
'질문·카드·리딩은 각각 관리자가 직접 정하거나 Claude에게 맡길 수 있다. 카드를 직접 고르면 Claude는 그 카드로 리딩만 한다.',
|
||||
'지켜야 할 것: 투자 권유(종목·매수·매도·수익)·건강 단정·사고·재난·정치는 쓰지 않는다. 마지막 장에 "재미로"를 남긴다.',
|
||||
'관리자가 주제를 고르고 만들기를 눌러야 만들어진다(화면을 열 때 자동으로 만들지 않는다). 색은 만들 때마다 6가지 테마 중 무작위, 고를 수도 있다.',
|
||||
],
|
||||
fields: [
|
||||
{ key: 'title', label: '표지 제목' },
|
||||
{ key: 'title', label: '표지 배지 (○○ 타로)' },
|
||||
{ key: 'question', label: '질문 (카드가 답할 질문)' },
|
||||
{ key: 'headline', label: '표지 큰 질문 (두 줄)' },
|
||||
{ key: 'prompt', label: '표지 안내' },
|
||||
...[1, 2, 3].flatMap((n) => [
|
||||
{ key: `n${n}`, label: `${n}번 각 카드` },
|
||||
@@ -146,7 +181,7 @@ const tarot: Template = {
|
||||
// 카드 3장은 Claude가 기획해야 채워진다 (autoPlan). 기획 전에는 비워 두고 화면이 가린다
|
||||
// 예시: 연애·썸 (각 카드 그림은 Codex로 미리 그림)
|
||||
example: {
|
||||
title: '오늘의\n썸 타로', question: '지금 썸 타는 그 사람과 오늘 한 발 가까워질까요?', topic: '연애 썸', skin: 'heart', theme: 'berry',
|
||||
title: '썸 타로', question: '지금 썸 타는 그 사람과 오늘 한 발 가까워질까요?', headline: '썸 타는 그 사람과\n한 발 가까워질까요?', topic: '연애 썸', skin: 'heart', theme: 'berry',
|
||||
c1: 'iced_hot', n1: '뜨아각', i1: 'iced_hot', k1: '커피 사진 한 장',
|
||||
r1: '아침부터 그 사람 생각났죠. 상대도 비슷해요. 다만 마음이 식어서가 아니라 하루 시작이 바빠서 조용한 거예요. 오늘은 커피 사진 한 장만 보내세요. 그 이상은 저녁에.', l1: '아침 8시, 따뜻한 커피가 당기는 날씨',
|
||||
c2: 'walk', n2: '산책각', i2: 'walk', k2: '잠깐 걸을래?',
|
||||
@@ -156,8 +191,9 @@ const tarot: Template = {
|
||||
},
|
||||
// 만들기 전 빈 카드. 관리자가 주제를 고르고 만들면 Claude가 채운다
|
||||
defaults: () => ({
|
||||
title: '오늘의\n날씨 타로',
|
||||
title: '날씨 타로',
|
||||
question: '오늘 나에게 좋은 일이 생길까요?',
|
||||
headline: '오늘 나에게\n좋은 일이 생길까요?',
|
||||
prompt: '1·2·3 중 한 장을 골라 보세요',
|
||||
...Object.fromEntries([1, 2, 3].flatMap((n) => [[`c${n}`, ''], [`n${n}`, ''], [`i${n}`, 'sun'], [`k${n}`, ''], [`r${n}`, ''], [`l${n}`, '']])),
|
||||
ask: '몇 번 골랐어요?\n*댓글로 알려 주세요*',
|
||||
@@ -180,13 +216,10 @@ const tarot: Template = {
|
||||
<i className="sparkle a" />
|
||||
<i className="sparkle b" />
|
||||
<i className="sparkle c" />
|
||||
<h1 className="cover-title">
|
||||
<Lines text={c.title} />
|
||||
<p className="cover-chip">{c.title.replaceAll('\n', ' ')}</p>
|
||||
<h1 className="cover-headline">
|
||||
<Lines text={c.headline || c.question} />
|
||||
</h1>
|
||||
<p className="cover-question">
|
||||
<b>Q.</b>
|
||||
{c.question}
|
||||
</p>
|
||||
<div className="cover-stage" aria-hidden="true" />
|
||||
{backs('big')}
|
||||
<img className="rabbit" src="/icons/rabbit.png" alt="" />
|
||||
@@ -245,6 +278,116 @@ const tarot: Template = {
|
||||
|
||||
const INTRO_GAK_CODES = ['walk', 'camping', 'fishing', 'chimaek', 'jjamppong', 'carwash', 'laundry', 'vent', 'stars', 'hiking', 'date', 'golf']
|
||||
|
||||
const foliage: Template = {
|
||||
id: 'foliage',
|
||||
name: '서울 근교 단풍 TOP 10',
|
||||
about: '2026.10.29 기준 서울 근교 단풍 명소 10곳 · 사진 순위 5장',
|
||||
how: [
|
||||
'src/assets/foliage/seoul-2026-10-29.json의 순서가 1~10위다. 이름·지역·단풍 종류·절정 날짜와 사진 촬영자도 그 파일에서 가져온다.',
|
||||
'1장은 앱 단풍 지도, 2~4장은 명소 사진 10장(1~2위는 크게, 3~10위는 4곳씩), 5장은 앱 명소 화면을 쓴다. 날씨 예보나 Claude 기획은 쓰지 않는다.',
|
||||
'절정 날짜는 산림청 2026 단풍절정 예측 기준이다. 명소 사진은 한국관광공사 관광사진 공공누리 제1유형이므로 2~4장 아래에 촬영자와 함께 출처를 적는다.',
|
||||
'모든 문구는 관리자 화면에서 직접 고칠 수 있다. 앱 안내는 토스 검색과 weather.o2o.kr을 함께 보여 준다.',
|
||||
],
|
||||
fields: [
|
||||
{ key: 'date', label: '1장 날짜 줄' },
|
||||
{ key: 'title', label: '1장 제목' },
|
||||
{ key: 'subtitle', label: '1장 부제' },
|
||||
{ key: 'heading2', label: '2장 제목' },
|
||||
{ key: 'heading3', label: '3장 제목' },
|
||||
{ key: 'heading4', label: '4장 제목' },
|
||||
...foliageData.spots.flatMap((_, i) => {
|
||||
const n = i + 1
|
||||
return [
|
||||
{ key: `name${n}`, label: `${n}위 이름` },
|
||||
{ key: `region${n}`, label: `${n}위 지역` },
|
||||
{ key: `kind${n}`, label: `${n}위 단풍/은행` },
|
||||
{ key: `peak${n}`, label: `${n}위 절정 시기` },
|
||||
]
|
||||
}),
|
||||
{ key: 'line1', label: '1위 한 줄' },
|
||||
{ key: 'line2', label: '2위 한 줄' },
|
||||
{ key: 'credit2', label: '2장 사진 출처' },
|
||||
{ key: 'credit3', label: '3장 사진 출처' },
|
||||
{ key: 'credit4', label: '4장 사진 출처' },
|
||||
{ key: 'ctaTitle', label: '5장 제목' },
|
||||
{ key: 'ctaBody', label: '5장 본문' },
|
||||
{ key: 'button1', label: '5장 버튼 1' },
|
||||
{ key: 'button2', label: '5장 버튼 2' },
|
||||
{ key: 'source', label: '5장 출처' },
|
||||
],
|
||||
defaults: () => ({
|
||||
date: '이번 주 단풍',
|
||||
title: '서울 근교 단풍 TOP 10',
|
||||
subtitle: '멀리 안 가도 돼요, 이번 주말 가볍게',
|
||||
heading2: '1~2위', heading3: '3~6위', heading4: '7~10위',
|
||||
...Object.fromEntries(foliageData.spots.flatMap((spot, i) => {
|
||||
const n = i + 1
|
||||
return [[`name${n}`, spot.name], [`region${n}`, spot.region], [`kind${n}`, spot.kind === 'ginkgo' ? '은행' : '단풍'], [`peak${n}`, foliagePeak(spot.peak)]]
|
||||
})),
|
||||
line1: '절 마당을 덮는 천연기념물 은행나무',
|
||||
line2: '노란 잎이 깔린 메타세쿼이아·은행나무길',
|
||||
credit2: foliageCredit(foliageData.spots.slice(0, 2), 1),
|
||||
credit3: foliageCredit(foliageData.spots.slice(2, 6), 3),
|
||||
credit4: foliageCredit(foliageData.spots.slice(6, 10), 7),
|
||||
ctaTitle: '우리 동네 단풍은 지금 어디쯤?',
|
||||
ctaBody: '전국 단풍 명소 68곳, 절정 날짜를 지도로 한눈에',
|
||||
button1: "토스에서 '날씨각' 검색",
|
||||
button2: 'weather.o2o.kr',
|
||||
source: '절정 날짜: 산림청 2026 단풍절정 예측 · 사진: 한국관광공사',
|
||||
}),
|
||||
post: (_d, c) => ({
|
||||
title: c.title,
|
||||
caption: `${c.title} 🍁\n멀리 안 가도 돼요. 이번 주말 가볍게 다녀올 곳, 절정 시기 보고 골라요.\n\n전국 68곳 단풍 지도는 토스에서 '날씨각' 검색, 또는 weather.o2o.kr\n\n${c.source}\n${c.credit2}\n${c.credit3}\n${c.credit4}`,
|
||||
hashtags: '#날씨각 #서울단풍 #단풍명소 #서울근교 #가을나들이 #단풍절정 #은행나무 #주말나들이',
|
||||
}),
|
||||
slides: (_d, c) => {
|
||||
const frame = (page: number, className: string, children: ReactNode) =>
|
||||
<Frame page={page} total={5} theme="sunset" className={`foliage foliage-${className}`} key={page}>{children}</Frame>
|
||||
const phone = (file: string) => <div className="foliage-phone"><img src={foliageImage(file)} alt="날씨각 앱 단풍 지도 화면" /></div>
|
||||
const tile = (i: number) => {
|
||||
const spot = foliageData.spots[i]
|
||||
const n = i + 1
|
||||
const kind = c[`kind${n}`]
|
||||
return <div className="foliage-tile" key={spot.file}>
|
||||
<img className="foliage-photo" src={foliageImage(spot.file)} alt={c[`name${n}`]} />
|
||||
<span className="foliage-rank">{n}</span>
|
||||
<div className="foliage-tile-copy">
|
||||
<strong className="foliage-name">{c[`name${n}`]}</strong>
|
||||
<div className="foliage-facts"><span>{c[`region${n}`]}</span><span className="foliage-kind"><img src={iconUrl(kind === '은행' ? 'ginkgo' : 'maple')} alt="" />{kind}</span><span>{c[`peak${n}`]}</span></div>
|
||||
{i < 2 && <p className="foliage-line">{c[`line${n}`]}</p>}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
return [
|
||||
frame(0, 'cover', <>
|
||||
<p className="foliage-meta">{c.date}</p>
|
||||
<h1 className="foliage-title">{c.title}</h1>
|
||||
<p className="foliage-subtitle">{c.subtitle}</p>
|
||||
<div className="foliage-cover-panel" />
|
||||
{phone('app-map')}
|
||||
<img className="foliage-leaf foliage-leaf-a" src={iconUrl('maple')} alt="" />
|
||||
<img className="foliage-leaf foliage-leaf-b" src={iconUrl('ginkgo')} alt="" />
|
||||
<img className="foliage-leaf foliage-leaf-c" src={iconUrl('fallen_leaf')} alt="" />
|
||||
</>),
|
||||
...[[0, 1], [2, 3, 4, 5], [6, 7, 8, 9]].map((indices, j) => frame(j + 1, j === 0 ? 'duo' : 'grid', <>
|
||||
<p className="foliage-meta">{c.date}</p>
|
||||
<h1 className="foliage-list-title">서울 근교 단풍 <em>{c[`heading${j + 2}`]}</em></h1>
|
||||
<div className="foliage-board">{indices.map(tile)}</div>
|
||||
<p className="foliage-credit">{c[`credit${j + 2}`]}</p>
|
||||
</>)),
|
||||
frame(4, 'cta', <>
|
||||
<p className="foliage-meta">{c.date}</p>
|
||||
<h1 className="foliage-cta-title">{c.ctaTitle}</h1>
|
||||
<p className="foliage-cta-body">{c.ctaBody}</p>
|
||||
<div className="foliage-cta-panel" />
|
||||
{phone('app-spot')}
|
||||
<div className="foliage-actions"><span>{c.button1}</span><span>{c.button2}</span></div>
|
||||
<p className="foliage-source">{c.source}</p>
|
||||
</>),
|
||||
]
|
||||
},
|
||||
}
|
||||
|
||||
const intro: Template = {
|
||||
id: 'intro',
|
||||
name: '날씨각 소개',
|
||||
@@ -360,6 +503,6 @@ const intro: Template = {
|
||||
},
|
||||
}
|
||||
|
||||
export const TEMPLATES: Template[] = [tarot, ootd, intro]
|
||||
export const TEMPLATES: Template[] = [tarot, ootd, intro, foliage]
|
||||
|
||||
export const templateById = (id: string) => TEMPLATES.find((t) => t.id === id)
|
||||
@@ -25,6 +25,7 @@
|
||||
"id": "money",
|
||||
"name": "경제",
|
||||
"skin": "coin",
|
||||
"deck": "money",
|
||||
"subtopics": [
|
||||
"주식",
|
||||
"재테크",
|
||||
@@ -33,7 +34,7 @@
|
||||
],
|
||||
"questions": {
|
||||
"": "오늘 내 지갑 사정은 어떨까요?",
|
||||
"주식": "오늘 내 계좌, 어떤 마음으로 바라보면 좋을까요?",
|
||||
"주식": "오늘 내 주식, 어떤 마음으로 바라보면 좋을까요?",
|
||||
"재테크": "오늘 돈 관리, 무엇부터 챙기면 좋을까요?",
|
||||
"취미": "오늘 취미에 돈 써도 괜찮을까요?",
|
||||
"여행": "이번에 떠나는 여행, 잘 풀릴까요?"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import uuid
|
||||
from datetime import date, datetime
|
||||
from datetime import date, datetime, time
|
||||
from decimal import Decimal
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import BigInteger, Boolean, Date, DateTime, ForeignKey, Integer, LargeBinary, Numeric, SmallInteger, String, Text, func
|
||||
from sqlalchemy import BigInteger, Boolean, Date, DateTime, ForeignKey, Integer, LargeBinary, Numeric, SmallInteger, String, Text, Time, func
|
||||
from sqlalchemy.dialects.postgresql import JSONB, UUID
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
||||
|
||||
@@ -246,6 +246,7 @@ class Event(Base):
|
||||
area: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
|
||||
name: Mapped[str] = mapped_column(String(60))
|
||||
place_name: Mapped[str] = mapped_column(String(60))
|
||||
address: Mapped[Optional[str]] = mapped_column(String(120), nullable=True)
|
||||
icon: Mapped[str] = mapped_column(String(30), default="fireworks")
|
||||
start_date: Mapped[date] = mapped_column(Date)
|
||||
end_date: Mapped[date] = mapped_column(Date)
|
||||
@@ -362,6 +363,11 @@ class User(Base):
|
||||
status: Mapped[int] = mapped_column(SmallInteger, default=1)
|
||||
terms_agreed_at: Mapped[Optional[datetime]] = mapped_column(DateTime(timezone=True), nullable=True)
|
||||
token_version: Mapped[int] = mapped_column(SmallInteger, default=1)
|
||||
points: Mapped[int] = mapped_column(Integer, default=0)
|
||||
birth_date: Mapped[Optional[date]] = mapped_column(Date, nullable=True)
|
||||
birth_time: Mapped[Optional[time]] = mapped_column(Time, nullable=True)
|
||||
birth_place: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
|
||||
gender: Mapped[Optional[str]] = mapped_column(String(10), nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
deleted: Mapped[bool] = mapped_column(Boolean, default=False)
|
||||
@@ -399,6 +405,7 @@ class Comment(Base):
|
||||
user_id: Mapped[Optional[uuid.UUID]] = mapped_column(UUID(as_uuid=True), nullable=True)
|
||||
ip_hash: Mapped[Optional[str]] = mapped_column(String(64), nullable=True)
|
||||
region_name: Mapped[Optional[str]] = mapped_column(String(20), nullable=True)
|
||||
bot: Mapped[Optional[str]] = mapped_column(String(10), nullable=True)
|
||||
body: Mapped[str] = mapped_column(String(60))
|
||||
like_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
report_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
@@ -446,10 +453,46 @@ class MyGak(Base):
|
||||
my_gak_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True))
|
||||
name: Mapped[str] = mapped_column(String(12))
|
||||
icon: Mapped[Optional[str]] = mapped_column(String(32), nullable=True)
|
||||
rule: Mapped[dict] = mapped_column(JSONB)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class PointLog(Base):
|
||||
__tablename__ = "point_log"
|
||||
|
||||
point_id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
|
||||
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True))
|
||||
day: Mapped[date] = mapped_column(Date)
|
||||
action: Mapped[str] = mapped_column(String(20))
|
||||
ref: Mapped[str] = mapped_column(String(40), default="")
|
||||
points: Mapped[int] = mapped_column(SmallInteger)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class FortuneDraw(Base):
|
||||
__tablename__ = "fortune_draw"
|
||||
|
||||
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True)
|
||||
day: Mapped[date] = mapped_column(Date, primary_key=True)
|
||||
card_code: Mapped[str] = mapped_column(String(32))
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class DayLog(Base):
|
||||
__tablename__ = "day_log"
|
||||
|
||||
user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True)
|
||||
day: Mapped[date] = mapped_column(Date, primary_key=True)
|
||||
mood: Mapped[int] = mapped_column(SmallInteger)
|
||||
went_out: Mapped[bool] = mapped_column(Boolean)
|
||||
place_name: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
|
||||
place_ref: Mapped[Optional[str]] = mapped_column(String(40), nullable=True)
|
||||
card_hit: Mapped[Optional[bool]] = mapped_column(Boolean, nullable=True)
|
||||
region_code: Mapped[str] = mapped_column(String(10))
|
||||
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
|
||||
class Talk(Base):
|
||||
__tablename__ = "talk"
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class ErrorType(Enum):
|
||||
AUTH_DUPLICATE_ID = 4003
|
||||
AUTH_TOKEN_INVALID = 4004
|
||||
TERMS_REQUIRED = 4005
|
||||
LEVEL_REQUIRED = 4006 # 계정 레벨이 모자라 아직 열리지 않음
|
||||
|
||||
|
||||
class Sky(CodeEnum):
|
||||
|
||||
@@ -51,10 +51,9 @@ class Settings(BaseSettings):
|
||||
azure_blob_base_url: str = ""
|
||||
azure_blob_sas_token: str = ""
|
||||
|
||||
# 오늘 화면 쇼츠 줄. API 키가 있으면 채널의 쇼츠를 받고, 없으면 youtube_shorts(영상 ID, 쉼표로 구분, 최신순)를 보여 준다
|
||||
# 오늘 화면 쇼츠 줄. API 키가 있으면 Data API 로(공개·퍼가기 허용·3분 이하), 없으면 채널 쇼츠 RSS 로 받는다
|
||||
youtube_api_key: str = ""
|
||||
youtube_channel_id: str = "UCWdesmwvHFsnjMUWNcDaA9w"
|
||||
youtube_shorts: str = "kpp6WFEi4Nk,Wdv-e_DdQFY,WmbOEhi91IM"
|
||||
|
||||
# 구글 로그인 OAuth 클라이언트 ID (공개값). 비면 구글 로그인을 받지 않는다
|
||||
google_client_id: str = ""
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from datetime import date
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy import exists, select, update
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.database.model.models import Post
|
||||
from common.database.model.models import Comment, Post
|
||||
|
||||
|
||||
class FeedCRUD:
|
||||
@@ -21,6 +21,22 @@ class FeedCRUD:
|
||||
if rows:
|
||||
await s.execute(insert(Post).values(rows).on_conflict_do_nothing())
|
||||
|
||||
async def without_bot(self, s: AsyncSession, day: date) -> list[Post]:
|
||||
"""그날 포스트 중 캐릭터 댓글이 아직 없는 것."""
|
||||
has_bot = exists().where(Comment.post_id == Post.post_id, Comment.bot.is_not(None))
|
||||
return list((await s.scalars(select(Post).where(Post.feed_date == day, Post.deleted.is_(False), ~has_bot))).all())
|
||||
|
||||
async def add_bot_comments(self, s: AsyncSession, lines: dict[int, list[tuple[str, str]]]) -> None:
|
||||
"""캐릭터 댓글을 넣고 포스트 댓글 수를 늘린다. 같은 포스트·캐릭터는 한 번만 (동시에 불려도 겹치지 않게)."""
|
||||
rows = [{"post_id": post_id, "bot": bot, "body": body} for post_id, x in lines.items() for bot, body in x]
|
||||
if not rows:
|
||||
return
|
||||
added = (await s.execute(insert(Comment).values(rows).on_conflict_do_nothing().returning(Comment.post_id))).scalars().all()
|
||||
for n in (1, 2):
|
||||
ids = [post_id for post_id in set(added) if added.count(post_id) == n]
|
||||
if ids:
|
||||
await s.execute(update(Post).where(Post.post_id.in_(ids)).values(comment_count=Post.comment_count + n))
|
||||
|
||||
async def get(self, s: AsyncSession, post_id: int) -> Optional[Post]:
|
||||
post = await s.get(Post, post_id)
|
||||
return post if post is not None and not post.deleted else None
|
||||
@@ -0,0 +1,52 @@
|
||||
import uuid
|
||||
from datetime import date
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import case, func, select
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.database.model.models import DayLog, Event, FortuneDraw, Place, SunsetSpot
|
||||
|
||||
|
||||
def _near(region_col, sido: str):
|
||||
return case((region_col.startswith(sido), 0), else_=1)
|
||||
|
||||
|
||||
class FortuneCRUD:
|
||||
async def draw_of(self, s: AsyncSession, user_id: uuid.UUID, day: date) -> Optional[FortuneDraw]:
|
||||
return await s.get(FortuneDraw, (user_id, day))
|
||||
|
||||
async def add_draw(self, s: AsyncSession, user_id: uuid.UUID, day: date, card_code: str) -> FortuneDraw:
|
||||
"""그날 이미 뽑았으면 그 카드를 그대로 돌려준다 (폰과 PC 에서 동시에 뽑아도 처음 카드 하나로)"""
|
||||
await s.execute(insert(FortuneDraw).values(user_id=user_id, day=day, card_code=card_code).on_conflict_do_nothing())
|
||||
return await s.scalar(select(FortuneDraw).where(FortuneDraw.user_id == user_id, FortuneDraw.day == day))
|
||||
|
||||
async def draw_days(self, s: AsyncSession, user_id: uuid.UUID, since: date) -> list[date]:
|
||||
return list((await s.scalars(select(FortuneDraw.day).where(FortuneDraw.user_id == user_id, FortuneDraw.day >= since))).all())
|
||||
|
||||
async def log_of(self, s: AsyncSession, user_id: uuid.UUID, day: date) -> Optional[DayLog]:
|
||||
return await s.get(DayLog, (user_id, day))
|
||||
|
||||
async def save_log(self, s: AsyncSession, user_id: uuid.UUID, day: date, values: dict) -> DayLog:
|
||||
stmt = insert(DayLog).values(user_id=user_id, day=day, **values)
|
||||
await s.execute(stmt.on_conflict_do_update(index_elements=[DayLog.user_id, DayLog.day], set_={**values, "updated_at": func.now()}))
|
||||
return await s.scalar(select(DayLog).where(DayLog.user_id == user_id, DayLog.day == day).execution_options(populate_existing=True))
|
||||
|
||||
async def import_rows(self, s: AsyncSession, user_id: uuid.UUID, draws: list[tuple[date, str]], logs: list[tuple[date, dict]]) -> None:
|
||||
"""기기에 있던 기록을 계정으로. 계정에 이미 있는 날은 계정 쪽을 둔다"""
|
||||
if draws:
|
||||
await s.execute(insert(FortuneDraw).values([{"user_id": user_id, "day": d, "card_code": c} for d, c in draws]).on_conflict_do_nothing())
|
||||
if logs:
|
||||
await s.execute(insert(DayLog).values([{"user_id": user_id, "day": d, **v} for d, v in logs]).on_conflict_do_nothing())
|
||||
|
||||
async def search_places(self, s: AsyncSession, q: str, sido: str, today: date, limit: int) -> list[tuple[str, str]]:
|
||||
"""이름에 q 가 들어간 데이트 명소·노을 명소·지금 하는 행사. 같은 시도를 앞에. (place_ref, 이름)"""
|
||||
like = "%" + q.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_") + "%"
|
||||
places = (await s.execute(select(Place.place_id, Place.name).where(Place.name.ilike(like, escape="\\")).order_by(_near(Place.region_code, sido), Place.name).limit(limit))).all()
|
||||
spots = (await s.execute(select(SunsetSpot.spot_id, SunsetSpot.name).where(SunsetSpot.name.ilike(like, escape="\\")).order_by(_near(SunsetSpot.region_code, sido), SunsetSpot.name).limit(limit))).all()
|
||||
events = (await s.execute(
|
||||
select(Event.event_id, Event.name).where(Event.name.ilike(like, escape="\\"), Event.start_date <= today, Event.end_date >= today)
|
||||
.order_by(case((Event.sido_code == sido, 0), else_=1), Event.name).limit(limit)
|
||||
)).all()
|
||||
return [(f"place:{i}", n) for i, n in places] + [(f"spot:{i}", n) for i, n in spots] + [(f"event:{i}", n) for i, n in events]
|
||||
@@ -0,0 +1,30 @@
|
||||
import uuid
|
||||
from datetime import date
|
||||
|
||||
from sqlalchemy import func, select, update
|
||||
from sqlalchemy.dialects.postgresql import insert
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from common.database.model.models import PointLog, User
|
||||
|
||||
|
||||
class LevelCRUD:
|
||||
async def earned(self, s: AsyncSession, user_id: uuid.UUID, day: date, action: str) -> int:
|
||||
return await s.scalar(select(func.coalesce(func.sum(PointLog.points), 0)).where(PointLog.user_id == user_id, PointLog.day == day, PointLog.action == action))
|
||||
|
||||
async def add(self, s: AsyncSession, user_id: uuid.UUID, day: date, action: str, ref: str, points: int) -> int:
|
||||
"""같은 날 같은 일·대상이면 넣지 않는다. 넣었으면 총량에 더하고 새 총량을 돌려준다 (안 넣었으면 0)"""
|
||||
row = await s.scalar(insert(PointLog).values(user_id=user_id, day=day, action=action, ref=ref, points=points).on_conflict_do_nothing().returning(PointLog.point_id))
|
||||
if row is None:
|
||||
return 0
|
||||
return await s.scalar(update(User).where(User.user_id == user_id).values(points=User.points + points).returning(User.points))
|
||||
|
||||
async def today(self, s: AsyncSession, user_id: uuid.UUID, day: date) -> dict[str, int]:
|
||||
rows = (await s.execute(select(PointLog.action, func.sum(PointLog.points)).where(PointLog.user_id == user_id, PointLog.day == day).group_by(PointLog.action))).all()
|
||||
return {a: int(p) for a, p in rows}
|
||||
|
||||
async def attend_days(self, s: AsyncSession, user_id: uuid.UUID, since: date) -> list[date]:
|
||||
return list((await s.scalars(select(PointLog.day).where(PointLog.user_id == user_id, PointLog.action == "attend", PointLog.day >= since))).all())
|
||||
|
||||
async def points(self, s: AsyncSession, user_id: uuid.UUID) -> int:
|
||||
return await s.scalar(select(User.points).where(User.user_id == user_id)) or 0
|
||||
@@ -1,4 +1,5 @@
|
||||
import uuid
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import delete, func, select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
@@ -13,8 +14,8 @@ class MyGakCRUD:
|
||||
async def count(self, s: AsyncSession, user_id: uuid.UUID) -> int:
|
||||
return await s.scalar(select(func.count()).select_from(MyGak).where(MyGak.user_id == user_id))
|
||||
|
||||
async def add(self, s: AsyncSession, user_id: uuid.UUID, name: str, rule: dict) -> MyGak:
|
||||
row = MyGak(user_id=user_id, name=name, rule=rule)
|
||||
async def add(self, s: AsyncSession, user_id: uuid.UUID, name: str, rule: dict, icon: Optional[str] = None) -> MyGak:
|
||||
row = MyGak(user_id=user_id, name=name, rule=rule, icon=icon)
|
||||
s.add(row)
|
||||
await s.flush()
|
||||
return row
|
||||
|
||||