Fixed appendLine due to stable-ts update
This commit is contained in:
23
subgen.py
23
subgen.py
@@ -138,16 +138,21 @@ TIME_OFFSET = 5
|
|||||||
|
|
||||||
def appendLine(result):
|
def appendLine(result):
|
||||||
if append:
|
if append:
|
||||||
lastSegment = result.segments[-1].copy()
|
lastSegment = result.segments[-1]
|
||||||
lastSegment.id += 1
|
|
||||||
lastSegment.start += TIME_OFFSET
|
|
||||||
lastSegment.end += TIME_OFFSET
|
|
||||||
date_time_str = datetime.now().strftime("%d %b %Y - %H:%M:%S")
|
date_time_str = datetime.now().strftime("%d %b %Y - %H:%M:%S")
|
||||||
lastSegment.text = f"Transcribed by whisperAI with faster-whisper ({whisper_model}) on {date_time_str}"
|
appended_text = f"Transcribed by whisperAI with faster-whisper ({whisper_model}) on {date_time_str}"
|
||||||
lastSegment.words = []
|
|
||||||
# lastSegment.words[0].word = lastSegment.text
|
# Create a new segment with the updated information
|
||||||
# lastSegment.words = lastSegment.words[:len(lastSegment.words)-1]
|
newSegment = Segment(
|
||||||
result.segments.append(lastSegment)
|
start=lastSegment.start + TIME_OFFSET,
|
||||||
|
end=lastSegment.end + TIME_OFFSET,
|
||||||
|
text=appended_text,
|
||||||
|
words=[], # Empty list for words
|
||||||
|
id=lastSegment.id + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
# Append the new segment to the result's segments
|
||||||
|
result.segments.append(newSegment)
|
||||||
|
|
||||||
@app.get("/plex")
|
@app.get("/plex")
|
||||||
@app.get("/webhook")
|
@app.get("/webhook")
|
||||||
|
|||||||
Reference in New Issue
Block a user