Features: - Video download from TikTok/Douyin using yt-dlp - Audio transcription with OpenAI Whisper - GPT-4 translation (direct/summarize/rewrite modes) - Subtitle generation with ASS format - Video trimming with frame-accurate preview - BGM integration with volume control - Intro text overlay support - Thumbnail generation with text overlay Tech stack: - Backend: FastAPI, Python 3.11+ - Frontend: React, Vite, TailwindCSS - Video processing: FFmpeg - AI: OpenAI Whisper, GPT-4 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
from pydantic_settings import BaseSettings
|
|
from functools import lru_cache
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# API Keys
|
|
OPENAI_API_KEY: str = ""
|
|
PIXABAY_API_KEY: str = "" # Optional: for Pixabay music search
|
|
FREESOUND_API_KEY: str = "" # Optional: for Freesound API (https://freesound.org/apiv2/apply)
|
|
|
|
# Directories
|
|
DOWNLOAD_DIR: str = "data/downloads"
|
|
PROCESSED_DIR: str = "data/processed"
|
|
BGM_DIR: str = "data/bgm"
|
|
|
|
# Whisper settings
|
|
WHISPER_MODEL: str = "medium" # small, medium, large
|
|
|
|
# Redis
|
|
REDIS_URL: str = "redis://redis:6379/0"
|
|
|
|
# OpenAI settings
|
|
OPENAI_MODEL: str = "gpt-4o-mini" # gpt-4o-mini, gpt-4o, gpt-4-turbo
|
|
TRANSLATION_MAX_TOKENS: int = 1000 # Max tokens for translation (cost control)
|
|
TRANSLATION_MODE: str = "rewrite" # direct, summarize, rewrite
|
|
|
|
# GPT Prompt Customization
|
|
GPT_ROLE: str = "친근한 유튜브 쇼츠 자막 작가" # GPT persona/role
|
|
GPT_TONE: str = "존댓말" # 존댓말, 반말, 격식체
|
|
GPT_STYLE: str = "" # Additional style instructions (optional)
|
|
|
|
# Processing
|
|
DEFAULT_FONT_SIZE: int = 24
|
|
DEFAULT_FONT_COLOR: str = "white"
|
|
DEFAULT_BGM_VOLUME: float = 0.3
|
|
|
|
# Server
|
|
PORT: int = 3000 # Frontend port
|
|
|
|
# Proxy (for geo-restricted platforms like Douyin)
|
|
PROXY_URL: str = "" # http://host:port or socks5://host:port
|
|
|
|
class Config:
|
|
env_file = "../.env" # Project root .env file
|
|
extra = "ignore" # Ignore extra fields in .env
|
|
|
|
|
|
@lru_cache()
|
|
def get_settings():
|
|
return Settings()
|
|
|
|
|
|
settings = get_settings()
|