mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
## Summary - Fix YouTube audio downloads failing when remote flacfetch is enabled - Add dynamic MIME type detection for audio uploads (fixes hardcoded `audio/flac` for `.webm`/`.opus` files) - Add documentation example to LESSONS-LEARNED.md ## Problem When remote flacfetch is enabled and a user selects a YouTube audio source, the backend was calling `download_by_id()` without the `gcs_path` parameter. This caused flacfetch to download the file locally on the VM instead of uploading to GCS. The backend then tried to open the VM's local path (`/var/lib/transmission-daemon/downloads/...`) which doesn't exist on Cloud Run, causing the job to fail. **Production impact:** Job `4c266875` failed with "No such file or directory" ## Root Cause This is the same class of bug that was fixed in December 2025 for RED/OPS torrent sources. However, that fix only addressed the torrent code path, leaving YouTube downloads broken when remote is enabled. ## Changes ### `backend/api/routes/audio_search.py` - Add new `elif` branch to handle remote YouTube downloads with `gcs_path` parameter - Use `mimetypes.guess_type()` to detect correct content type instead of hardcoded `audio/flac` ### `backend/tests/test_audio_search.py` - Add `test_youtube_remote_download_passes_gcs_path` to verify the fix - Add `test_youtube_local_download_when_remote_disabled` for coverage ### `docs/LESSONS-LEARNED.md` - Add specific example of the `gcs_path` bug to the "Fix Both Sides of Dual Code Paths" lesson ## Test plan - [x] All 50 audio_search tests pass - [x] New test verifies `gcs_path` is passed to `download_by_id()` for YouTube sources - [x] New test verifies local download path when remote is disabled - [ ] Production verification: retry previously failed job after deployment <!-- @coderabbitai ignore --> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
169 lines
5.2 KiB
TOML
169 lines
5.2 KiB
TOML
[tool.poetry]
|
|
name = "karaoke-gen"
|
|
version = "0.108.9"
|
|
description = "Generate karaoke videos with synchronized lyrics. Handles the entire process from downloading audio and lyrics to creating the final video with title screens."
|
|
authors = ["Andrew Beveridge <andrew@beveridge.uk>"]
|
|
license = "MIT"
|
|
readme = "README.md"
|
|
packages = [
|
|
{ include = "karaoke_gen" },
|
|
{ include = "backend" }
|
|
]
|
|
include = [
|
|
"karaoke_gen/nextjs_frontend/out",
|
|
"karaoke_gen/nextjs_frontend/out/**/*",
|
|
"karaoke_gen/lyrics_transcriber/output/fonts/*",
|
|
"karaoke_gen/lyrics_transcriber/output/cdgmaker/images/*",
|
|
"karaoke_gen/lyrics_transcriber/output/cdgmaker/transitions/*"
|
|
]
|
|
homepage = "https://github.com/nomadkaraoke/karaoke-gen"
|
|
repository = "https://github.com/nomadkaraoke/karaoke-gen"
|
|
documentation = "https://github.com/nomadkaraoke/karaoke-gen/blob/main/README.md"
|
|
|
|
[tool.poetry.dependencies]
|
|
python = ">=3.10,<3.14"
|
|
torch = ">=2.7"
|
|
requests = ">=2"
|
|
beautifulsoup4 = ">=4"
|
|
flacfetch = ">=0.9.0"
|
|
lyricsgenius = ">=3"
|
|
fetch-lyrics-from-genius = ">=0.1"
|
|
pillow = ">=10.1"
|
|
pyinstaller = ">=6.3"
|
|
google-api-python-client = "*"
|
|
google-auth = "*"
|
|
google-auth-oauthlib = "*"
|
|
google-auth-httplib2 = "*"
|
|
thefuzz = ">=0.22"
|
|
numpy = ">=2"
|
|
audio-separator = { version = ">=0.34.0", extras = ["cpu"] }
|
|
lyrics-converter = ">=0.2.1"
|
|
# lyrics_transcriber is now a subpackage of karaoke_gen (karaoke_gen/lyrics_transcriber/)
|
|
# Dependencies from vendored lyrics_transcriber:
|
|
mutagen = ">=1.47" # For LRCLIB provider to get track duration for better matching
|
|
python-slugify = ">=8"
|
|
syrics = ">=0"
|
|
karaoke-lyrics-processor = ">=0.6"
|
|
dropbox = ">=12"
|
|
spacy = ">=3.8.7"
|
|
srsly = ">=2.5.1"
|
|
tqdm = ">=4.67"
|
|
python-levenshtein = ">=0.26"
|
|
transformers = ">=4.47"
|
|
metaphone = ">=0.6"
|
|
nltk = ">=3.9"
|
|
spacy-syllables = ">=3"
|
|
syllables = ">=1"
|
|
fonttools = ">=4.55"
|
|
ollama = ">=0.4.7"
|
|
shortuuid = ">=1.0.13"
|
|
nest-asyncio = ">=1.5"
|
|
openai = ">=1.63.2"
|
|
langgraph = ">=0.2.0"
|
|
langchain = ">=0.3.0"
|
|
langchain-core = ">=0.3.0"
|
|
langchain-openai = ">=0.2.0"
|
|
langchain-anthropic = ">=0.2.0"
|
|
langchain-ollama = ">=0.2.0"
|
|
langchain-google-genai = ">=2.0.0"
|
|
langfuse = ">=3.0.0"
|
|
jiwer = ">=3.0.0"
|
|
kbputils = "^0.0.16"
|
|
attrs = ">=24.2.0"
|
|
cattrs = ">=24.1.2"
|
|
toml = ">=0.10"
|
|
argparse = ">=1.4.0"
|
|
psutil = "^7.0.0"
|
|
pyperclip = "*"
|
|
pytest-asyncio = "*"
|
|
ffmpeg-python = "^0.2.0"
|
|
python-multipart = "^0.0.20"
|
|
yt-dlp = ">=2024.0.0"
|
|
matplotlib = ">=3"
|
|
# Backend API dependencies
|
|
fastapi = ">=0.104.0"
|
|
uvicorn = { version = ">=0.24.0", extras = ["standard"] }
|
|
pydantic = ">=2.5.0"
|
|
pydantic-settings = ">=2.1.0"
|
|
httpx = ">=0.25.0"
|
|
google-cloud-firestore = ">=2.14.0"
|
|
google-cloud-storage = ">=2.14.0"
|
|
google-cloud-secret-manager = ">=2.18.0"
|
|
google-cloud-tasks = ">=2.16.0" # Cloud Tasks for worker coordination (Phase 1 scalability)
|
|
google-cloud-run = ">=0.10.0" # Cloud Run Jobs for long-running video encoding (Phase 2 scalability)
|
|
python-dotenv = ">=1.0.0"
|
|
pydub = ">=0.25.1"
|
|
# Payment and email services
|
|
stripe = ">=7.0.0"
|
|
sendgrid = ">=6.10.0"
|
|
email-validator = ">=2.0.0" # For Pydantic EmailStr validation
|
|
# Web Push notifications
|
|
pywebpush = ">=2.0.0"
|
|
# OpenTelemetry for distributed tracing
|
|
opentelemetry-api = ">=1.20.0"
|
|
opentelemetry-sdk = ">=1.20.0"
|
|
opentelemetry-instrumentation-fastapi = ">=0.41b0"
|
|
opentelemetry-instrumentation-httpx = ">=0.41b0"
|
|
opentelemetry-instrumentation-logging = ">=0.41b0"
|
|
opentelemetry-exporter-gcp-trace = ">=1.6.0"
|
|
opentelemetry-resourcedetector-gcp = ">=1.6.0a0"
|
|
# Optional: Local Whisper transcription (install with: pip install karaoke-gen[local-whisper])
|
|
whisper-timestamped = { version = ">=1.15.0", optional = true }
|
|
aiohttp = "^3.13.2"
|
|
|
|
[tool.poetry.group.dev.dependencies]
|
|
black = ">=23"
|
|
poetry = "*"
|
|
pytest = ">=7.0"
|
|
pytest-cov = ">=4.0"
|
|
pytest-mock = ">=3.10"
|
|
pytest-asyncio = "*"
|
|
|
|
[tool.poetry.extras]
|
|
# Local Whisper transcription support - optional, heavy dependencies
|
|
# Install with: pip install karaoke-gen[local-whisper]
|
|
# For CPU-only installation (recommended for systems without GPU):
|
|
# pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu
|
|
# pip install karaoke-gen[local-whisper]
|
|
local-whisper = ["whisper-timestamped"]
|
|
|
|
[tool.poetry.scripts]
|
|
karaoke-gen = 'karaoke_gen.utils.gen_cli:main'
|
|
karaoke-gen-remote = 'karaoke_gen.utils.remote_cli:main'
|
|
karaoke-bulk = 'karaoke_gen.utils.bulk_cli:main'
|
|
|
|
[tool.black]
|
|
line-length = 140
|
|
|
|
[build-system]
|
|
requires = ["poetry-core"]
|
|
build-backend = "poetry.core.masonry.api"
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["tests/unit", "tests/integration", "backend/tests"]
|
|
python_files = ["test_*.py"]
|
|
addopts = [
|
|
"--asyncio-mode=auto",
|
|
"-v",
|
|
"--tb=short",
|
|
]
|
|
markers = [
|
|
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
|
|
"integration: marks tests as integration tests",
|
|
"asyncio: mark test as async",
|
|
"emulator: marks tests requiring GCP emulators",
|
|
]
|
|
filterwarnings = [
|
|
"ignore::DeprecationWarning",
|
|
"ignore:'audioop' is deprecated:DeprecationWarning",
|
|
"ignore::RuntimeWarning",
|
|
"ignore::UserWarning",
|
|
]
|
|
|
|
[tool.coverage.run]
|
|
# Exclude lyrics_transcriber subpackage from coverage since it was a separate vendored package
|
|
# with its own test suite - including it in karaoke_gen coverage would unfairly lower the percentage
|
|
omit = [
|
|
"karaoke_gen/lyrics_transcriber/*",
|
|
]
|