Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/harry0703/MoneyPrinterTurbo
/ functions
Functions
428 in github.com/harry0703/MoneyPrinterTurbo
⨍
Functions
428
◇
Types & classes
89
↳
Endpoints
16
Method
test_aihubmix_provider_uses_openai_compatible_client
AIHubMix 是 OpenAI-compatible 网关。这里用 fake OpenAI client 验证独立 provider 会使用合作方默认地址和推荐模型,避免真实网络 或私有 API Key 影响测试稳定性。
test/services/test_llm.py:292
Method
test_all_locales_include_subtitle_background_labels
WebUI 新增字幕背景开关和颜色选择器后,所有已有语言都必须包含对应 翻译 key,避免某些语言界面直接显示英文内部 key。
test/services/test_subtitle_background_settings.py:9
Method
test_azure_provider_uses_azure_client_directly
Azure OpenAI 的鉴权、endpoint 和 api-version 都由 AzureOpenAI 客户端处理。 这个测试覆盖 issue #892:azure 分支必须直接调用 AzureOpenAI 创建的客户端, 不能继续落入普通 O
test/services/test_llm.py:514
Method
test_azure_tts_v1
(self)
test/services/test_voice.py:190
Method
test_azure_tts_v1_supports_legacy_edge_tts_without_boundary
验证 Azure TTS V1 在旧版 edge_tts 依赖残留时仍可继续工作。 这个回归场景对应 Windows 便携包更新失败后,现场环境还停留在旧版 edge_tts 的情况: 1. `Communicate.__init_
test/services/test_voice.py:206
Method
test_azure_tts_v1_times_out_hanging_stream_sync
验证 Azure TTS V1 在 edge_tts 同步流卡住时能够快速失败。 真实现场里,网络异常、服务端限流、voice 语言与文本不匹配时, `stream_sync()` 可能长时间不返回,导致 WebUI 任务只停在 `
test/services/test_voice.py:259
Method
test_azure_tts_v2
(self)
test/services/test_voice.py:308
Method
test_build_prompt_accepts_explicit_language
(self)
test/services/test_llm.py:692
Method
test_build_prompt_auto_language_uses_source_language
language 默认 auto 时,不应该固定成某个国家或语种,而是让模型 跟随视频主题和脚本的语言,扩大 API 适用范围。
test/services/test_llm.py:675
Method
test_build_prompt_clamps_direct_service_inputs
(self)
test/services/test_llm.py:787
Method
test_build_script_prompt_appends_advanced_requirements
高级文案要求只作为附加约束,不替换默认系统提示词。 这样普通用户不配置时仍然走稳定默认规则,高级用户也能细化风格。
test/services/test_llm.py:46
Method
test_combine_videos_closes_audio_clip_when_duration_read_fails
`combine_videos()` 只需要读取旁白音频时长。即使读取 duration 时发生异常,也必须关闭 AudioFileClip,避免文件句柄泄漏。
test/services/test_video.py:382
Method
test_combine_videos_handles_none_transition_mode
Ensure `combine_videos` safely handles `video_transition_mode=None`.
test/services/test_video.py:415
Method
test_concat_video_clips_does_not_disable_codec_when_fallback_also_fails
concat 阶段如果 libx264 也失败,说明可能是输入 list、路径或输出权限 问题,不能把硬件编码器加入运行时禁用列表。
test/services/test_video.py:328
Method
test_concat_video_clips_falls_back_after_runtime_encoder_failure
最终 ffmpeg concat 阶段也要具备同样的回退能力。这里用 mock 模拟 h264_nvenc 编码失败,确认会自动再用 libx264 执行一次。
test/services/test_video.py:289
Method
test_container_detection_accepts_cgroup_container_marker
(self)
test/services/test_llm.py:630
Method
test_container_detection_accepts_dockerenv_marker
(self)
test/services/test_llm.py:617
Method
test_container_detection_ignores_plain_linux_cgroup_file
普通 Linux 也有 /proc/1/cgroup,不能因为文件存在就判定为容器。
test/services/test_llm.py:601
Method
test_container_gateway_ip_decodes_default_route
(self)
test/services/test_llm.py:646
Method
test_container_gateway_ip_ignores_missing_default_route
(self)
test/services/test_llm.py:660
Method
test_convert_rate_to_percent_signs_zero_rate
(self)
test/services/test_voice.py:708
Method
test_correct_ignores_markdown_separator_lines
Whisper fallback 校正阶段也必须忽略 `---` 这类不可发声脚本行。 如果这里继续保留 Markdown 分隔符,`correct()` 会认为脚本行数多于 字幕行数,并补出 `00:00:00,000 --> 00:00:00,
test/services/test_subtitle.py:13
Method
test_create_subtitle_ignores_markdown_separator_lines
用户手动脚本可能包含 `---` 这类 Markdown 分隔符。TTS 不会朗读 这些符号行,字幕聚合也不应把它们当成目标字幕行,否则后续真实 字幕会卡住并回退到 Whisper。
test/services/test_voice.py:641
Method
test_create_subtitle_ignores_markdown_underscore_marks
`_` 常被用户用作 Markdown 强调标记,但 TTS 返回的 cue 通常不包含 这些格式符。匹配时应忽略 `_`,避免生成空字幕或回退到 Whisper。
test/services/test_voice.py:678
Method
test_custom_system_prompt_keeps_runtime_context
自定义 system prompt 会替换默认脚本规则,但视频主题、语言、段落数 仍由服务层统一追加,避免高级用户漏写必要上下文。
test/services/test_llm.py:65
Method
test_download_videos_accepts_plain_string_concat_mode
download_videos 可能被服务层或测试直接传入字符串模式,而不是 VideoConcatMode 枚举。这里用空搜索词避免真实网络请求,只验证 字符串 "random" 不会再因为访问 `.value` 抛 AttributeError。
test/services/test_material.py:118
Method
test_download_videos_passes_mp4_download_url_to_save_video
在 source="coverr" 时: 1. dispatch 到 search_videos_coverr 2. coverr item 走通用下载路径:save_video 收到的就是 mp4_download URL
test/services/test_material.py:334
Method
test_edge_cue_aggregation_handles_arabic_variant_forms
复现阿拉伯语字幕失败的核心路径:脚本包含 أ/ة 等字母形态,edge cue 返回 ا/ه 等归一化形态时,聚合仍应生成完整字幕,避免回退 Whisper。
test/services/test_voice.py:612
Method
test_edge_cue_aggregation_handles_thousand_separator_comma
复现 issue #894 的关键形态:Edge cues 中最后一句作为连续文本返回, 包含 `1,000 years`。脚本断句必须与 cues 聚合结果一致,不能把它 拆成两条字幕。
test/services/test_voice.py:547
Method
test_empty_voice_name_does_not_enable_no_voice_mode
空 voice 通常意味着配置缺失或接口参数错误,不能自动切到无配音模式。 否则用户填错 TTS 配置时也会得到一个“成功”的静音视频,定位成本更高。
test/services/test_voice.py:138
Method
test_english_locale_covers_static_webui_labels
(self)
test/services/test_webui_i18n.py:34
Method
test_ffmpeg_encoder_exists_falls_back_when_probe_fails
Windows 上用户配置的 ffmpeg 可能因为路径损坏、权限或杀软拦截而无法 正常执行。encoder 探测失败时必须返回 False,让上层稳定回退 libx264。
test/services/test_video.py:214
Method
test_file_to_subtitles_keeps_last_block_without_trailing_newline
The final subtitle must be parsed even when the SRT file does not end with a trailing blank line. Many tools omit it, and previously
test/services/test_subtitle.py:46
Method
test_file_to_subtitles_parses_blocks_with_trailing_newline
A normal SRT ending in a blank line still parses all blocks.
test/services/test_subtitle.py:71
Method
test_format_ffmpeg_concat_path_normalizes_windows_path
concat demuxer 的文件列表对 Windows 反斜杠较敏感,写入 list 前统一 转成正斜杠,并继续保留单引号转义。
test/services/test_video.py:278
Method
test_g4f_provider_reports_missing_optional_dependency
(self)
test/services/test_llm.py:588
Method
test_g4f_provider_requires_explicit_opt_in
g4f 存在供应链和稳定性风险,不能因为用户把 provider 写成 g4f 就默认加载第三方包并访问逆向接口,必须显式启用。
test/services/test_llm.py:560
Method
test_g4f_provider_uses_lazy_import_after_opt_in
(self)
test/services/test_llm.py:573
Method
test_gemini_tts_uses_legacy_submaker_fields
验证 Gemini TTS 在 edge_tts 7.x 环境下仍会返回项目兼容的字幕结构, 并且可以被 `subtitle_provider=edge` 的字幕生成链路直接消费, 避免再次回退 Whisper。
test/services/test_voice.py:330
Method
test_generate_script_forwards_advanced_prompt_options
任务生成入口和 WebUI/API 共用 VideoParams。这里验证自动生成文案时, 高级提示词参数会继续传到 LLM 服务层,避免只在 /scripts 接口生效。
test/services/test_task.py:22
Method
test_generate_script_sends_custom_prompt_to_llm
(self)
test/services/test_llm.py:83
Method
test_generate_silent_audio_rejects_missing_output_file
即使 FFmpeg 进程返回成功,也要确认输出文件真实存在且非空。这样可以把 异常收敛在 TTS 阶段,而不是拖到后续视频合成阶段才暴露。
test/services/test_voice.py:120
Method
test_generate_social_metadata_falls_back_to_generic_hashtags
(self)
test/services/test_llm.py:752
Method
test_generate_social_metadata_uses_llm_response
(self)
test/services/test_llm.py:735
Method
test_generate_subtitle_keeps_edge_provider_for_gemini_legacy_submaker
验证 Gemini TTS 返回的 legacy 字幕结构在 edge provider 下可以直接产出 SRT,不会因为匹配失败而回退到 Whisper。
test/services/test_voice.py:489
Method
test_get_all_azure_voices
(self)
test/services/test_voice.py:48
Method
test_get_all_azure_voices_filtered
(self)
test/services/test_voice.py:57
Method
test_get_all_tasks_paginates_across_scan_batches
Redis SCAN 分批返回 key 时,分页切片必须按当前批次起始位置计算。 这个用例复现 PR #890 描述的 18 条任务、page_size=10 场景: 第一批 10 条,第二批 8 条。旧逻辑第一页会返回空列表,第二页
test/services/test_state.py:46
Method
test_get_bgm_file_accepts_project_relative_song_path
用户在 WebUI 中可能直接填写 ./resource/songs/xxx.mp3。该路径虽然是 项目根目录相对路径,但实际文件仍在 resource/songs 白名单目录内, 应该被接受,避免自定义背景音乐被误判为不存在。
test/services/test_video.py:158
Method
test_get_bgm_file_accepts_song_directory_filename
BGM 列表接口现在只暴露文件名;生成视频时应能把文件名安全解析回 resource/songs 白名单目录,保持正常使用路径可用。
test/services/test_video.py:143
Method
test_get_bgm_file_rejects_path_outside_song_directory
用户传入的 bgm_file 不能直接作为本地路径打开,否则可能读取系统文件。 即使外部文件存在,也必须因为不在 songs 目录内被拒绝。
test/services/test_video.py:177
Method
test_get_effective_video_codec_falls_back_when_encoder_missing
用户选择的硬件编码器必须先经过 FFmpeg encoder 列表检测。检测不到 时直接回退 libx264,避免生成任务在写文件阶段才失败。
test/services/test_video.py:204
Method
test_get_ffmpeg_binary_falls_back_to_imageio_ffmpeg
Windows 便携包里系统 PATH 可能没有 ffmpeg,但 moviepy 依赖的 imageio-ffmpeg 通常会提供可执行文件。这里验证该兜底路径可用。
test/services/test_video.py:190
Method
test_get_ffmpeg_binary_uses_configured_env_path
配置中显式指定 ffmpeg 时,应优先使用该路径。
test/services/test_video.py:185
Method
test_grok_provider_still_uses_existing_path
(self)
test/services/test_llm.py:334
Method
test_groq_provider_requires_api_key
(self)
test/services/test_llm.py:346
Method
test_groq_provider_uses_default_base_url
(self)
test/services/test_llm.py:358
Method
test_in_memory_task_manager_rejects_when_queue_is_full
并发数用尽后,等待队列必须有硬上限。这里用 max_concurrent_tasks=0 强制任务进入队列,验证超过 max_queued_tasks 时会拒绝继续入队。
test/services/test_video.py:70
Method
test_litellm_provider_handles_empty_message
某些 OpenAI-compatible 网关在内容过滤或安全拦截时会返回 HTTP 200,但 `choices[0].message` 为 None。这里必须返回 可诊断的错误,而不是抛出 AttributeError。
test/services/test_llm.py:179
Method
test_litellm_provider_handles_empty_response
(self)
test/services/test_llm.py:166
Method
test_litellm_provider_requires_model_name
(self)
test/services/test_llm.py:158
Method
test_litellm_provider_returns_normalized_text
验证 LiteLLM provider 的主路径不依赖真实网络和私有 API key。 这里用 fake module 注入 `sys.modules`,直接覆盖动态 import 的 `litellm.completion()`,确保测试稳定覆盖
test/services/test_llm.py:129
Method
test_live_litellm_completion
(self)
test/services/test_llm.py:855
Method
test_match_script_line_normalizes_arabic_letter_forms
edge-tts 可能把阿拉伯语中的不同字母形态归一化,或返回带变音符号、 Tatweel 的 cue 文本。匹配时应容错,但最终字幕仍保留原始脚本文案。
test/services/test_voice.py:597
Method
test_mimo_provider_uses_openai_compatible_client
MiMo 官方接口兼容 OpenAI Chat Completions 协议。这里用 fake OpenAI client 验证 provider 会使用 MiMo 独立配置和默认 base_url,不依赖 真实网络或私有 API Key。
test/services/test_llm.py:472
Method
test_mimo_tts_uses_openai_compatible_audio_response
验证 Xiaomi MiMo TTS 可以消费 OpenAI-compatible 的音频响应结构。 这里用 fake OpenAI client 和 fake AudioSegment 覆盖真实网络与 ffmpeg, 确认运行时代码会把待合成文本
test/services/test_voice.py:398
Method
test_no_voice_alias_none_is_supported_temporarily
兼容 PR #981 曾使用过的 none sentinel,避免少量直接调用 API 的用户 升级后立即失效。新 UI 和新代码仍统一使用 no-voice。
test/services/test_voice.py:97
Method
test_no_voice_duration_estimates_non_ascii_languages
无配音没有真实 TTS 音频,只能根据脚本文字估算阅读时间。俄语、阿拉伯语、 日文假名、韩文等非 ASCII 文本也必须参与估算,不能都落到最短 3 秒。
test/services/test_voice.py:106
Method
test_no_voice_tts_generates_silent_audio_and_subtitle_timeline
无配音模式不调用任何外部 TTS provider,只生成静音音频作为时间轴占位。 这里 mock FFmpeg,验证请求参数、输出文件和 legacy 字幕结构都符合后续 视频合成链路的预期。
test/services/test_voice.py:64
Method
test_normalize_hashtags_from_list_keeps_unicode_letters
(self)
test/services/test_llm.py:716
Method
test_normalize_hashtags_from_string_dedupes_and_clamps
(self)
test/services/test_llm.py:711
Method
test_normalize_text_response_rejects_think_only_response
如果模型只返回思考块而没有最终答案,应视为空内容,触发重试或明确错误。
test/services/test_llm.py:31
Method
test_normalize_text_response_removes_think_blocks
reasoning 模型可能返回 `<think>...</think>`。脚本生成链路必须只保留 最终正文,避免思考过程进入字幕和配音。
test/services/test_llm.py:19
Method
test_normalize_text_response_removes_unclosed_think_block
某些网关可能因为截断只返回未闭合的 `<think>`。这种内容同样不能 进入最终脚本;如果清理后没有正文,就应该按空响应处理。
test/services/test_llm.py:38
Method
test_ollama_default_base_url_falls_back_to_container_gateway
原生 Linux Docker 里不一定能解析 host.docker.internal。此时使用容器 默认网关作为兜底地址,比直接返回不可解析的 hostname 更稳。
test/services/test_llm.py:449
Method
test_ollama_default_base_url_uses_host_gateway_inside_container
容器内运行时,localhost 指向容器自身;默认改为 host.docker.internal, 方便 Docker Desktop 用户访问宿主机上的 Ollama。
test/services/test_llm.py:436
Method
test_ollama_default_base_url_uses_localhost_outside_container
普通本机运行时,Ollama 默认仍然使用 localhost,避免影响已有用户。
test/services/test_llm.py:427
Method
test_ollama_explicit_base_url_takes_precedence
用户手动配置的 ollama_base_url 优先级最高,不受容器检测影响。
test/services/test_llm.py:463
Method
test_open_video_clip_quietly_suppresses_moviepy_stdout
MoviePy 2.1.x 的 FFMPEG_VideoReader 会直接向 stdout 打印 metadata 和 ffmpeg 命令。项目服务层应屏蔽这类依赖库噪声,避免用户把 `audio_found: False` 误判为最终视频没有音频
test/services/test_video.py:361
Method
test_openai_provider_still_uses_existing_path
(self)
test/services/test_llm.py:199
Method
test_parse_social_metadata_recovers_embedded_json
(self)
test/services/test_llm.py:723
Method
test_parse_social_metadata_requires_title_or_caption
(self)
test/services/test_llm.py:731
Method
test_preprocess_video
(self)
test/services/test_video.py:95
Method
test_preprocess_video_rejects_material_outside_local_videos
local 素材路径来自 API 参数,不能允许任意绝对路径进入 MoviePy。 这里验证非 local_videos 白名单目录内的路径会被跳过,避免任意文件读取。
test/services/test_video.py:132
Method
test_prioritize_unique_source_clips_keeps_sequential_order
顺序模式本身只取每个素材的首段,不应被随机调度逻辑改变顺序。
test/services/test_video.py:465
Method
test_prioritize_unique_source_clips_prefers_long_primary_clip
同一个源素材的最后一个切片可能短于目标片段时长。首轮去重时应优先 选择较长片段,否则会因为累计时长不足而提前复用素材。
test/services/test_video.py:482
Method
test_prioritize_unique_source_clips_uses_each_source_before_reuse
随机模式下,一个长素材会被拆成多个片段。调度层应先让每个源素材 至少出现一次,再使用同一源素材的其他切片,降低用户感知到的重复。
test/services/test_video.py:443
Method
test_qwen_provider_falls_back_to_output_text
保留旧 DashScope completion 响应结构的兼容路径。
test/services/test_llm.py:258
Method
test_qwen_provider_reads_chat_choices_content
DashScope chat 模式会把文本放在 `output.choices[0].message.content`。 这里覆盖 issue #966 报告的 `output.text is None` 场景,避免再次触发 `'NoneType'
test/services/test_llm.py:239
Method
test_qwen_provider_reports_empty_choices
Qwen chat 响应 choices 为空时应返回明确错误。
test/services/test_llm.py:280
Method
test_qwen_provider_reports_empty_text
Qwen 空响应应返回可诊断错误,而不是底层 AttributeError。
test/services/test_llm.py:268
Method
test_request_model_defaults_to_auto_language_tiktok
(self)
test/services/test_llm.py:767
Method
test_request_model_rejects_oversized_social_metadata_fields
外部 API 不能接受无限长的脚本和语言参数,否则会直接放大 LLM token 成本。schema 层先拦截,服务层再做内部调用兜底。
test/services/test_llm.py:773
Method
test_rounded_subtitle_background_clip_has_transparent_corners
圆角字幕背景只在用户显式开启时使用。这里直接验证生成的 RGBA 背景具备透明圆角和半透明中心,避免后续改动把圆角效果退化成实心矩形。
test/services/test_video.py:541
Method
test_russian_locale_covers_english_locale
(self)
test/services/test_webui_i18n.py:43
Method
test_russian_locale_covers_static_webui_labels
(self)
test/services/test_webui_i18n.py:49
Method
test_save_video_uses_tls_verification_by_default
(self)
test/services/test_material.py:91
Method
test_script_language_options_include_russian
(self)
test/services/test_webui_i18n.py:58
Method
test_script_split_keeps_thousand_separator_comma
Edge TTS 会把 "1,000 years" 作为连续文本返回。脚本断句时不能把 数字中间的英文逗号当成句子边界,否则字幕聚合会出现 issue #894 里的 sub_items 数量少于 script_lines,并错误回退 Whisper
test/services/test_voice.py:526
Method
test_script_split_supports_arabic_punctuation
阿拉伯语脚本常用 ، ؛ ؟ 作为自然断句标点。断句阶段必须识别这些 标点,否则 edge-tts cue 的停顿边界和脚本行边界会错位。
test/services/test_voice.py:580
← previous
next →
301–400 of 428, ranked by callers