Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion buzz/plugins/skip_already_transcribed/plugin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import glob
import logging
import os
import re
Expand Down Expand Up @@ -89,7 +90,7 @@ def _find_result_file_segments(self, file_path: str, task, context: PluginContex
if not search_dir.is_dir():
continue
for fmt in OutputFormat:
for candidate in search_dir.glob(f"{stem}*.{fmt.value}"):
for candidate in search_dir.glob(f"{glob.escape(stem)}*.{fmt.value}"):
segments = self._parse_result_file(candidate, fmt, context)
if segments is not None:
return segments
Expand Down
16 changes: 16 additions & 0 deletions tests/plugins/plugin_system_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,22 @@ def test_sat_skips_on_vtt_file(tmp_path):
assert result[1].start == 3000


def test_sat_skips_on_srt_file_with_brackets_in_name(tmp_path):
plugin = _sat_plugin()
audio = tmp_path / "Interview [Part 1].mp3"
audio.write_bytes(b"")
srt = tmp_path / "Interview [Part 1] (transcribed on 01-Jan-2024 12-00-00).srt"
srt.write_text(
"1\n00:00:01,000 --> 00:00:03,500\nHello there.\n\n",
encoding="utf-8",
)

ctx = _sat_context(config={"check_result_files": True, "check_database": False})
result = plugin.check_skip(_SatTask(file_path=str(audio)), ctx)
assert result is not None
assert result[0].text == "Hello there."


def test_sat_returns_none_when_result_files_disabled(tmp_path):
plugin = _sat_plugin()
audio = tmp_path / "audio.mp3"
Expand Down