Skip to content

Commit

Permalink
change method name and extract unhandled commands into constamt
Browse files Browse the repository at this point in the history
  • Loading branch information
OlteanuRares committed Dec 5, 2023
1 parent 8a5661c commit 7d758a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pycaption/scc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _translate_line(self, line):
self._translate_word(word)

def _translate_word(self, word):
if self._handle_double_command(word):
if self._skip_double_command(word):
# count frames for timing
self.time_translator.increment_frames()
return
Expand All @@ -316,7 +316,7 @@ def _translate_word(self, word):
# count frames for timing only after processing a command
self.time_translator.increment_frames()

def _handle_double_command(self, word):
def _skip_double_command(self, word):
# If the caption is to be broadcast, each of the commands are doubled
# up for redundancy in case the signal is garbled in transmission.
# The decoder is programmed to ignore a second command when it is the
Expand Down
2 changes: 2 additions & 0 deletions pycaption/scc/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,3 +985,5 @@ def _restructure_bytes_to_position_map(byte_to_pos_map):


HEADER = 'Scenarist_SCC V1.0'

UNHANDLED_COMMANDS = ["9120", "91ae", "912f", "91a1"]
4 changes: 2 additions & 2 deletions pycaption/scc/specialized_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from .constants import (
PAC_BYTES_TO_POSITIONING_MAP, COMMANDS, PAC_TAB_OFFSET_COMMANDS,
MICROSECONDS_PER_CODEWORD,
MICROSECONDS_PER_CODEWORD, UNHANDLED_COMMANDS
)

PopOnCue = collections.namedtuple("PopOnCue", "buffer, start, end")
Expand Down Expand Up @@ -342,7 +342,7 @@ def interpret_command(self, command):
:type command: str
"""
if command not in ["9120", "91ae", "912f", "91a1"]:
if command not in UNHANDLED_COMMANDS:
self._update_positioning(command)
text = COMMANDS.get(command, '')
if 'italic' in text:
Expand Down

0 comments on commit 7d758a2

Please sign in to comment.