mirror of
https://github.com/harry0703/MoneyPrinterTurbo.git
synced 2026-11-14 18:22:59 +01:00
Adds Coverr (https://coverr.co) as a third video material source alongside the existing Pexels and Pixabay providers. Coverr offers free CC0-licensed HD/4K stock videos and complements the existing providers by widening the catalog for cinematic 16:9 landscape content. Strict additive change: existing pexels/pixabay paths are untouched. The download loop gets a single `elif source == "coverr"` dispatch and one `if item.provider == "coverr"` branch. What's added - search_videos_coverr() + _ping_coverr_download() in app/services/material.py - elif dispatch + URL-decode/post-save ping in download_videos() - WebUI: - Coverr entry in the Video Source dropdown - Coverr API Key input + third tab in the multi-key manager - Source-aware aspect default: selecting Coverr defaults Video Ratio to Landscape (Coverr is ~99% 16:9). Each source remembers its own aspect choice via session_state, so user overrides stick. - config.example.toml: new coverr_api_keys section with rate-limit notes - i18n: 11 new Coverr* keys in all 7 locales - README.md / README-en.md: one-line mention in Features - test/services/test_material.py: 10 focused unit tests (mock-only) Design choices - MaterialInfo schema unchanged. The Coverr branch encodes <id>|<mp4_url> into the url field with a coverr:// prefix and the download loop splits them. Avoids any risk to the public API's video_materials field. - TLS verify on by default via _get_tls_verify(), matching #895. - Source-aware aspect default uses key=f"video_aspect_for_{source}" so the Landscape default only applies the first time Coverr is selected; user overrides stick. Compliance: mandatory download ping Coverr requires PATCH /videos/<id>/stats/downloads after each successful download. Wired into the loop and only fires after save_video() succeeds, so failed downloads don't burn quota or skew Coverr's stats. The ping itself is best-effort: a network failure logs a warning but never breaks video generation. Testing $ uv run python -m unittest test.services.test_material test.services.test_webui_i18n Ran 18 tests in 0.027s - OK $ uv run python -m unittest discover -s test Ran 121 tests in 6.200s - OK (skipped=3) End-to-end smoke tested locally with a real Coverr Demo API key on macOS / Python 3.11: WebUI dropdown shows the new Coverr entry; selecting it auto-defaults Video Ratio to Landscape; full pipeline runs cleanly (search -> download -> ping -> ffmpeg concat -> TTS + subtitle + BGM -> final MP4); no regressions when switching back to Pexels/Pixabay. i18n note Translations for de, pt, tr, vi, zh follow patterns from existing locale entries. Native-speaker review for these locales would be welcome. en and ru are auto-checked by test_webui_i18n.