Skip to content

Commit

Permalink
Merge pull request #7 from ccos89/master
Browse files Browse the repository at this point in the history
Corrected UTF-8 Encoding
  • Loading branch information
kanjieater authored Dec 9, 2023
2 parents 7c03338 + 32c6f7c commit 5042f23
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions align.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ def recursively_find_match(script, subs, result, first_script, last_script, firs
# t.refresh()

def run(split_script, subs_file, out, mode=2):
with open(split_script) as s:
with open(split_script, encoding='utf-8') as s:
script = [ScriptLine(line.strip()) for line in read_script(s)]
print(subs_file)
with open(subs_file) as vtt:
with open(subs_file, encoding='utf-8') as vtt:
subs = read_vtt(vtt)
new_subs = []

Expand Down
2 changes: 1 addition & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def combine_vtt(vtt_files, offsets, output_file_path):
subs = []

for n, vtt_file in enumerate(vtt_files):
with open(vtt_file) as vtt:
with open(vtt_file, encoding='utf-8') as vtt:
latest_subs = read_vtt(vtt)
last_offset = offsets[n]
subs += adjust_timings(latest_subs, last_offset)
Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def read_vtt(file):


def write_sub(output_file_path, subs):
with open(output_file_path, "w") as outfile:
with open(output_file_path, "w", encoding='utf-8') as outfile:
outfile.write('WEBVTT\n\n')
for n, sub in enumerate(subs):
# outfile.write('%d\n' % (n + 1))
Expand Down

0 comments on commit 5042f23

Please sign in to comment.