Actually fix

This commit is contained in:
rany 2021-07-11 17:17:03 +03:00
parent 5f02c6a5cc
commit 6fbf875673
2 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
[metadata]
name = edge-tts
version = 2.2.0
version = 2.2.1
author = rany
author_email = ranygh@riseup.net
description = Microsoft Edge's TTS

View File

@ -76,6 +76,7 @@ async def list_voices():
class SubMaker:
def __init__(self, overlapping=5):
self.subsAndOffset = []
self.brokenOffset = []
self.overlapping = (overlapping * (10**7))
def formatter(self, offset1, offset2, subdata):
@ -85,8 +86,9 @@ class SubMaker:
def createSub(self, timestamp, text):
if len(self.subsAndOffset) >= 2:
if self.subsAndOffset[-2] >= timestamp:
timestamp = timestamp + self.subsAndOffset[-2]
if self.subsAndOffset[-2] >= timestamp + sum(self.brokenOffset):
self.brokenOffset.append(self.subsAndOffset[-2])
timestamp = timestamp + sum(self.brokenOffset)
self.subsAndOffset.append(timestamp)
self.subsAndOffset.append(text)