mirror of
https://github.com/jasons-gh/the-chomsky-index.git
synced 2026-03-11 08:54:36 +00:00
Convert all files in the same folder
This commit is contained in:
parent
49d0f505b1
commit
80e98d9d36
1 changed files with 2 additions and 5 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Reference in a new issue