mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
Add Line option for subtitle generation
This commit is contained in:
@@ -1246,9 +1246,14 @@ class ConversionThread(QThread):
|
|||||||
if end is None or end <= start or end <= 0:
|
if end is None or end <= start or end <= 0:
|
||||||
subtitle_entries[-1] = (start, fallback_end_time, text)
|
subtitle_entries[-1] = (start, fallback_end_time, text)
|
||||||
|
|
||||||
elif self.subtitle_mode == "Sentence" or self.subtitle_mode == "Sentence + Comma":
|
elif self.subtitle_mode in ["Sentence", "Sentence + Comma", "Line"]:
|
||||||
# Define separator pattern based on mode
|
# Define separator pattern based on mode
|
||||||
separator = r"[.!?]" if self.subtitle_mode == "Sentence" else r"[.!?,]"
|
if self.subtitle_mode == "Line":
|
||||||
|
separator = r"\n"
|
||||||
|
elif self.subtitle_mode == "Sentence":
|
||||||
|
separator = r"[.!?]"
|
||||||
|
else: # Sentence + Comma
|
||||||
|
separator = r"[.!?,]"
|
||||||
current_sentence = []
|
current_sentence = []
|
||||||
word_count = 0
|
word_count = 0
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -953,6 +953,7 @@ class abogen(QWidget):
|
|||||||
self.subtitle_combo.setToolTip(
|
self.subtitle_combo.setToolTip(
|
||||||
"Choose how subtitles will be generated:\n"
|
"Choose how subtitles will be generated:\n"
|
||||||
"Disabled: No subtitles will be generated.\n"
|
"Disabled: No subtitles will be generated.\n"
|
||||||
|
"Line: Subtitles will be generated for each line.\n"
|
||||||
"Sentence: Subtitles will be generated for each sentence.\n"
|
"Sentence: Subtitles will be generated for each sentence.\n"
|
||||||
"Sentence + Comma: Subtitles will be generated for each sentence and comma.\n"
|
"Sentence + Comma: Subtitles will be generated for each sentence and comma.\n"
|
||||||
"Sentence + Highlighting: Subtitles with word-by-word karaoke highlighting.\n"
|
"Sentence + Highlighting: Subtitles with word-by-word karaoke highlighting.\n"
|
||||||
@@ -963,7 +964,7 @@ class abogen(QWidget):
|
|||||||
for lang in SUPPORTED_LANGUAGES_FOR_SUBTITLE_GENERATION
|
for lang in SUPPORTED_LANGUAGES_FOR_SUBTITLE_GENERATION
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
subtitle_options = ["Disabled", "Sentence", "Sentence + Comma", "Sentence + Highlighting"] + [
|
subtitle_options = ["Disabled", "Line", "Sentence", "Sentence + Comma", "Sentence + Highlighting"] + [
|
||||||
f"{i} word" if i == 1 else f"{i} words" for i in range(1, 11)
|
f"{i} word" if i == 1 else f"{i} words" for i in range(1, 11)
|
||||||
]
|
]
|
||||||
self.subtitle_combo.addItems(subtitle_options)
|
self.subtitle_combo.addItems(subtitle_options)
|
||||||
|
|||||||
Reference in New Issue
Block a user