pycaption 2.2.25__tar.gz → 2.2.27__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.25/pycaption.egg-info → pycaption-2.2.27}/PKG-INFO +1 -1
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/geometry.py +10 -4
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/specialized_collections.py +10 -6
- pycaption-2.2.27/pycaption/webvtt.py +857 -0
- {pycaption-2.2.25 → pycaption-2.2.27/pycaption.egg-info}/PKG-INFO +1 -1
- {pycaption-2.2.25 → pycaption-2.2.27}/setup.py +1 -1
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/conftest.py +2 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/webvtt.py +35 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_scc.py +4 -4
- pycaption-2.2.27/tests/test_webvtt.py +714 -0
- pycaption-2.2.27/tests/test_webvtt_conversion.py +252 -0
- pycaption-2.2.25/pycaption/webvtt.py +0 -467
- pycaption-2.2.25/tests/test_webvtt.py +0 -204
- pycaption-2.2.25/tests/test_webvtt_conversion.py +0 -116
- {pycaption-2.2.25 → pycaption-2.2.27}/LICENSE +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/MANIFEST.in +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/README.rst +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/__init__.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/base.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/dfxp/__init__.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/dfxp/base.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/dfxp/extras.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/exceptions.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/microdvd.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/sami.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/__init__.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/constants.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/state_machines.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/scc/translator.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/srt.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/transcript.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption/utils.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption.egg-info/SOURCES.txt +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption.egg-info/dependency_links.txt +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption.egg-info/requires.txt +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/pycaption.egg-info/top_level.txt +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/setup.cfg +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/__init__.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/__init__.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/dfxp.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/microdvd.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/sami.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/scc.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/srt.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/fixtures/translated_scc.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/mixins.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_base.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_dfxp.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_dfxp_conversion.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_dfxp_extras.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_functions.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_geometry.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_microdvd.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_microdvd_conversion.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_sami.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_sami_conversion.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_scc_conversion.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_scc_translator.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_scc_writer.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_srt.py +0 -0
- {pycaption-2.2.25 → pycaption-2.2.27}/tests/test_srt_conversion.py +0 -0
|
@@ -213,9 +213,15 @@ class Stretch(TwoDimensionalObject):
|
|
|
213
213
|
|
|
214
214
|
|
|
215
215
|
class Region:
|
|
216
|
-
"""Represents the spatial coordinates of a rectangle
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
"""Represents the spatial coordinates of a rectangle.
|
|
217
|
+
|
|
218
|
+
NOTE: This class is currently dead code — not imported or used anywhere in
|
|
219
|
+
the codebase. It also contains known bugs (align_from_origin returns
|
|
220
|
+
inconsistent types, add_extent method does not exist on Point). We left it
|
|
221
|
+
here because it may serve as a starting point if we ever need geometric
|
|
222
|
+
rectangle operations beyond what Layout class provides (e.g. region
|
|
223
|
+
intersection or point-in-region checks).
|
|
224
|
+
If we'll ever need it, fix the bugs first.
|
|
219
225
|
"""
|
|
220
226
|
|
|
221
227
|
@classmethod
|
|
@@ -846,7 +852,7 @@ class Layout:
|
|
|
846
852
|
found_absolute_unit = False
|
|
847
853
|
if bottom_right.x.unit != UnitEnum.PERCENT:
|
|
848
854
|
found_absolute_unit = True
|
|
849
|
-
elif bottom_right.
|
|
855
|
+
elif bottom_right.y.unit != UnitEnum.PERCENT:
|
|
850
856
|
found_absolute_unit = True
|
|
851
857
|
|
|
852
858
|
if found_absolute_unit:
|
|
@@ -26,6 +26,9 @@ from .constants import (
|
|
|
26
26
|
|
|
27
27
|
PopOnCue = collections.namedtuple("PopOnCue", "buffer, start, end")
|
|
28
28
|
|
|
29
|
+
# First two hex chars of SCC codes that produce punctuation ['.', '!', '?', ',']
|
|
30
|
+
_PUNCTUATION_PREFIXES = frozenset(["ae", "a1", "bf", "2c"])
|
|
31
|
+
|
|
29
32
|
|
|
30
33
|
class PreCaption:
|
|
31
34
|
"""
|
|
@@ -444,8 +447,7 @@ class InstructionNodeCreator:
|
|
|
444
447
|
# handle mid-row codes that follows a text node
|
|
445
448
|
# don't add space if the next command adds one of
|
|
446
449
|
# ['.', '!', '?', ',']
|
|
447
|
-
|
|
448
|
-
next_is_punctuation = next_command and next_command[:2] in punctuation
|
|
450
|
+
next_is_punctuation = next_command and next_command[:2] in _PUNCTUATION_PREFIXES
|
|
449
451
|
prev_text_node = self.get_previous_text_node()
|
|
450
452
|
prev_node_is_break = prev_text_node is not None and any(
|
|
451
453
|
x.is_explicit_break()
|
|
@@ -501,9 +503,9 @@ class InstructionNodeCreator:
|
|
|
501
503
|
if len(collection) == 0:
|
|
502
504
|
return False
|
|
503
505
|
for element in collection[::-1]:
|
|
504
|
-
if element._type ==
|
|
506
|
+
if element._type == _InstructionNode.TEXT:
|
|
505
507
|
return False
|
|
506
|
-
elif element._type ==
|
|
508
|
+
elif element._type == _InstructionNode.BREAK:
|
|
507
509
|
return True
|
|
508
510
|
return False
|
|
509
511
|
|
|
@@ -782,6 +784,8 @@ def _format_italics(collection):
|
|
|
782
784
|
|
|
783
785
|
|
|
784
786
|
def _remove_spaces_at_end_of_the_line(collection):
|
|
787
|
+
if not collection:
|
|
788
|
+
return collection
|
|
785
789
|
for idx, node in enumerate(collection):
|
|
786
790
|
if (
|
|
787
791
|
idx > 0
|
|
@@ -826,7 +830,7 @@ def _remove_noop_on_off_italics(collection):
|
|
|
826
830
|
return new_collection
|
|
827
831
|
|
|
828
832
|
|
|
829
|
-
def
|
|
833
|
+
def _remove_noop_off_on_italics(collection):
|
|
830
834
|
"""Removes pairs of off-on italics nodes, that don't surround any other
|
|
831
835
|
node
|
|
832
836
|
|
|
@@ -867,7 +871,7 @@ def _remove_noop_italics(collection):
|
|
|
867
871
|
"""
|
|
868
872
|
new_collection = _remove_noop_on_off_italics(collection)
|
|
869
873
|
|
|
870
|
-
new_collection =
|
|
874
|
+
new_collection = _remove_noop_off_on_italics(new_collection)
|
|
871
875
|
|
|
872
876
|
return new_collection
|
|
873
877
|
|