Prefixless subtitle sidecar files
This commit is contained in:
@@ -421,6 +421,59 @@ class SubtrackMappingBundleTests(unittest.TestCase):
|
||||
self.assertIn("external subtitle payload", extracted_subtitle)
|
||||
self.assertNotIn("embedded subtitle payload", extracted_subtitle)
|
||||
|
||||
def test_subtitle_directory_without_prefix_uses_source_basename(self):
|
||||
source_filename = "basename_substitute.mkv"
|
||||
subtitle_directory = self.workdir / "sidecars"
|
||||
subtitle_directory.mkdir()
|
||||
source_path = create_source_fixture(
|
||||
self.workdir,
|
||||
source_filename,
|
||||
[
|
||||
SourceTrackSpec(TrackType.VIDEO, identity="video-0"),
|
||||
SourceTrackSpec(TrackType.AUDIO, identity="audio-1", language="eng"),
|
||||
SourceTrackSpec(
|
||||
TrackType.SUBTITLE,
|
||||
identity="embedded-subtitle",
|
||||
language="eng",
|
||||
subtitle_lines=("embedded subtitle payload",),
|
||||
),
|
||||
],
|
||||
)
|
||||
write_vtt(
|
||||
subtitle_directory / "basename_substitute_2_deu_DEF.vtt",
|
||||
("external subtitle payload",),
|
||||
)
|
||||
|
||||
completed = run_ffx_convert(
|
||||
self.workdir,
|
||||
self.home_dir,
|
||||
self.database_path,
|
||||
"--video-encoder",
|
||||
"copy",
|
||||
"--no-pattern",
|
||||
"--no-tmdb",
|
||||
"--no-prompt",
|
||||
"--no-signature",
|
||||
"--subtitle-directory",
|
||||
str(subtitle_directory),
|
||||
str(source_path),
|
||||
)
|
||||
self.assertCompleted(completed)
|
||||
self.assertIn("matched subtitle tracks #2", completed.stdout)
|
||||
self.assertIn("Substituting subtitle stream #2", completed.stdout)
|
||||
|
||||
output_path = expected_output_path(self.workdir, source_filename)
|
||||
subtitle_stream = [
|
||||
stream
|
||||
for stream in ffprobe_json(output_path)["streams"]
|
||||
if stream["codec_type"] == "subtitle"
|
||||
][0]
|
||||
self.assertEqual("deu", get_tag(subtitle_stream, "language"))
|
||||
|
||||
extracted_subtitle = extract_first_subtitle_text(self.workdir, output_path)
|
||||
self.assertIn("external subtitle payload", extracted_subtitle)
|
||||
self.assertNotIn("embedded subtitle payload", extracted_subtitle)
|
||||
|
||||
def test_subtitle_prefix_uses_configured_base_directory_when_directory_is_omitted(self):
|
||||
source_filename = "substitute_default_s01e01.mkv"
|
||||
subtitle_prefix = "substitute_default"
|
||||
|
||||
Reference in New Issue
Block a user