mirror of
https://github.com/denizsafak/abogen.git
synced 2026-09-20 11:40:57 +02:00
refactor: remove infrastructure enum duplicates
- SubtitleFormat/SubtitleMode now only in domain/enums.py - Added VTT to SubtitleFormat - Renamed SENTENCE_HIGHLIGHTING → SENTENCE_HIGHLIGHT for consistency - Infrastructure subtitle_writer imports from domain
This commit is contained in:
@@ -18,7 +18,7 @@ class SubtitleMode(str, Enum):
|
|||||||
LINE = "Line"
|
LINE = "Line"
|
||||||
SENTENCE = "Sentence"
|
SENTENCE = "Sentence"
|
||||||
SENTENCE_COMMA = "Sentence + Comma"
|
SENTENCE_COMMA = "Sentence + Comma"
|
||||||
SENTENCE_HIGHLIGHTING = "Sentence + Highlighting"
|
SENTENCE_HIGHLIGHT = "Sentence + Highlighting"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_str(cls, value: str) -> SubtitleMode:
|
def from_str(cls, value: str) -> SubtitleMode:
|
||||||
@@ -71,6 +71,7 @@ class SubtitleFormat(str, Enum):
|
|||||||
"""Subtitle file format."""
|
"""Subtitle file format."""
|
||||||
SRT = "srt"
|
SRT = "srt"
|
||||||
ASS = "ass"
|
ASS = "ass"
|
||||||
|
VTT = "vtt"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dot_ext(self) -> str:
|
def dot_ext(self) -> str:
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ def process_subtitle_tokens(
|
|||||||
and subtitle_mode in [SubtitleMode.SENTENCE, SubtitleMode.SENTENCE_COMMA]
|
and subtitle_mode in [SubtitleMode.SENTENCE, SubtitleMode.SENTENCE_COMMA]
|
||||||
)
|
)
|
||||||
|
|
||||||
if subtitle_mode == SubtitleMode.SENTENCE_HIGHLIGHTING:
|
if subtitle_mode == SubtitleMode.SENTENCE_HIGHLIGHT:
|
||||||
_process_karaoke_highlighting(
|
_process_karaoke_highlighting(
|
||||||
processed_tokens, subtitle_entries, max_subtitle_words, fallback_end_time
|
processed_tokens, subtitle_entries, max_subtitle_words, fallback_end_time
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,23 +6,10 @@ from enum import Enum
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List, Optional, TextIO
|
from typing import List, Optional, TextIO
|
||||||
|
|
||||||
|
from abogen.domain.enums import SubtitleFormat, SubtitleMode
|
||||||
from abogen.subtitle_utils import clean_subtitle_text
|
from abogen.subtitle_utils import clean_subtitle_text
|
||||||
|
|
||||||
|
|
||||||
class SubtitleFormat(Enum):
|
|
||||||
SRT = "srt"
|
|
||||||
ASS = "ass"
|
|
||||||
VTT = "vtt"
|
|
||||||
|
|
||||||
|
|
||||||
class SubtitleMode(Enum):
|
|
||||||
DISABLED = "Disabled"
|
|
||||||
LINE = "Line"
|
|
||||||
SENTENCE = "Sentence"
|
|
||||||
SENTENCE_COMMA = "Sentence + Comma"
|
|
||||||
SENTENCE_HIGHLIGHT = "Sentence + Highlighting"
|
|
||||||
|
|
||||||
|
|
||||||
class SubtitleAlignment(Enum):
|
class SubtitleAlignment(Enum):
|
||||||
LEFT = "left"
|
LEFT = "left"
|
||||||
CENTER = "center"
|
CENTER = "center"
|
||||||
|
|||||||
Reference in New Issue
Block a user