pycaption 2.2.4__tar.gz → 2.2.6__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.4/pycaption.egg-info → pycaption-2.2.6}/PKG-INFO +1 -1
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/scc/__init__.py +18 -10
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/scc/constants.py +0 -1
- {pycaption-2.2.4 → pycaption-2.2.6/pycaption.egg-info}/PKG-INFO +1 -1
- {pycaption-2.2.4 → pycaption-2.2.6}/setup.py +1 -1
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_scc.py +3 -2
- {pycaption-2.2.4 → pycaption-2.2.6}/LICENSE +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/MANIFEST.in +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/README.rst +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/__init__.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/base.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/dfxp/__init__.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/dfxp/base.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/dfxp/extras.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/english.pickle +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/exceptions.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/geometry.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/microdvd.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/sami.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/scc/specialized_collections.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/scc/state_machines.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/scc/translator.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/srt.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/transcript.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/utils.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption/webvtt.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption.egg-info/SOURCES.txt +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption.egg-info/dependency_links.txt +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption.egg-info/requires.txt +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/pycaption.egg-info/top_level.txt +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/setup.cfg +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/__init__.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/conftest.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/fixtures/__init__.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/fixtures/dfxp.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/fixtures/microdvd.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/fixtures/sami.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/fixtures/scc.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/fixtures/srt.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/fixtures/translated_scc.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/fixtures/webvtt.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/mixins.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_base.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_dfxp.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_dfxp_conversion.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_dfxp_extras.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_functions.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_geometry.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_microdvd.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_microdvd_conversion.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_sami.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_sami_conversion.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_scc_conversion.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_scc_translator.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_srt.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_srt_conversion.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_webvtt.py +0 -0
- {pycaption-2.2.4 → pycaption-2.2.6}/tests/test_webvtt_conversion.py +0 -0
|
@@ -81,11 +81,11 @@ http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/SCC_FORMAT.HTML
|
|
|
81
81
|
import math
|
|
82
82
|
import re
|
|
83
83
|
import textwrap
|
|
84
|
-
from collections import deque
|
|
84
|
+
from collections import deque, defaultdict
|
|
85
85
|
from copy import deepcopy
|
|
86
86
|
|
|
87
87
|
from pycaption.base import (
|
|
88
|
-
BaseReader, BaseWriter, CaptionSet
|
|
88
|
+
BaseReader, BaseWriter, CaptionSet
|
|
89
89
|
)
|
|
90
90
|
from pycaption.exceptions import CaptionReadNoCaptions, InvalidInputError, \
|
|
91
91
|
CaptionReadTimingError, CaptionLineLengthError
|
|
@@ -232,16 +232,24 @@ class SCCReader(BaseReader):
|
|
|
232
232
|
captions = CaptionSet({lang: self.caption_stash.get_all()})
|
|
233
233
|
|
|
234
234
|
# check captions for incorrect lengths
|
|
235
|
-
|
|
235
|
+
lines_too_long = defaultdict(list)
|
|
236
236
|
for caption in self.caption_stash._collection:
|
|
237
|
+
caption_start = caption.to_real_caption().format_start()
|
|
237
238
|
caption_text = "".join(caption.to_real_caption().get_text_nodes())
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
239
|
+
text_too_long = [line for line in caption_text.split("\n") if len(line) > 32]
|
|
240
|
+
if caption_start in lines_too_long:
|
|
241
|
+
lines_too_long[caption_start] = text_too_long
|
|
242
|
+
else:
|
|
243
|
+
lines_too_long[caption_start].extend(text_too_long)
|
|
244
|
+
|
|
245
|
+
msg = ""
|
|
246
|
+
if bool(lines_too_long.keys()):
|
|
247
|
+
for key in lines_too_long:
|
|
248
|
+
if lines_too_long[key]:
|
|
249
|
+
msg += f"around {key} - "
|
|
250
|
+
for line in lines_too_long[key]:
|
|
251
|
+
msg += line + f" - Length { len(line)}" + "\n"
|
|
252
|
+
if len(msg):
|
|
245
253
|
raise CaptionLineLengthError(
|
|
246
254
|
f"32 character limit for caption cue in scc file.\n"
|
|
247
255
|
f"Lines longer than 32:\n"
|
|
@@ -250,8 +250,9 @@ class TestSCCReader(ReaderTestingMixIn):
|
|
|
250
250
|
|
|
251
251
|
assert exc_info.value.args[0].startswith(
|
|
252
252
|
"32 character limit for caption cue in scc file.")
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
str_to_check = ("around 00:00:05.900 - was Cal l l l l l l l l l l l l l l l l l l l l l l l l l l l l "
|
|
254
|
+
"Denison, a friend - Length 81")
|
|
255
|
+
assert str_to_check in exc_info.value.args[0].split("\n")
|
|
255
256
|
|
|
256
257
|
|
|
257
258
|
class TestCoverageOnly:
|
|
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
|
|
File without changes
|
|
File without changes
|