CodeVetter · Repo Unpack · Extension points
harry0703/MoneyPrinterTurbo
The codebase is deliberately registry/dispatch oriented. New LLM providers plug into LLM_PROVIDER_REGISTRY plus (only for non-OpenAI-compatible protocols) an adapter branch in llm._generate_response. New video material sources extend the download_videos dispatch plus the CLI's _CLI_VIDEO_SOURCES and mpt_agent's SUPPORTED_SOURCES. New AI-music providers slot into _VIDEO_MUSIC_PROVIDERS. New TTS engines add is_*_voice detectors and a _single_tts branch. State and queue backends are subclassable, routes extend via new_router, and UI strings via i18n JSON files.
- LLM providers: append an LLMProviderSpec to LLM_PROVIDER_REGISTRY (provider_id, defaults, endpoints, extra_fields); OpenAI-compatible providers need no adapter code — only gemini, qwen, azure, claude_code, litellm have dedicated branches in _generate_response.
- Video material sources: add a branch in material.download_videos plus the source id in cli.py's _CLI_VIDEO_SOURCES, docs/skill/mpt_agent.py's SUPPORTED_SOURCES (kept aligned by comment), and config.example.toml keys; WebUI-specific sources like loomloom bypass download_videos entirely via get_video_materials in task.py.
- AI music providers: register in task.py's _VIDEO_MUSIC_PROVIDERS dict — a service module implementing is_enabled() and generate_bgm() plus error_type/suffix/warning_code/display_name metadata; orchestration, zero-volume short-circuit, and failure degradation are shared.
- TTS engines: add an is_<name>_voice() detector on the voice-name prefix and a dispatch branch in _single_tts; voice lists surface via get_<name>_voices() helpers consumed by the WebUI.
- Subtitle engines: config.app.subtitle_provider selects among 'edge', 'whisper', or empty inside task.generate_subtitle — adding a provider means a new branch there plus a service module like subtitle.py.
- State backends: subclass BaseState (update_task/get_task/get_all_tasks/patch_task/delete_task) and switch the singleton at the bottom of state.py; queue backends subclass TaskManager's create_queue/enqueue/dequeue/is_queue_empty/queue_size.
- API surface: create a router with controllers/v1/base.new_router(dependencies=[Depends(base.verify_token)]) and include it in app/router.py — the pattern automatically yields /api/v1 prefix, V1 tag, and auth.
- Cross-post platforms: extend upload_post_platforms config values plus the _CROSS_POST_SOCIAL_PLATFORMS map in task.py that translates platform ids into LLM social-metadata platform names.
- UI languages: drop a new locale JSON into webui/i18n/ — utils.load_locales scans the directory at startup; locale keys like llm_provider_label.<id> are referenced by the provider registry.
- Config schema: add keys under config.example.toml sections and read them via config.<section>.get(); entirely new sections require adding a dict to save_config's serialization list or they will be dropped on save.
- Pipeline parameters: new VideoParams fields automatically flow into API request models (TaskVideoRequest subclasses VideoParams) and CLI batch manifests (unknown fields rejected, known fields merged), but CLI single-task flags must be added manually to parse_args.
- FFmpeg encoder options are config-driven: app.video_codec accepts libx264/h264_nvenc/h264_amf/h264_qsv/h264_mf/h264_videotoolbox with runtime probing and automatic fallback — new encoders plug into _get_effective_video_codec's probe path.