Skip to content

Commit

Permalink
always skip special characters, bump version to 2.2.15.dev1
Browse files Browse the repository at this point in the history
  • Loading branch information
OlteanuRares committed Oct 1, 2024
1 parent 6c98733 commit 61d027f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changelog
---------
2.2.15
^^^^^^
- Always skip doubled special characters, not just in case the cue starters are doubled.

2.2.14
^^^^^^
- Fix an issue with WebVTT writer text positioning on break inside a cue.
Expand Down
3 changes: 1 addition & 2 deletions pycaption/scc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,12 @@ def _handle_double_command(self, word):
# doubled special characters and doubled extended characters
# with only one member of each pair being displayed.

doubled_types = word != "94a1" and word in COMMANDS or _is_pac_command(word)
doubled_types = (word != "94a1" and word in COMMANDS) or _is_pac_command(word) or word in SPECIAL_CHARS
if self.double_starter:
doubled_types = (
doubled_types
or word in EXTENDED_CHARS
or word == "94a1"
or word in SPECIAL_CHARS
)

if word in CUE_STARTING_COMMAND and word != self.last_command:
Expand Down
2 changes: 1 addition & 1 deletion pycaption/scc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ def _restructure_bytes_to_position_map(byte_to_pos_map):

# taken from
# http://www.theneitherworld.com/mcpoodle/SCC_TOOLS/DOCS/CC_CHARS.HTML
INCONVERTIBLE_TO_ASCII_EXTENDED_CHARS_ASSOCIATION = {
SUBSTITUTE_CHARACTERS = {
'¡': ["!", "i"], # inverted exclamation mark
'¤': ["C"], # currency
'¥': ["Y"], # yen
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

setup(
name="pycaption",
version="2.2.14",
version="2.2.15.dev1",
description="Closed caption converter",
long_description=open(README_PATH).read(),
author="Joe Norton",
Expand Down
8 changes: 8 additions & 0 deletions tests/fixtures/scc.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ def sample_scc_roll_up_ru2():
00:00:13;07 9425 9425 94ad 94ad 9470 9470 c1c2 c3c4 c580 91bf
00:00:13;15 9425 9425 94ad 94ad 9470 9470 9137
00:00:13;20 9425 9425 94ad 94ad 9470 9470 9137 9137
00:00:13;25 9425 9425 94ad 94ad 9470 9470 9137 9137 9137
00:00:13;40 9425 9425 94ad 94ad 9470 9470 9137 9137 9137 9137
00:00:14;07 9425 9425 94ad 94ad 9470 9470 9220 9220 92a1 92a2 92a7
00:00:17;01 9426 9426 94ad 94ad 9470 9470 57c8 4552 4520 d94f d5a7 5245 20d3 54c1 cec4 49ce c720 ce4f 572c
Expand Down
8 changes: 7 additions & 1 deletion tests/test_scc.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,12 @@ def test_freeze_rollup_captions_contents(self, sample_scc_roll_up_ru2):
"AND IMPROVING THE LIVES OF ALL",
"WE SERVE.",
"®°½",
"®°½½",
"®°½",
"ABû",
'♪',
'♪',
'♪♪',
'♪♪',
"ÁÉÓ¡",
"WHERE YOU'RE STANDING NOW,",
"LOOKING OUT THERE, THAT'S AL",
Expand All @@ -430,6 +434,8 @@ def test_freeze_rollup_captions_contents(self, sample_scc_roll_up_ru2):
"And wildlife.",
">> Bike Iowa, your source for",
]
for x in actual_texts:
print(x)
assert expected_texts == actual_texts

def test_multiple_formats(self, sample_scc_multiple_formats):
Expand Down

0 comments on commit 61d027f

Please sign in to comment.