mirror of
https://github.com/nomadkaraoke/karaoke-gen.git
synced 2026-11-20 13:07:57 +09:00
fix: make lyrics_transcriber a subpackage of karaoke_gen (#299)
## Summary Fixes the deployment failure from PR #297 by making lyrics_transcriber a proper subpackage of karaoke_gen instead of a separate vendored library. ### Changes - Move `libs/lyrics_transcriber/` to `karaoke_gen/lyrics_transcriber/` - Update all imports from `from lyrics_transcriber.X` to `from karaoke_gen.lyrics_transcriber.X` - Simplify Dockerfile (no separate `libs/` COPY needed) - Update pyproject.toml to remove separate package entry - Update test mocks and logger names ### Why this is better - Cleaner project structure - one package containing everything - Simpler Dockerfile - just COPY karaoke_gen/ - No confusion about vendored vs internal code ## Test plan - [x] `poetry install` succeeds - [x] All imports work correctly - [x] All 2614 tests pass - [ ] Backend deployment succeeds @coderabbitai ignore Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f3ee9e05f3
commit
404c6e6133
176 files changed
+269
-264
No files matched your search
@@ -57,7 +57,7 @@ karaoke-gen/
|
||||
|
||||
1. **`libs/`** - Clear convention for vendored/embedded libraries, separate from main codebase
|
||||
2. **Single level** - `lyrics_transcriber` directly under `libs/`, not nested (no `libs/lyrics_transcriber/lyrics_transcriber/`)
|
||||
3. **Clean imports** - `from lyrics_transcriber.core import ...` continues to work with proper Poetry config
|
||||
3. **Clean imports** - `from karaoke_gen.lyrics_transcriber.core import ...` continues to work with proper Poetry config
|
||||
|
||||
### pyproject.toml Changes
|
||||
|
||||
@@ -132,7 +132,7 @@ From current `lyrics_transcriber_temp/`:
|
||||
7. [ ] Remove `lyrics_transcriber_temp/` directory (with all its extra files)
|
||||
8. [ ] Update `pyproject.toml` packages and include paths
|
||||
9. [ ] Update the one script that references `lyrics_transcriber_temp` directly:
|
||||
- `scripts/benchmark_encoding.py` line 232: change `from lyrics_transcriber_temp.lyrics_transcriber.output.video` to `from lyrics_transcriber.output.video`
|
||||
- `scripts/benchmark_encoding.py` line 232: change `from lyrics_transcriber_temp.lyrics_transcriber.output.video` to `from karaoke_gen.lyrics_transcriber.output.video`
|
||||
|
||||
### Phase 3: Verify and Test
|
||||
|
||||
@@ -140,9 +140,9 @@ From current `lyrics_transcriber_temp/`:
|
||||
11. [ ] Run `make test` to ensure all tests pass
|
||||
12. [ ] Verify imports work:
|
||||
```python
|
||||
from lyrics_transcriber.core.controller import LyricsControllerResult
|
||||
from lyrics_transcriber.output.generator import OutputGenerator
|
||||
from lyrics_transcriber.types import CorrectionResult
|
||||
from karaoke_gen.lyrics_transcriber.core.controller import LyricsControllerResult
|
||||
from karaoke_gen.lyrics_transcriber.output.generator import OutputGenerator
|
||||
from karaoke_gen.lyrics_transcriber.types import CorrectionResult
|
||||
```
|
||||
|
||||
### Phase 4: Handle Tests from lyrics_transcriber
|
||||
@@ -199,6 +199,6 @@ If issues arise:
|
||||
|
||||
## Notes
|
||||
|
||||
- The import paths like `from lyrics_transcriber.core import ...` will continue to work unchanged
|
||||
- The import paths like `from karaoke_gen.lyrics_transcriber.core import ...` will continue to work unchanged
|
||||
- Only the internal project structure changes, not the API
|
||||
- This is primarily a cleanup/organization task with some external repo admin work
|
||||
+2
-3
@@ -22,10 +22,9 @@ WORKDIR /app
|
||||
COPY backend /app/backend
|
||||
|
||||
# Copy and reinstall karaoke_gen from local source
|
||||
# This ensures new modules (like style_loader.py) are included without rebuilding base image
|
||||
# Note: lyrics_transcriber is vendored in lyrics_transcriber_temp/ and bundled via pyproject.toml
|
||||
# This ensures new modules are included without rebuilding base image
|
||||
# Note: lyrics_transcriber is now a subpackage of karaoke_gen
|
||||
COPY karaoke_gen /app/karaoke_gen
|
||||
COPY lyrics_transcriber_temp /app/lyrics_transcriber_temp
|
||||
COPY pyproject.toml README.md LICENSE /app/
|
||||
RUN pip install --no-cache-dir -e .
|
||||
|
||||
|
||||
@@ -33,9 +33,9 @@ from backend.services.auth_service import UserType
|
||||
from backend.config import get_settings
|
||||
|
||||
# LyricsTranscriber imports for preview generation
|
||||
from lyrics_transcriber.types import CorrectionResult
|
||||
from lyrics_transcriber.core.config import OutputConfig
|
||||
from lyrics_transcriber.correction.operations import CorrectionOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import CorrectionResult
|
||||
from karaoke_gen.lyrics_transcriber.core.config import OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.correction.operations import CorrectionOperations
|
||||
|
||||
# Import from the unified style loader
|
||||
from karaoke_gen.style_loader import load_styles_from_gcs
|
||||
|
||||
@@ -120,7 +120,7 @@ class PackagingService:
|
||||
)
|
||||
|
||||
self.logger.info("Generating CDG and MP3 files")
|
||||
from lyrics_transcriber.output.cdg import CDGGenerator
|
||||
from karaoke_gen.lyrics_transcriber.output.cdg import CDGGenerator
|
||||
|
||||
output_dir = os.path.dirname(output_zip_path) or os.getcwd()
|
||||
generator = CDGGenerator(output_dir=output_dir, logger=self.logger)
|
||||
|
||||
@@ -201,7 +201,7 @@ class TestPackagingServiceCDGPackage:
|
||||
assert result[1] == mp3_file
|
||||
assert result[2] == cdg_file
|
||||
|
||||
@patch("lyrics_transcriber.output.cdg.CDGGenerator")
|
||||
@patch("karaoke_gen.lyrics_transcriber.output.cdg.CDGGenerator")
|
||||
def test_create_cdg_package_with_generator(self, mock_cdg_generator_class):
|
||||
"""Test CDG package creation using CDGGenerator."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
|
||||
@@ -204,7 +204,7 @@ class TestAddLyricsEndpoint:
|
||||
|
||||
def test_add_lyrics_uses_correction_operations(self):
|
||||
"""Verify CorrectionOperations.add_lyrics_source is available."""
|
||||
from lyrics_transcriber.correction.operations import CorrectionOperations
|
||||
from karaoke_gen.lyrics_transcriber.correction.operations import CorrectionOperations
|
||||
|
||||
# The method should exist
|
||||
assert hasattr(CorrectionOperations, 'add_lyrics_source')
|
||||
|
||||
@@ -560,7 +560,7 @@ class TestRenderVideoWorkerCountdownPadding:
|
||||
|
||||
def test_countdown_processor_has_process_method(self):
|
||||
"""Test that CountdownProcessor has the process method (main API)."""
|
||||
from lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
from karaoke_gen.lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
|
||||
countdown_processor = CountdownProcessor(cache_dir="/tmp")
|
||||
assert hasattr(countdown_processor, 'process')
|
||||
@@ -568,7 +568,7 @@ class TestRenderVideoWorkerCountdownPadding:
|
||||
|
||||
def test_countdown_processor_constants(self):
|
||||
"""Test that CountdownProcessor has expected constants."""
|
||||
from lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
from karaoke_gen.lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
|
||||
# Verify the constants exist (these control countdown behavior)
|
||||
assert hasattr(CountdownProcessor, 'COUNTDOWN_TEXT')
|
||||
|
||||
@@ -36,10 +36,10 @@ from backend.workers.worker_logging import create_job_logger, setup_job_logging,
|
||||
from backend.services.tracing import job_span, add_span_event, add_span_attribute
|
||||
|
||||
# Import from lyrics_transcriber (submodule)
|
||||
from lyrics_transcriber.output.generator import OutputGenerator
|
||||
from lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
from lyrics_transcriber.types import CorrectionResult
|
||||
from lyrics_transcriber.core.config import OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.output.generator import OutputGenerator
|
||||
from karaoke_gen.lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
from karaoke_gen.lyrics_transcriber.types import CorrectionResult
|
||||
from karaoke_gen.lyrics_transcriber.core.config import OutputConfig
|
||||
|
||||
# Import from the unified style loader
|
||||
from karaoke_gen.style_loader import load_styles_from_gcs
|
||||
@@ -51,10 +51,10 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
# Loggers to capture for render video worker
|
||||
RENDER_VIDEO_WORKER_LOGGERS = [
|
||||
"lyrics_transcriber.output",
|
||||
"lyrics_transcriber.output.generator",
|
||||
"lyrics_transcriber.output.video",
|
||||
"lyrics_transcriber.output.ass",
|
||||
"karaoke_gen.lyrics_transcriber.output",
|
||||
"karaoke_gen.lyrics_transcriber.output.generator",
|
||||
"karaoke_gen.lyrics_transcriber.output.video",
|
||||
"karaoke_gen.lyrics_transcriber.output.ass",
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class JobLogHandler(logging.Handler):
|
||||
lyrics_logger.addHandler(handler)
|
||||
|
||||
# Also capture logs from lyrics_transcriber package itself
|
||||
lt_logger = logging.getLogger("lyrics_transcriber")
|
||||
lt_logger = logging.getLogger("karaoke_gen.lyrics_transcriber")
|
||||
lt_logger.addHandler(handler)
|
||||
"""
|
||||
|
||||
@@ -235,7 +235,7 @@ def setup_job_logging(job_id: str, worker_name: str, *logger_names: str) -> JobL
|
||||
Args:
|
||||
job_id: Job ID
|
||||
worker_name: Worker name
|
||||
*logger_names: Names of loggers to capture (e.g., "lyrics_transcriber", "karaoke_gen")
|
||||
*logger_names: Names of loggers to capture (e.g., "karaoke_gen.lyrics_transcriber", "karaoke_gen")
|
||||
|
||||
Returns:
|
||||
The JobLogHandler (can be removed later if needed)
|
||||
@@ -246,7 +246,7 @@ def setup_job_logging(job_id: str, worker_name: str, *logger_names: str) -> JobL
|
||||
job_id,
|
||||
"lyrics",
|
||||
"karaoke_gen.lyrics_processor",
|
||||
"lyrics_transcriber", # Capture LyricsTranscriber logs
|
||||
"karaoke_gen.lyrics_transcriber", # Capture LyricsTranscriber logs
|
||||
)
|
||||
|
||||
# IMPORTANT: Use job_logging_context for proper isolation
|
||||
|
||||
+1
-1
@@ -265,7 +265,7 @@ gcloud logging read 'resource.type="cloud_run_revision" "ANCHOR SEARCH: Progress
|
||||
When adding new operations that may need investigation:
|
||||
|
||||
```python
|
||||
from lyrics_transcriber.utils.tracing import create_span, add_span_attribute
|
||||
from karaoke_gen.lyrics_transcriber.utils.tracing import create_span, add_span_attribute
|
||||
|
||||
with create_span("operation_name", {"initial": "attributes"}) as span:
|
||||
# ... do work ...
|
||||
|
||||
@@ -285,7 +285,7 @@ async def process_audio_separation_task(job_id: str):
|
||||
```python
|
||||
# backend/workers/lyrics_worker.py
|
||||
from karaoke_gen.lyrics_processor import LyricsProcessor
|
||||
from lyrics_transcriber.transcriber import LyricsTranscriber
|
||||
from karaoke_gen.lyrics_transcriber.transcriber import LyricsTranscriber
|
||||
import os
|
||||
|
||||
async def process_lyrics_transcription_task(job_id: str):
|
||||
@@ -735,7 +735,7 @@ async def encode_videos_task(job_id: str):
|
||||
**Implementation:**
|
||||
```python
|
||||
# backend/workers/packaging_worker.py
|
||||
from lyrics_transcriber.output.cdg import CDGGenerator
|
||||
from karaoke_gen.lyrics_transcriber.output.cdg import CDGGenerator
|
||||
from lyrics_converter import convert_lrc_to_txt
|
||||
|
||||
async def generate_cdg_package(job_id: str, work_dir: str):
|
||||
|
||||
@@ -246,9 +246,9 @@ import logging
|
||||
import tempfile
|
||||
from typing import Optional
|
||||
|
||||
from lyrics_transcriber.output.generator import OutputGenerator
|
||||
from lyrics_transcriber.correction.corrector import CorrectionResult
|
||||
from lyrics_transcriber.core.config import OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.output.generator import OutputGenerator
|
||||
from karaoke_gen.lyrics_transcriber.correction.corrector import CorrectionResult
|
||||
from karaoke_gen.lyrics_transcriber.core.config import OutputConfig
|
||||
|
||||
from backend.services.job_manager import job_manager
|
||||
from backend.services.storage_service import storage
|
||||
|
||||
@@ -175,8 +175,8 @@ config = LyricsTranscriberConfig(
|
||||
**Key Insight:** Uses `OutputGenerator` from LyricsTranscriber library:
|
||||
|
||||
```python
|
||||
from lyrics_transcriber.output.generator import OutputGenerator
|
||||
from lyrics_transcriber.correction.corrector import CorrectionResult
|
||||
from karaoke_gen.lyrics_transcriber.output.generator import OutputGenerator
|
||||
from karaoke_gen.lyrics_transcriber.correction.corrector import CorrectionResult
|
||||
|
||||
# Load corrected data (from human review)
|
||||
correction_result = CorrectionResult.from_dict(corrections_data)
|
||||
@@ -382,9 +382,9 @@ POST /api/jobs/{job_id}/select-instrumental
|
||||
### Example: Using OutputGenerator
|
||||
|
||||
```python
|
||||
from lyrics_transcriber.output.generator import OutputGenerator
|
||||
from lyrics_transcriber.correction.corrector import CorrectionResult
|
||||
from lyrics_transcriber.core.config import OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.output.generator import OutputGenerator
|
||||
from karaoke_gen.lyrics_transcriber.correction.corrector import CorrectionResult
|
||||
from karaoke_gen.lyrics_transcriber.core.config import OutputConfig
|
||||
|
||||
# 1. Load corrected data from GCS (after human review)
|
||||
corrections_data = download_json_from_gcs(f"jobs/{job_id}/corrections_updated.json")
|
||||
|
||||
@@ -181,7 +181,7 @@ You can also detect from LRC files:
|
||||
To disable countdown for a specific transcription:
|
||||
|
||||
```python
|
||||
from lyrics_transcriber.core.config import OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.core.config import OutputConfig
|
||||
|
||||
output_config = OutputConfig(
|
||||
# ... other options
|
||||
|
||||
@@ -21,7 +21,7 @@ yarn dev # Starts on port 5173
|
||||
|
||||
# Terminal 2: Start LyricsTranscriber backend (for API)
|
||||
# This serves the review API on port 8767
|
||||
poetry run python -c "from lyrics_transcriber.review.server import ReviewServer; ..."
|
||||
poetry run python -c "from karaoke_gen.lyrics_transcriber.review.server import ReviewServer; ..."
|
||||
|
||||
# Terminal 3: Run the test
|
||||
cd frontend
|
||||
|
||||
@@ -19,7 +19,7 @@ import time
|
||||
from google.oauth2.credentials import Credentials
|
||||
import base64
|
||||
from email.mime.text import MIMEText
|
||||
from lyrics_transcriber.output.cdg import CDGGenerator
|
||||
from karaoke_gen.lyrics_transcriber.output.cdg import CDGGenerator
|
||||
from ..utils import sanitize_filename
|
||||
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@ from .video_background_processor import VideoBackgroundProcessor
|
||||
from .audio_fetcher import create_audio_fetcher, AudioFetcherError, NoResultsError, UserCancelledError
|
||||
|
||||
# Import lyrics_transcriber components for post-review countdown and video rendering
|
||||
from lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
from lyrics_transcriber.output.generator import OutputGenerator
|
||||
from lyrics_transcriber.types import CorrectionResult
|
||||
from lyrics_transcriber.core.config import OutputConfig as LyricsOutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
from karaoke_gen.lyrics_transcriber.output.generator import OutputGenerator
|
||||
from karaoke_gen.lyrics_transcriber.types import CorrectionResult
|
||||
from karaoke_gen.lyrics_transcriber.core.config import OutputConfig as LyricsOutputConfig
|
||||
|
||||
|
||||
class KaraokePrep:
|
||||
|
||||
@@ -4,8 +4,8 @@ import logging
|
||||
import shutil
|
||||
import json
|
||||
from typing import Optional
|
||||
from lyrics_transcriber import LyricsTranscriber, OutputConfig, TranscriberConfig, LyricsConfig
|
||||
from lyrics_transcriber.core.controller import LyricsControllerResult
|
||||
from karaoke_gen.lyrics_transcriber import LyricsTranscriber, OutputConfig, TranscriberConfig, LyricsConfig
|
||||
from karaoke_gen.lyrics_transcriber.core.controller import LyricsControllerResult
|
||||
from dotenv import load_dotenv
|
||||
from .utils import sanitize_filename
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from lyrics_transcriber.core.config import TranscriberConfig, LyricsConfig, OutputConfig
|
||||
from lyrics_transcriber.core.controller import LyricsTranscriber
|
||||
from karaoke_gen.lyrics_transcriber.core.config import TranscriberConfig, LyricsConfig, OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.core.controller import LyricsTranscriber
|
||||
from importlib.metadata import version, PackageNotFoundError
|
||||
|
||||
try:
|
||||
File renamed without changes.
+2
-2
@@ -11,8 +11,8 @@ from typing import Dict
|
||||
from importlib.metadata import version
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from lyrics_transcriber import LyricsTranscriber
|
||||
from lyrics_transcriber.core.controller import TranscriberConfig, LyricsConfig, OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber import LyricsTranscriber
|
||||
from karaoke_gen.lyrics_transcriber.core.controller import TranscriberConfig, LyricsConfig, OutputConfig
|
||||
|
||||
|
||||
def create_arg_parser() -> argparse.ArgumentParser:
|
||||
File renamed without changes.
File renamed without changes.
+18
-18
@@ -3,20 +3,20 @@ import logging
|
||||
import json
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Dict, Optional, List
|
||||
from lyrics_transcriber.types import LyricsData, TranscriptionResult, CorrectionResult
|
||||
from lyrics_transcriber.transcribers.base_transcriber import BaseTranscriber
|
||||
from lyrics_transcriber.transcribers.audioshake import AudioShakeTranscriber, AudioShakeConfig
|
||||
from lyrics_transcriber.transcribers.whisper import WhisperTranscriber, WhisperConfig
|
||||
from lyrics_transcriber.transcribers.local_whisper import LocalWhisperTranscriber, LocalWhisperConfig
|
||||
from lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
from lyrics_transcriber.lyrics.genius import GeniusProvider
|
||||
from lyrics_transcriber.lyrics.spotify import SpotifyProvider
|
||||
from lyrics_transcriber.lyrics.musixmatch import MusixmatchProvider
|
||||
from lyrics_transcriber.lyrics.lrclib import LRCLIBProvider
|
||||
from lyrics_transcriber.output.generator import OutputGenerator
|
||||
from lyrics_transcriber.correction.corrector import LyricsCorrector
|
||||
from lyrics_transcriber.core.config import TranscriberConfig, LyricsConfig, OutputConfig
|
||||
from lyrics_transcriber.lyrics.file_provider import FileProvider
|
||||
from karaoke_gen.lyrics_transcriber.types import LyricsData, TranscriptionResult, CorrectionResult
|
||||
from karaoke_gen.lyrics_transcriber.transcribers.base_transcriber import BaseTranscriber
|
||||
from karaoke_gen.lyrics_transcriber.transcribers.audioshake import AudioShakeTranscriber, AudioShakeConfig
|
||||
from karaoke_gen.lyrics_transcriber.transcribers.whisper import WhisperTranscriber, WhisperConfig
|
||||
from karaoke_gen.lyrics_transcriber.transcribers.local_whisper import LocalWhisperTranscriber, LocalWhisperConfig
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.genius import GeniusProvider
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.spotify import SpotifyProvider
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.musixmatch import MusixmatchProvider
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.lrclib import LRCLIBProvider
|
||||
from karaoke_gen.lyrics_transcriber.output.generator import OutputGenerator
|
||||
from karaoke_gen.lyrics_transcriber.correction.corrector import LyricsCorrector
|
||||
from karaoke_gen.lyrics_transcriber.core.config import TranscriberConfig, LyricsConfig, OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.file_provider import FileProvider
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -301,7 +301,7 @@ class LyricsTranscriber:
|
||||
|
||||
# Debug: Log package version and environment variables
|
||||
try:
|
||||
import lyrics_transcriber
|
||||
from karaoke_gen import lyrics_transcriber
|
||||
package_version = getattr(lyrics_transcriber, '__version__', 'unknown')
|
||||
self.logger.info(f"LyricsTranscriber package version: {package_version}")
|
||||
except Exception as e:
|
||||
@@ -345,7 +345,7 @@ class LyricsTranscriber:
|
||||
# This is important because the video needs to use padded audio to sync
|
||||
# with the countdown-adjusted timestamps in the ASS subtitles
|
||||
if self.output_config.add_countdown:
|
||||
from lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
from karaoke_gen.lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
|
||||
countdown_processor = CountdownProcessor(
|
||||
cache_dir=self.output_config.cache_dir,
|
||||
@@ -572,7 +572,7 @@ class LyricsTranscriber:
|
||||
|
||||
# Add human review step (moved outside the else block)
|
||||
if self.output_config.enable_review:
|
||||
from lyrics_transcriber.review.server import ReviewServer
|
||||
from karaoke_gen.lyrics_transcriber.review.server import ReviewServer
|
||||
|
||||
self.logger.info("Starting human review process")
|
||||
|
||||
@@ -590,7 +590,7 @@ class LyricsTranscriber:
|
||||
|
||||
# Add countdown intro if enabled and needed (after review, before output generation)
|
||||
if self.output_config.add_countdown and self.results.transcription_corrected:
|
||||
from lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
from karaoke_gen.lyrics_transcriber.output.countdown_processor import CountdownProcessor
|
||||
|
||||
self.logger.info("Processing countdown intro (if needed)")
|
||||
countdown_processor = CountdownProcessor(
|
||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -3,8 +3,8 @@ from __future__ import annotations
|
||||
from typing import Dict, Any, List
|
||||
|
||||
from .models.schemas import CorrectionProposal
|
||||
from lyrics_transcriber.types import WordCorrection, Word
|
||||
from lyrics_transcriber.utils.word_utils import WordUtils
|
||||
from karaoke_gen.lyrics_transcriber.types import WordCorrection, Word
|
||||
from karaoke_gen.lyrics_transcriber.utils.word_utils import WordUtils
|
||||
|
||||
|
||||
def adapt_proposals_to_word_corrections(
|
||||
+1
-1
@@ -13,7 +13,7 @@ from .models.schemas import CorrectionProposal, GapClassification, GapCategory
|
||||
from .workflows.correction_graph import build_correction_graph
|
||||
from .prompts.classifier import build_classification_prompt
|
||||
from .handlers.registry import HandlerRegistry
|
||||
from lyrics_transcriber.utils.tracing import create_span, add_span_attribute
|
||||
from karaoke_gen.lyrics_transcriber.utils.tracing import create_span, add_span_attribute
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+8
-8
@@ -9,12 +9,12 @@ import json
|
||||
import hashlib
|
||||
|
||||
# Tracing utilities (optional - gracefully handles missing dependency)
|
||||
from lyrics_transcriber.utils.tracing import create_span, add_span_attribute, add_span_event
|
||||
from karaoke_gen.lyrics_transcriber.utils.tracing import create_span, add_span_attribute, add_span_event
|
||||
|
||||
from lyrics_transcriber.types import LyricsData, PhraseScore, PhraseType, AnchorSequence, GapSequence, ScoredAnchor, TranscriptionResult, Word
|
||||
from lyrics_transcriber.correction.phrase_analyzer import PhraseAnalyzer
|
||||
from lyrics_transcriber.correction.text_utils import clean_text
|
||||
from lyrics_transcriber.utils.word_utils import WordUtils
|
||||
from karaoke_gen.lyrics_transcriber.types import LyricsData, PhraseScore, PhraseType, AnchorSequence, GapSequence, ScoredAnchor, TranscriptionResult, Word
|
||||
from karaoke_gen.lyrics_transcriber.correction.phrase_analyzer import PhraseAnalyzer
|
||||
from karaoke_gen.lyrics_transcriber.correction.text_utils import clean_text
|
||||
from karaoke_gen.lyrics_transcriber.utils.word_utils import WordUtils
|
||||
|
||||
|
||||
class AnchorSequenceTimeoutError(Exception):
|
||||
@@ -724,8 +724,8 @@ class AnchorSequenceFinder:
|
||||
# This can happen in tests using backwards compatible constructors
|
||||
# Create dummy Word objects with the text from _words if available
|
||||
if hasattr(anchor, '_words') and anchor._words is not None:
|
||||
from lyrics_transcriber.types import Word
|
||||
from lyrics_transcriber.utils.word_utils import WordUtils
|
||||
from karaoke_gen.lyrics_transcriber.types import Word
|
||||
from karaoke_gen.lyrics_transcriber.utils.word_utils import WordUtils
|
||||
anchor.transcribed_words = [
|
||||
Word(
|
||||
id=word_id,
|
||||
@@ -738,7 +738,7 @@ class AnchorSequenceFinder:
|
||||
]
|
||||
else:
|
||||
# Create generic word objects for scoring
|
||||
from lyrics_transcriber.types import Word
|
||||
from karaoke_gen.lyrics_transcriber.types import Word
|
||||
anchor.transcribed_words = [
|
||||
Word(
|
||||
id=word_id,
|
||||
+17
-17
@@ -6,14 +6,14 @@ import os
|
||||
import shortuuid
|
||||
import time
|
||||
|
||||
from lyrics_transcriber.correction.handlers.levenshtein import LevenshteinHandler
|
||||
from lyrics_transcriber.correction.handlers.no_space_punct_match import NoSpacePunctuationMatchHandler
|
||||
from lyrics_transcriber.correction.handlers.relaxed_word_count_match import RelaxedWordCountMatchHandler
|
||||
from lyrics_transcriber.correction.handlers.repeat import RepeatCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.sound_alike import SoundAlikeHandler
|
||||
from lyrics_transcriber.correction.handlers.syllables_match import SyllablesMatchHandler
|
||||
from lyrics_transcriber.correction.handlers.word_count_match import WordCountMatchHandler
|
||||
from lyrics_transcriber.types import (
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.levenshtein import LevenshteinHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.no_space_punct_match import NoSpacePunctuationMatchHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.relaxed_word_count_match import RelaxedWordCountMatchHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.repeat import RepeatCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.sound_alike import SoundAlikeHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.syllables_match import SyllablesMatchHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_count_match import WordCountMatchHandler
|
||||
from karaoke_gen.lyrics_transcriber.types import (
|
||||
CorrectionStep,
|
||||
GapSequence,
|
||||
LyricsData,
|
||||
@@ -23,11 +23,11 @@ from lyrics_transcriber.types import (
|
||||
WordCorrection,
|
||||
Word,
|
||||
)
|
||||
from lyrics_transcriber.correction.anchor_sequence import AnchorSequenceFinder
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.extend_anchor import ExtendAnchorHandler
|
||||
from lyrics_transcriber.utils.word_utils import WordUtils
|
||||
from lyrics_transcriber.utils.tracing import create_span, add_span_attribute, add_span_event
|
||||
from karaoke_gen.lyrics_transcriber.correction.anchor_sequence import AnchorSequenceFinder
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.extend_anchor import ExtendAnchorHandler
|
||||
from karaoke_gen.lyrics_transcriber.utils.word_utils import WordUtils
|
||||
from karaoke_gen.lyrics_transcriber.utils.tracing import create_span, add_span_attribute, add_span_event
|
||||
|
||||
|
||||
class LyricsCorrector:
|
||||
@@ -299,9 +299,9 @@ class LyricsCorrector:
|
||||
|
||||
if use_agentic_env:
|
||||
try:
|
||||
from lyrics_transcriber.correction.agentic.agent import AgenticCorrector as _AgenticCorrector
|
||||
from lyrics_transcriber.correction.agentic.adapter import adapt_proposals_to_word_corrections as _adapt
|
||||
from lyrics_transcriber.correction.agentic.router import ModelRouter as _ModelRouter
|
||||
from karaoke_gen.lyrics_transcriber.correction.agentic.agent import AgenticCorrector as _AgenticCorrector
|
||||
from karaoke_gen.lyrics_transcriber.correction.agentic.adapter import adapt_proposals_to_word_corrections as _adapt
|
||||
from karaoke_gen.lyrics_transcriber.correction.agentic.router import ModelRouter as _ModelRouter
|
||||
self.logger.info("🤖 Agentic modules imported successfully - running in AGENTIC-ONLY mode")
|
||||
|
||||
# Create agent ONCE and reuse for all gaps (avoids repeated model initialization)
|
||||
@@ -486,7 +486,7 @@ class LyricsCorrector:
|
||||
# AGENTIC-ONLY MODE: Process all gaps in parallel for better performance
|
||||
if use_agentic_env:
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from lyrics_transcriber.correction.agentic.providers.config import ProviderConfig
|
||||
from karaoke_gen.lyrics_transcriber.correction.agentic.providers.config import ProviderConfig
|
||||
|
||||
# Get parallel processing config
|
||||
_config = ProviderConfig.from_env()
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -2,7 +2,7 @@ from abc import ABC, abstractmethod
|
||||
from typing import List, Optional, Tuple, Dict, Any
|
||||
import logging
|
||||
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
|
||||
|
||||
class GapCorrectionHandler(ABC):
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
from typing import List, Optional, Tuple, Dict, Any
|
||||
import logging
|
||||
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection, Word
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection, Word
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
|
||||
|
||||
class ExtendAnchorHandler(GapCorrectionHandler):
|
||||
+3
-3
@@ -3,9 +3,9 @@ import string
|
||||
import Levenshtein
|
||||
import logging
|
||||
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
|
||||
|
||||
class LevenshteinHandler(GapCorrectionHandler):
|
||||
+3
-3
@@ -2,9 +2,9 @@ from typing import List, Optional, Tuple, Dict, Any
|
||||
import logging
|
||||
import re
|
||||
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
|
||||
|
||||
class NoSpacePunctuationMatchHandler(GapCorrectionHandler):
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
from typing import List, Tuple, Dict, Any, Optional
|
||||
import logging
|
||||
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
|
||||
|
||||
class RelaxedWordCountMatchHandler(GapCorrectionHandler):
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
from typing import List, Dict, Optional, Tuple, Any
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
import logging
|
||||
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
from typing import List, Dict, Tuple, Optional, Any
|
||||
import logging
|
||||
from metaphone import doublemetaphone
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
|
||||
|
||||
class SoundAlikeHandler(GapCorrectionHandler):
|
||||
+3
-3
@@ -8,9 +8,9 @@ from nltk.corpus import cmudict
|
||||
import syllables
|
||||
from spacy_syllables import SpacySyllables
|
||||
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
|
||||
# Try to import preloaders (may not exist in standalone library usage)
|
||||
try:
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
from typing import List, Tuple, Dict, Any, Optional
|
||||
import logging
|
||||
|
||||
from lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
from karaoke_gen.lyrics_transcriber.types import GapSequence, WordCorrection
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.base import GapCorrectionHandler
|
||||
from karaoke_gen.lyrics_transcriber.correction.handlers.word_operations import WordOperations
|
||||
|
||||
|
||||
class WordCountMatchHandler(GapCorrectionHandler):
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
from typing import List, Optional, Dict, Any
|
||||
from lyrics_transcriber.types import WordCorrection, GapSequence
|
||||
from lyrics_transcriber.utils.word_utils import WordUtils
|
||||
from karaoke_gen.lyrics_transcriber.types import WordCorrection, GapSequence
|
||||
from karaoke_gen.lyrics_transcriber.utils.word_utils import WordUtils
|
||||
|
||||
|
||||
class WordOperations:
|
||||
+5
-5
@@ -17,7 +17,7 @@ import logging
|
||||
from typing import Dict, Any, List, Optional
|
||||
from pathlib import Path
|
||||
|
||||
from lyrics_transcriber.types import (
|
||||
from karaoke_gen.lyrics_transcriber.types import (
|
||||
CorrectionResult,
|
||||
WordCorrection,
|
||||
LyricsSegment,
|
||||
@@ -26,10 +26,10 @@ from lyrics_transcriber.types import (
|
||||
TranscriptionData,
|
||||
LyricsData
|
||||
)
|
||||
from lyrics_transcriber.correction.corrector import LyricsCorrector
|
||||
from lyrics_transcriber.lyrics.user_input_provider import UserInputProvider
|
||||
from lyrics_transcriber.output.generator import OutputGenerator
|
||||
from lyrics_transcriber.core.config import OutputConfig
|
||||
from karaoke_gen.lyrics_transcriber.correction.corrector import LyricsCorrector
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.user_input_provider import UserInputProvider
|
||||
from karaoke_gen.lyrics_transcriber.output.generator import OutputGenerator
|
||||
from karaoke_gen.lyrics_transcriber.core.config import OutputConfig
|
||||
|
||||
|
||||
class CorrectionOperations:
|
||||
+2
-2
@@ -2,8 +2,8 @@ from typing import List
|
||||
import spacy
|
||||
from spacy.tokens import Doc
|
||||
import logging
|
||||
from lyrics_transcriber.correction.text_utils import clean_text
|
||||
from lyrics_transcriber.types import PhraseType, PhraseScore
|
||||
from karaoke_gen.lyrics_transcriber.correction.text_utils import clean_text
|
||||
from karaoke_gen.lyrics_transcriber.types import PhraseType, PhraseScore
|
||||
|
||||
# Try to import preloader (may not exist in standalone library usage)
|
||||
try:
|
||||
File renamed without changes.
File renamed without changes.
+2
-2
@@ -6,9 +6,9 @@ import hashlib
|
||||
from pathlib import Path
|
||||
import os
|
||||
from abc import ABC, abstractmethod
|
||||
from lyrics_transcriber.types import LyricsData, LyricsSegment, Word
|
||||
from karaoke_gen.lyrics_transcriber.types import LyricsData, LyricsSegment, Word
|
||||
from karaoke_lyrics_processor import KaraokeLyricsProcessor
|
||||
from lyrics_transcriber.utils.word_utils import WordUtils
|
||||
from karaoke_gen.lyrics_transcriber.utils.word_utils import WordUtils
|
||||
|
||||
|
||||
@dataclass
|
||||
+1
-1
@@ -2,7 +2,7 @@ from pathlib import Path
|
||||
import logging
|
||||
from typing import Optional, Dict, Any
|
||||
from .base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
from lyrics_transcriber.types import LyricsData, LyricsMetadata
|
||||
from karaoke_gen.lyrics_transcriber.types import LyricsData, LyricsMetadata
|
||||
from karaoke_lyrics_processor import KaraokeLyricsProcessor
|
||||
|
||||
|
||||
+2
-2
@@ -3,8 +3,8 @@ import re
|
||||
from typing import Optional, Dict, Any
|
||||
import requests
|
||||
import lyricsgenius
|
||||
from lyrics_transcriber.types import LyricsData, LyricsMetadata
|
||||
from lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
from karaoke_gen.lyrics_transcriber.types import LyricsData, LyricsMetadata
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
|
||||
|
||||
class GeniusProvider(BaseLyricsProvider):
|
||||
+3
-3
@@ -2,9 +2,9 @@ import logging
|
||||
import re
|
||||
from typing import Optional, Dict, Any, List
|
||||
import requests
|
||||
from lyrics_transcriber.types import LyricsData, LyricsMetadata, LyricsSegment, Word
|
||||
from lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
from lyrics_transcriber.utils.word_utils import WordUtils
|
||||
from karaoke_gen.lyrics_transcriber.types import LyricsData, LyricsMetadata, LyricsSegment, Word
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
from karaoke_gen.lyrics_transcriber.utils.word_utils import WordUtils
|
||||
|
||||
|
||||
class LRCLIBProvider(BaseLyricsProvider):
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import logging
|
||||
from typing import Optional, Dict, Any
|
||||
import requests
|
||||
from lyrics_transcriber.types import LyricsData, LyricsMetadata
|
||||
from lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
from karaoke_gen.lyrics_transcriber.types import LyricsData, LyricsMetadata
|
||||
from karaoke_gen.lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
||||
|
||||
|
||||
class MusixmatchProvider(BaseLyricsProvider):
|
||||
Loaded 100 of 176 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user