feat: 이번주 코디 영상 스크립트·템플릿·모델 사진과 명령 파일 추가, 클립 동작은 후보에서 무작위로 고름 (손가락 모양 동작 제외), .sh·.py·.mjs 는 LF 로 받음
This commit is contained in:
1 parent
1ec87a82c1
commit
56f71cdfbe
54 files changed
+1576
No files matched your search
@@ -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()
|
||||
Reference in new issue
Block a user