lyrics-transcriber 0.30.1__py3-none-any.whl → 0.32.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lyrics_transcriber/__init__.py +2 -1
- lyrics_transcriber/cli/cli_main.py +33 -12
- lyrics_transcriber/core/config.py +35 -0
- lyrics_transcriber/core/controller.py +85 -121
- lyrics_transcriber/correction/anchor_sequence.py +471 -0
- lyrics_transcriber/correction/corrector.py +237 -33
- lyrics_transcriber/correction/handlers/__init__.py +0 -0
- lyrics_transcriber/correction/handlers/base.py +30 -0
- lyrics_transcriber/correction/handlers/extend_anchor.py +91 -0
- lyrics_transcriber/correction/handlers/levenshtein.py +147 -0
- lyrics_transcriber/correction/handlers/no_space_punct_match.py +98 -0
- lyrics_transcriber/correction/handlers/relaxed_word_count_match.py +55 -0
- lyrics_transcriber/correction/handlers/repeat.py +71 -0
- lyrics_transcriber/correction/handlers/sound_alike.py +223 -0
- lyrics_transcriber/correction/handlers/syllables_match.py +182 -0
- lyrics_transcriber/correction/handlers/word_count_match.py +54 -0
- lyrics_transcriber/correction/handlers/word_operations.py +135 -0
- lyrics_transcriber/correction/phrase_analyzer.py +426 -0
- lyrics_transcriber/correction/text_utils.py +30 -0
- lyrics_transcriber/lyrics/base_lyrics_provider.py +5 -81
- lyrics_transcriber/lyrics/genius.py +5 -2
- lyrics_transcriber/lyrics/spotify.py +3 -3
- lyrics_transcriber/output/ass/__init__.py +21 -0
- lyrics_transcriber/output/{ass.py → ass/ass.py} +150 -690
- lyrics_transcriber/output/ass/ass_specs.txt +732 -0
- lyrics_transcriber/output/ass/config.py +37 -0
- lyrics_transcriber/output/ass/constants.py +23 -0
- lyrics_transcriber/output/ass/event.py +94 -0
- lyrics_transcriber/output/ass/formatters.py +132 -0
- lyrics_transcriber/output/ass/lyrics_line.py +219 -0
- lyrics_transcriber/output/ass/lyrics_screen.py +252 -0
- lyrics_transcriber/output/ass/section_detector.py +89 -0
- lyrics_transcriber/output/ass/section_screen.py +106 -0
- lyrics_transcriber/output/ass/style.py +187 -0
- lyrics_transcriber/output/cdg.py +503 -0
- lyrics_transcriber/output/cdgmaker/__init__.py +0 -0
- lyrics_transcriber/output/cdgmaker/cdg.py +262 -0
- lyrics_transcriber/output/cdgmaker/composer.py +1919 -0
- lyrics_transcriber/output/cdgmaker/config.py +151 -0
- lyrics_transcriber/output/cdgmaker/images/instrumental.png +0 -0
- lyrics_transcriber/output/cdgmaker/images/intro.png +0 -0
- lyrics_transcriber/output/cdgmaker/pack.py +507 -0
- lyrics_transcriber/output/cdgmaker/render.py +346 -0
- lyrics_transcriber/output/cdgmaker/transitions/centertexttoplogobottomtext.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/circlein.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/circleout.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/fizzle.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/largecentertexttoplogo.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/rectangle.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/spiral.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/topleftmusicalnotes.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/wipein.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/wipeleft.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/wipeout.png +0 -0
- lyrics_transcriber/output/cdgmaker/transitions/wiperight.png +0 -0
- lyrics_transcriber/output/cdgmaker/utils.py +132 -0
- lyrics_transcriber/output/fonts/AvenirNext-Bold.ttf +0 -0
- lyrics_transcriber/output/fonts/DMSans-VariableFont_opsz,wght.ttf +0 -0
- lyrics_transcriber/output/fonts/DMSerifDisplay-Regular.ttf +0 -0
- lyrics_transcriber/output/fonts/Oswald-SemiBold.ttf +0 -0
- lyrics_transcriber/output/fonts/Zurich_Cn_BT_Bold.ttf +0 -0
- lyrics_transcriber/output/fonts/arial.ttf +0 -0
- lyrics_transcriber/output/fonts/georgia.ttf +0 -0
- lyrics_transcriber/output/fonts/verdana.ttf +0 -0
- lyrics_transcriber/output/generator.py +101 -193
- lyrics_transcriber/output/lyrics_file.py +102 -0
- lyrics_transcriber/output/plain_text.py +91 -0
- lyrics_transcriber/output/segment_resizer.py +416 -0
- lyrics_transcriber/output/subtitles.py +328 -302
- lyrics_transcriber/output/video.py +219 -0
- lyrics_transcriber/review/__init__.py +1 -0
- lyrics_transcriber/review/server.py +138 -0
- lyrics_transcriber/transcribers/audioshake.py +3 -2
- lyrics_transcriber/transcribers/base_transcriber.py +5 -42
- lyrics_transcriber/transcribers/whisper.py +3 -4
- lyrics_transcriber/types.py +454 -0
- {lyrics_transcriber-0.30.1.dist-info → lyrics_transcriber-0.32.1.dist-info}/METADATA +14 -3
- lyrics_transcriber-0.32.1.dist-info/RECORD +86 -0
- {lyrics_transcriber-0.30.1.dist-info → lyrics_transcriber-0.32.1.dist-info}/WHEEL +1 -1
- {lyrics_transcriber-0.30.1.dist-info → lyrics_transcriber-0.32.1.dist-info}/entry_points.txt +1 -0
- lyrics_transcriber/correction/base_strategy.py +0 -29
- lyrics_transcriber/correction/strategy_diff.py +0 -263
- lyrics_transcriber-0.30.1.dist-info/RECORD +0 -25
- {lyrics_transcriber-0.30.1.dist-info → lyrics_transcriber-0.32.1.dist-info}/LICENSE +0 -0
@@ -1,48 +1,12 @@
|
|
1
|
-
from dataclasses import dataclass
|
1
|
+
from dataclasses import dataclass
|
2
2
|
import logging
|
3
|
-
from typing import Optional, Dict, Any
|
3
|
+
from typing import Optional, Dict, Any
|
4
4
|
import json
|
5
5
|
import hashlib
|
6
6
|
from pathlib import Path
|
7
7
|
import os
|
8
8
|
from abc import ABC, abstractmethod
|
9
|
-
|
10
|
-
|
11
|
-
@dataclass
|
12
|
-
class Word:
|
13
|
-
"""Represents a single word with its timing and confidence information."""
|
14
|
-
|
15
|
-
text: str
|
16
|
-
start_time: float
|
17
|
-
end_time: float
|
18
|
-
confidence: Optional[float] = None
|
19
|
-
|
20
|
-
def to_dict(self) -> Dict[str, Any]:
|
21
|
-
"""Convert Word to dictionary for JSON serialization."""
|
22
|
-
d = asdict(self)
|
23
|
-
# Remove confidence from output if it's None
|
24
|
-
if d["confidence"] is None:
|
25
|
-
del d["confidence"]
|
26
|
-
return d
|
27
|
-
|
28
|
-
|
29
|
-
@dataclass
|
30
|
-
class LyricsSegment:
|
31
|
-
"""Represents a segment/line of lyrics with timing information."""
|
32
|
-
|
33
|
-
text: str
|
34
|
-
words: List[Word]
|
35
|
-
start_time: float
|
36
|
-
end_time: float
|
37
|
-
|
38
|
-
def to_dict(self) -> Dict[str, Any]:
|
39
|
-
"""Convert LyricsSegment to dictionary for JSON serialization."""
|
40
|
-
return {
|
41
|
-
"text": self.text,
|
42
|
-
"words": [word.to_dict() for word in self.words],
|
43
|
-
"start_time": self.start_time,
|
44
|
-
"end_time": self.end_time,
|
45
|
-
}
|
9
|
+
from lyrics_transcriber.types import LyricsData
|
46
10
|
|
47
11
|
|
48
12
|
@dataclass
|
@@ -55,46 +19,6 @@ class LyricsProviderConfig:
|
|
55
19
|
audio_filepath: Optional[str] = None
|
56
20
|
|
57
21
|
|
58
|
-
@dataclass
|
59
|
-
class LyricsMetadata:
|
60
|
-
"""Standardized metadata for lyrics results."""
|
61
|
-
|
62
|
-
source: str
|
63
|
-
track_name: str
|
64
|
-
artist_names: str
|
65
|
-
|
66
|
-
# Common metadata fields
|
67
|
-
album_name: Optional[str] = None
|
68
|
-
duration_ms: Optional[int] = None
|
69
|
-
explicit: Optional[bool] = None
|
70
|
-
language: Optional[str] = None
|
71
|
-
is_synced: bool = False
|
72
|
-
|
73
|
-
# Lyrics provider details
|
74
|
-
lyrics_provider: Optional[str] = None
|
75
|
-
lyrics_provider_id: Optional[str] = None
|
76
|
-
|
77
|
-
# Provider-specific metadata
|
78
|
-
provider_metadata: Dict[str, Any] = None
|
79
|
-
|
80
|
-
def to_dict(self) -> Dict[str, Any]:
|
81
|
-
"""Convert metadata to dictionary for JSON serialization."""
|
82
|
-
return asdict(self)
|
83
|
-
|
84
|
-
|
85
|
-
@dataclass
|
86
|
-
class LyricsData:
|
87
|
-
"""Standardized response format for all lyrics providers."""
|
88
|
-
|
89
|
-
lyrics: str
|
90
|
-
segments: List[LyricsSegment]
|
91
|
-
metadata: LyricsMetadata
|
92
|
-
|
93
|
-
def to_dict(self) -> Dict[str, Any]:
|
94
|
-
"""Convert result to dictionary for JSON serialization."""
|
95
|
-
return {"lyrics": self.lyrics, "segments": [segment.to_dict() for segment in self.segments], "metadata": self.metadata.to_dict()}
|
96
|
-
|
97
|
-
|
98
22
|
class BaseLyricsProvider(ABC):
|
99
23
|
"""Base class for lyrics providers."""
|
100
24
|
|
@@ -189,12 +113,12 @@ class BaseLyricsProvider(ABC):
|
|
189
113
|
@abstractmethod
|
190
114
|
def _fetch_data_from_source(self, artist: str, title: str) -> Optional[Dict[str, Any]]:
|
191
115
|
"""Fetch raw data from the source (implemented by subclasses)."""
|
192
|
-
raise NotImplementedError("Subclasses must implement _fetch_data_from_source")
|
116
|
+
raise NotImplementedError("Subclasses must implement _fetch_data_from_source") # pragma: no cover
|
193
117
|
|
194
118
|
@abstractmethod
|
195
119
|
def _convert_result_format(self, raw_data: Dict[str, Any]) -> LyricsData:
|
196
120
|
"""Convert raw API response to standardized format (implemented by subclasses)."""
|
197
|
-
raise NotImplementedError("Subclasses must implement _convert_result_format")
|
121
|
+
raise NotImplementedError("Subclasses must implement _convert_result_format") # pragma: no cover
|
198
122
|
|
199
123
|
def get_name(self) -> str:
|
200
124
|
"""Return the name of this lyrics provider."""
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import logging
|
2
2
|
from typing import Optional, Dict, Any
|
3
3
|
import lyricsgenius
|
4
|
-
from .
|
4
|
+
from lyrics_transcriber.types import LyricsData, LyricsMetadata
|
5
|
+
from lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
5
6
|
|
6
7
|
|
7
8
|
class GeniusProvider(BaseLyricsProvider):
|
@@ -67,4 +68,6 @@ class GeniusProvider(BaseLyricsProvider):
|
|
67
68
|
)
|
68
69
|
|
69
70
|
# Create result object
|
70
|
-
return LyricsData(
|
71
|
+
return LyricsData(
|
72
|
+
source="genius", lyrics=raw_data.get("lyrics", ""), segments=[], metadata=metadata
|
73
|
+
) # Genius doesn't provide timestamp data
|
@@ -2,8 +2,8 @@ import logging
|
|
2
2
|
from typing import Optional, Dict, Any
|
3
3
|
import syrics.api
|
4
4
|
|
5
|
-
from lyrics_transcriber.
|
6
|
-
from .base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
5
|
+
from lyrics_transcriber.types import LyricsData, LyricsMetadata, LyricsSegment
|
6
|
+
from lyrics_transcriber.lyrics.base_lyrics_provider import BaseLyricsProvider, LyricsProviderConfig
|
7
7
|
|
8
8
|
|
9
9
|
class SpotifyProvider(BaseLyricsProvider):
|
@@ -79,4 +79,4 @@ class SpotifyProvider(BaseLyricsProvider):
|
|
79
79
|
},
|
80
80
|
)
|
81
81
|
|
82
|
-
return LyricsData(lyrics="\n".join(segment.text for segment in segments), segments=segments, metadata=metadata)
|
82
|
+
return LyricsData(source="spotify", lyrics="\n".join(segment.text for segment in segments), segments=segments, metadata=metadata)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
from lyrics_transcriber.output.ass.lyrics_screen import LyricsScreen
|
2
|
+
from lyrics_transcriber.output.ass.lyrics_line import LyricsLine
|
3
|
+
from lyrics_transcriber.output.ass.section_screen import SectionScreen
|
4
|
+
from lyrics_transcriber.output.ass.style import Style
|
5
|
+
from lyrics_transcriber.output.ass.event import Event
|
6
|
+
from lyrics_transcriber.output.ass.config import (
|
7
|
+
ScreenConfig,
|
8
|
+
LineTimingInfo,
|
9
|
+
LineState,
|
10
|
+
)
|
11
|
+
|
12
|
+
__all__ = [
|
13
|
+
'LyricsScreen',
|
14
|
+
'LyricsLine',
|
15
|
+
'SectionScreen',
|
16
|
+
'Style',
|
17
|
+
'Event',
|
18
|
+
'ScreenConfig',
|
19
|
+
'LineTimingInfo',
|
20
|
+
'LineState',
|
21
|
+
]
|