This commit is contained in:
rany2
2022-07-27 20:17:42 +03:00
parent 3a4595d6d6
commit 93f2e452ce
2 changed files with 8 additions and 8 deletions

View File

@@ -242,7 +242,7 @@ class Communicate:
word_boundary = str(word_boundary).lower() word_boundary = str(word_boundary).lower()
websocket_max_size = 2**16 websocket_max_size = 2 ** 16
overhead_per_message = ( overhead_per_message = (
len( len(
ssml_headers_plus_data( ssml_headers_plus_data(
@@ -337,9 +337,9 @@ class Communicate:
metadata_duration = metadata["Metadata"][0]["Data"][ metadata_duration = metadata["Metadata"][0]["Data"][
"Duration" "Duration"
] ]
metadata_text = metadata["Metadata"][0]["Data"]["text"][ metadata_text = metadata["Metadata"][0]["Data"][
"Text" "text"
] ]["Text"]
yield ( yield (
[ [
metadata_offset, metadata_offset,

View File

@@ -28,9 +28,9 @@ def mktimestamp(time_unit):
Returns: Returns:
str: The timecode of the subtitle. str: The timecode of the subtitle.
""" """
hour = math.floor(time_unit / 10**7 / 3600) hour = math.floor(time_unit / 10 ** 7 / 3600)
minute = math.floor((time_unit / 10**7 / 60) % 60) minute = math.floor((time_unit / 10 ** 7 / 60) % 60)
seconds = (time_unit / 10**7) % 60 seconds = (time_unit / 10 ** 7) % 60
return f"{hour:02d}:{minute:02d}:{seconds:06.3f}" return f"{hour:02d}:{minute:02d}:{seconds:06.3f}"
@@ -48,7 +48,7 @@ class SubMaker:
subtitles should overlap. subtitles should overlap.
""" """
self.subs_and_offset = [] self.subs_and_offset = []
self.overlapping = overlapping * (10**7) self.overlapping = overlapping * (10 ** 7)
def create_sub(self, timestamp, text): def create_sub(self, timestamp, text):
""" """