How ddean2009/moneyprinterplus works
Project Type & Purpose
• This is a full-stack Python application with a Streamlit GUI (“frontend”) that orchestrates video production workflows:
• AI-driven short-video generation (text→TTS→clips→ffmpeg)
• Batch video “mix-clips” assembly
• Automated video publishing via Selenium to platforms (抖音, 快手, 小红书, 视频号).
• It organizes code into a GUI entry point (gui.py/main.py), a “pages” layer for individual workflows, a service layer encapsulating domain logic, and various tool & config modules.
File-Structure Analysis & Architectural Patterns
• Top-level:
• gui.py / main.py – start Streamlit app
• pages/ – UI pages (01_auto_video, 02_mix_video, 03_auto_publish)
• services/ – modular backend services (audio, captioning, video, publisher, resource, llm, sd, …)
• tools/ – shared utilities (file, font, sys utils)
• config/, const/ – configuration management
• bgmusic/, fonts/, chattts/, work/, final/ – static assets & output
• docker/, setup/, start scripts – deployment automation
• Pattern: Layered (UI → Orchestrator → Service layer → External systems & local resources)
Key Architectural Components
a. Frontend (Streamlit GUI)
• Components: gui.py, pages/common.py, pages/01_*, etc.
• Role: collect user inputs, display progress & results, invoke orchestration.
b. Orchestration / Controller
• Lives in page scripts & modules under services/ that wire together calls to low-level services.
c. Service Layer (domain modules in services/)
• Audio services: speech recognition (faster-whisper, cloud providers), TTS (Azure, Tencent, chatTTS local)
• Captioning services: generate subtitles
• Video services: clip merging, transitions, ffmpeg orchestration
• LLM services: prompt→text generation via OpenAI, Azure, Baichuan, local Ollama, etc.
• Resource services: fetch stock clips from Pixabay/Pexels
• SD service: stable diffusion/WebUI API (future)
• Publisher services: Selenium-based upload to each platform
d. External Dependencies & Local Models
• External REST/WebSocket APIs: Azure Cognitive Services, Alibaba NLS, Tencent Cloud, OpenAI, …
• Local models & files: faster-whisper embeddings, chatTTS .pt, fonts, background music.
• ffmpeg CLI for video encoding & merging.
• Selenium WebDriver for browser automation.
e. Data Storage & Outputs
• final/ for generated videos
• Local folders for assets (bgmusic/, fonts/, chattts/)
• Logs under Streamlit / Docker setups
Relationships & Data Flows
• User → Streamlit UI → Orchestrator
• Orchestrator → Service Layer modules
• Text prompts → LLM → video script
• Script → TTS service → audio track
• video assets → Video service (ffmpeg) → merged clips + subtitles
• background music selection
• Output → final/ → displayed in UI
• For publishing:
• UI settings → Publisher service → Selenium → Browser (Chrome/Firefox) → Platform websites