Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change line length for scc input validation #318

Merged
merged 3 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pycaption/scc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def read(self, content, lang='en-US', simulate_roll_up=False, offset=0):
for caption in self.caption_stash._collection:
caption_text = "".join(caption.to_real_caption().get_text_nodes())
lines.extend(caption_text.split("\n"))
lines_too_long = [line for line in lines if len(line) >= 32]
lines_too_long = [line for line in lines if len(line) > 32]

if bool(lines_too_long):
msg = ""
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/scc.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def sample_scc_with_line_too_long():

00:00:01;45 9420 91f4 cb45 4c4c d920 4ac1 cd45 d3ba 20c8 eff7 9254 f468 e520 7368 eff7 2073 f461 f2f4 e564 942c 8080 8080 942f

00:00:02;55 9420 91e0 9723 f761 7320 4361 ec20 c4e5 6ee9 73ef 6e2c 2061 20e6 f2e9 e56e 6480 9240 9723 efe6 20ef 75f2 732c 20f7 6173 2064 efe9 6e67 206d 7920 43c4 73ae 942c 8080 8080 942f
00:00:02;55 9420 91e0 9723 f761 7320 4361 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 ec20 c4e5 6ee9 73ef 6e2c 2061 20e6 f2e9 e56e 6480 9240 9723 efe6 20ef 75f2 732c 20f7 6173 2064 efe9 6e67 206d 7920 43c4 73ae 942c 8080 8080 942f

00:00:06;57 9420 94e0 c16e 6420 68e5 2073 61e9 642c 2049 20e3 616e 2064 ef20 6120 54d6 2073 68ef f7ae 942c 8080 8080 942f

Expand Down
3 changes: 2 additions & 1 deletion tests/test_scc.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,8 @@ def test_line_too_long(self, sample_scc_with_line_too_long):

assert exc_info.value.args[0].startswith(
"32 character limit for caption cue in scc file.")
assert "And he said, I can do a TV show. - Length 32" in exc_info.value.args[0].split("\n")
assert ("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 Denison, a friend - Length 81"
in exc_info.value.args[0].split("\n"))


class TestCoverageOnly:
Expand Down
Loading