From 5c12b60c142cb2b14accfd27ab6c1e574404d1ad Mon Sep 17 00:00:00 2001 From: OlteanuRares Date: Tue, 28 May 2024 16:38:34 +0300 Subject: [PATCH] move to constants cue starting codes --- pycaption/scc/__init__.py | 7 +++---- pycaption/scc/constants.py | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pycaption/scc/__init__.py b/pycaption/scc/__init__.py index ff5d12a1..d7defbda 100644 --- a/pycaption/scc/__init__.py +++ b/pycaption/scc/__init__.py @@ -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, @@ -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 diff --git a/pycaption/scc/constants.py b/pycaption/scc/constants.py index feb089b4..bc2fcd50 100644 --- a/pycaption/scc/constants.py +++ b/pycaption/scc/constants.py @@ -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']