Skip to content

Commit

Permalink
move to constants cue starting codes
Browse files Browse the repository at this point in the history
  • Loading branch information
OlteanuRares committed May 28, 2024
1 parent 1dd94d2 commit 5c12b60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pycaption/scc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
MICROSECONDS_PER_CODEWORD, CHARACTER_TO_CODE,
SPECIAL_OR_EXTENDED_CHAR_TO_CODE, PAC_BYTES_TO_POSITIONING_MAP,
PAC_HIGH_BYTE_BY_ROW, PAC_LOW_BYTE_BY_ROW_RESTRICTED,
PAC_TAB_OFFSET_COMMANDS,
PAC_TAB_OFFSET_COMMANDS, CUE_STARTING_COMMAND
)
from .specialized_collections import ( # noqa: F401
TimingCorrectingCaptionList, NotifyingDict, CaptionCreator,
Expand Down Expand Up @@ -355,16 +355,15 @@ def _handle_double_command(self, word):
# If we have doubled commands we're skipping also
# doubled special characters and doubled extended characters
# with only one member of each pair being displayed.
cue_starter_commands = ['9425', '9426', '94a7', '9429', '9420']
doubled_types = word != "94a1" and word in COMMANDS or _is_pac_command(word)
if self.double_starter:
doubled_types = doubled_types or word in EXTENDED_CHARS or word == "94a1"

if word in cue_starter_commands and word != self.last_command:
if word in CUE_STARTING_COMMAND and word != self.last_command:
self.double_starter = False

if doubled_types and word == self.last_command:
if word in cue_starter_commands:
if word in CUE_STARTING_COMMAND:
self.double_starter = True
self.last_command = ''
return True
Expand Down
2 changes: 2 additions & 0 deletions pycaption/scc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1058,3 +1058,5 @@ def _restructure_bytes_to_position_map(byte_to_pos_map):
"10a7", "10a8", "1029", "102a", "10ab", "102c", "10ad",
"10ae", "102f", "97ad"
]

CUE_STARTING_COMMAND = ['9425', '9426', '94a7', '9429', '9420']

0 comments on commit 5c12b60

Please sign in to comment.