Attempt to fix encoding problems with caption conversion (#92, #98, #97)

pull/166/head
Puyodead1 2023-02-02 17:54:46 -05:00
parent d8b5d3ca0e
commit f321791819
No known key found for this signature in database
GPG Key ID: BA5F91AAEF68E5CE
1 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ def convert(directory, filename):
index = 0
vtt_filepath = os.path.join(directory, filename + ".vtt")
srt_filepath = os.path.join(directory, filename + ".srt")
srt = open(srt_filepath, mode="w", errors="ignore")
srt = open(srt_filepath, mode='w', encoding='utf8', errors='ignore')
for caption in WebVTT().read(vtt_filepath):
index += 1
@ -17,4 +17,4 @@ def convert(directory, filename):
end = SubRipTime(0, 0, caption.end_in_seconds)
srt.write(
SubRipItem(index, start, end, html.unescape(
caption.text)).__str__() + "\n")
caption.text)).__str__() + "\n")