diff --git a/convert.py b/convert.py index 7185355..16d469c 100644 --- a/convert.py +++ b/convert.py @@ -1,11 +1,8 @@ -import pathlib import pysubs2 from datetime import datetime from pathlib import Path -pathlib.Path(Path(__file__).parent / 'cnt').mkdir(parents=True, exist_ok=True) - # Files auto-generated by YT have each subtitle line repeating 3 times, once at # the end of a pair, once by itself and once at the beginning of a pair. # But sometimes only the first case (end of a pair) exists, which are lines @@ -54,10 +51,10 @@ for srt_file in [x for x in Path(__file__).parent.glob('**/*.srt') if x.is_file( # Make .en.cnt with lines then times - with open(str(Path(__file__).parent / 'cnt') + '\\' + srt_file.name[:-7] + '.en.cnt', 'a') as cnt_file: + with open(str(Path(__file__).parent) + '\\' + srt_file.name[:-7] + '.en.cnt', 'a') as cnt_file: for i in lines: cnt_file.write(i) - with open(str(Path(__file__).parent / 'cnt') + '\\' + srt_file.name[:-7] + '.en.cnt', 'a') as cnt_file: + with open(str(Path(__file__).parent) + '\\' + srt_file.name[:-7] + '.en.cnt', 'a') as cnt_file: for i in times: cnt_file.write(str(i))