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.
Files changed (57) hide show
  1. {pycaption-2.2.23/pycaption.egg-info → pycaption-2.2.24}/PKG-INFO +1 -1
  2. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/__init__.py +9 -1
  3. {pycaption-2.2.23 → pycaption-2.2.24/pycaption.egg-info}/PKG-INFO +1 -1
  4. {pycaption-2.2.23 → pycaption-2.2.24}/setup.py +1 -1
  5. {pycaption-2.2.23 → pycaption-2.2.24}/tests/conftest.py +1 -0
  6. {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/scc.py +10 -0
  7. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_scc.py +18 -0
  8. {pycaption-2.2.23 → pycaption-2.2.24}/LICENSE +0 -0
  9. {pycaption-2.2.23 → pycaption-2.2.24}/MANIFEST.in +0 -0
  10. {pycaption-2.2.23 → pycaption-2.2.24}/README.rst +0 -0
  11. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/__init__.py +0 -0
  12. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/base.py +0 -0
  13. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/dfxp/__init__.py +0 -0
  14. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/dfxp/base.py +0 -0
  15. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/dfxp/extras.py +0 -0
  16. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/exceptions.py +0 -0
  17. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/geometry.py +0 -0
  18. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/microdvd.py +0 -0
  19. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/sami.py +0 -0
  20. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/constants.py +0 -0
  21. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/specialized_collections.py +0 -0
  22. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/state_machines.py +0 -0
  23. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/scc/translator.py +0 -0
  24. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/srt.py +0 -0
  25. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/transcript.py +0 -0
  26. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/utils.py +0 -0
  27. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption/webvtt.py +0 -0
  28. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption.egg-info/SOURCES.txt +0 -0
  29. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption.egg-info/dependency_links.txt +0 -0
  30. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption.egg-info/requires.txt +0 -0
  31. {pycaption-2.2.23 → pycaption-2.2.24}/pycaption.egg-info/top_level.txt +0 -0
  32. {pycaption-2.2.23 → pycaption-2.2.24}/setup.cfg +0 -0
  33. {pycaption-2.2.23 → pycaption-2.2.24}/tests/__init__.py +0 -0
  34. {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/__init__.py +0 -0
  35. {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/dfxp.py +0 -0
  36. {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/microdvd.py +0 -0
  37. {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/sami.py +0 -0
  38. {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/srt.py +0 -0
  39. {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/translated_scc.py +0 -0
  40. {pycaption-2.2.23 → pycaption-2.2.24}/tests/fixtures/webvtt.py +0 -0
  41. {pycaption-2.2.23 → pycaption-2.2.24}/tests/mixins.py +0 -0
  42. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_base.py +0 -0
  43. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_dfxp.py +0 -0
  44. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_dfxp_conversion.py +0 -0
  45. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_dfxp_extras.py +0 -0
  46. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_functions.py +0 -0
  47. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_geometry.py +0 -0
  48. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_microdvd.py +0 -0
  49. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_microdvd_conversion.py +0 -0
  50. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_sami.py +0 -0
  51. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_sami_conversion.py +0 -0
  52. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_scc_conversion.py +0 -0
  53. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_scc_translator.py +0 -0
  54. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_srt.py +0 -0
  55. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_srt_conversion.py +0 -0
  56. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_webvtt.py +0 -0
  57. {pycaption-2.2.23 → pycaption-2.2.24}/tests/test_webvtt_conversion.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycaption
3
- Version: 2.2.23
3
+ Version: 2.2.24
4
4
  Summary: Closed caption converter
5
5
  Author: Joe Norton
6
6
  Author-email: joey@nortoncrew.com
@@ -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
- next_command = word_list[idx + 1] if idx + 1 < len(word_list) else None
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pycaption
3
- Version: 2.2.23
3
+ Version: 2.2.24
4
4
  Summary: Closed caption converter
5
5
  Author: Joe Norton
6
6
  Author-email: joey@nortoncrew.com
@@ -20,7 +20,7 @@ transcript_dependencies = ["nltk==3.9.4"]
20
20
 
21
21
  setup(
22
22
  name="pycaption",
23
- version="2.2.23",
23
+ version="2.2.24",
24
24
  description="Closed caption converter",
25
25
  long_description=open(README_PATH).read(),
26
26
  author="Joe Norton",
@@ -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