# Sora Video Tool

Tu dong tao video Sora theo batch voi nhieu Chrome profiles.

## Cai dat

```bash
# Clone repo va vao thu muc
cd auto-gen-video-sora

# Cach 1: dung run.sh (tu dong cai dat moi thu)
chmod +x run.sh
./run.sh setup

# Cach 2: thu cong
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
playwright install chromium   # chi can cho Playwright, khong phai cho Chrome thuc
```

## Su dung

### Thiet lap lan dau

```bash
./run.sh setup
# hoac
sora setup
```

Flow:
1. Nhap so luong profile
2. Nhap ten alias cho tung profile
3. Nhap username dsora
4. Nhap backend key
5. Nhap Telegram bot token / channel ID (tuy chon)
6. Chrome mo ra -> dang nhap Google + Sora + cau hinh Settings

### Dang nhap lai mot profile cu

```bash
sora setup --retry
```

### Chay tu dong

```bash
./run.sh run
# hoac
sora run
```

Tool se:
- Lay danh sach san pham tu API
- Chay lan luot tung profile (5 san pham / profile)
- Gui thong bao Telegram sau moi san pham / profile
- Luu lich su chay vao `~/.sora-tool/run_log.json`

### Xem huong dan

```bash
sora help
sora --help
sora run --help
```

## Cau truc thu muc

```
auto-gen-video-sora/
├── pyproject.toml              # Cau hinh PyPI
├── run.sh                      # Script khoi dong nhanh
├── README.md
├── .gitignore
└── sora_video_tool/            # Python package
    ├── cli.py                  # Entry point (sora setup / run / help)
    ├── constants.py            # Hang so toan cuc
    ├── config.py               # Doc/ghi ~/.sora-tool/settings.json
    ├── profile_manager.py      # Quan ly thu muc Chrome profile
    ├── browser_launcher.py     # Mo Chrome (login + CDP automation)
    ├── sora_bot.py             # Logic tu dong hoa Sora
    ├── api_client.py           # Giao tiep voi backend API
    ├── telegram_notifier.py    # Gui thong bao Telegram
    ├── run_tracker.py          # Theo doi lich su chay
    └── assets/
        └── tshirt.png          # Anh mac dinh
```

## Du lieu luu tru

Tat ca du lieu nguoi dung luu tai `~/.sora-tool/`:

| File | Noi dung |
|---|---|
| `settings.json` | Username, backend key, telegram, profiles |
| `run_log.json` | Lich su chay tung profile |
| `profiles/profile_1/` | Chrome user data (session, cookies) |

## Publish len PyPI

```bash
pip install build twine
python -m build
twine upload dist/*
```
