pycaption 2.2.23__tar.gz → 2.2.24__tar.gz
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.
- {pycaption-2.2.23/pycaption.egg-info → pycaption-2.2.24}/PKG-INFO +1 -1
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/__init__.py +9 -1
- {pycaption-2.2.23 → pycaption-2.2.24/pycaption.egg-info}/PKG-INFO +1 -1
- {pycaption-2.2.23 → pycaption-2.2.24}/setup.py +1 -1
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/conftest.py +1 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/scc.py +10 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_scc.py +18 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/LICENSE +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/MANIFEST.in +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/README.rst +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/__init__.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/base.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/dfxp/__init__.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/dfxp/base.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/dfxp/extras.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/exceptions.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/geometry.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/microdvd.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/sami.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/constants.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/specialized_collections.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/state_machines.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/translator.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/srt.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/transcript.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/utils.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/webvtt.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption.egg-info/SOURCES.txt +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption.egg-info/dependency_links.txt +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption.egg-info/requires.txt +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/pycaption.egg-info/top_level.txt +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/setup.cfg +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/__init__.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/__init__.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/dfxp.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/microdvd.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/sami.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/srt.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/translated_scc.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/webvtt.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/mixins.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_base.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_dfxp.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_dfxp_conversion.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_dfxp_extras.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_functions.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_geometry.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_microdvd.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_microdvd_conversion.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_sami.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_sami_conversion.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_scc_conversion.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_scc_translator.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_srt.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_srt_conversion.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_webvtt.py +0 -0
- {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_webvtt_conversion.py +0 -0
|
@@ -332,7 +332,15 @@ class SCCReader(BaseReader):
|
|
|
332
332
|
for idx, word in enumerate(word_list):
|
|
333
333
|
word = word.strip()
|
|
334
334
|
if len(word) == 4:
|
|
335
|
-
|
|
335
|
+
# Look ahead for the next command, skipping the duplicate
|
|
336
|
+
# that SCC uses for error-correction (same word repeated).
|
|
337
|
+
next_idx = idx + 1
|
|
338
|
+
if (next_idx < len(word_list)
|
|
339
|
+
and word_list[next_idx].strip() == word):
|
|
340
|
+
next_idx += 1
|
|
341
|
+
next_command = (
|
|
342
|
+
word_list[next_idx] if next_idx < len(word_list) else None
|
|
343
|
+
)
|
|
336
344
|
self._translate_word(word=word, next_command=next_command)
|
|
337
345
|
|
|
338
346
|
def _translate_word(self, word, next_command=None):
|
|
@@ -91,6 +91,7 @@ from tests.fixtures.scc import ( # noqa: F401
|
|
|
91
91
|
sample_no_positioning_at_all_scc,
|
|
92
92
|
sample_scc_created_dfxp_with_wrongly_closing_spans,
|
|
93
93
|
sample_scc_duplicate_special_characters,
|
|
94
|
+
sample_scc_doubled_mid_row_before_punctuation,
|
|
94
95
|
sample_scc_duplicate_tab_offset,
|
|
95
96
|
sample_scc_empty,
|
|
96
97
|
sample_scc_eoc_first_command,
|
|
@@ -659,3 +659,13 @@ Scenarist_SCC V1.0
|
|
|
659
659
|
00:00:04;00 942c
|
|
660
660
|
|
|
661
661
|
"""
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
@pytest.fixture(scope="session")
|
|
665
|
+
def sample_scc_doubled_mid_row_before_punctuation():
|
|
666
|
+
return """\
|
|
667
|
+
Scenarist_SCC V1.0
|
|
668
|
+
|
|
669
|
+
00:26:48;29\t9420 9420 94d0 94d0 97a1 97a1 3e3e 2057 e5a7 ecec 2062 e520 6261 e36b 206e e5f8 f420 f7e5 e56b 20f7 e9f4 6880 9470 9470 616e eff4 68e5 f220 e570 e973 ef64 e520 efe6 91ae 91ae 4361 6e61 6461 2046 e9ec e573 9120 9120 ae80 942c 942c 8080 8080 942f 942f
|
|
670
|
+
|
|
671
|
+
"""
|
|
@@ -392,6 +392,24 @@ class TestSCCReader(ReaderTestingMixIn):
|
|
|
392
392
|
]
|
|
393
393
|
assert expected_lines == actual_lines
|
|
394
394
|
|
|
395
|
+
def test_doubled_mid_row_before_punctuation_no_extra_space(
|
|
396
|
+
self,
|
|
397
|
+
sample_scc_doubled_mid_row_before_punctuation,
|
|
398
|
+
):
|
|
399
|
+
caption_set = SCCReader().read(
|
|
400
|
+
sample_scc_doubled_mid_row_before_punctuation
|
|
401
|
+
)
|
|
402
|
+
captions = caption_set.get_captions("en-US")
|
|
403
|
+
text_nodes = [
|
|
404
|
+
node.content
|
|
405
|
+
for cap_ in captions
|
|
406
|
+
for node in cap_.nodes
|
|
407
|
+
if node.type_ == CaptionNode.TEXT
|
|
408
|
+
]
|
|
409
|
+
full_text = "".join(text_nodes)
|
|
410
|
+
assert " ." not in full_text
|
|
411
|
+
assert full_text.endswith("Files.")
|
|
412
|
+
|
|
395
413
|
def test_removing_spaces_at_end_of_lines(
|
|
396
414
|
self,
|
|
397
415
|
sample_scc_with_spaces_at_eol_pop,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|