Created
January 30, 2017 22:55
-
-
Save danilkuznetsov/9b1205621b96aeefaa95d97594825b7a to your computer and use it in GitHub Desktop.
convert sbv to srt subtitles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import glob | |
import os | |
from captionstransformer.sbv import Reader | |
from captionstransformer.srt import Writer | |
for source_filename in glob.glob('*.sbv'): | |
print source_filename | |
r = open(source_filename) | |
reader = Reader(r) | |
path=source_filename+'1' | |
if not os.path.exists(path): | |
os.makedirs(path) | |
w = open(os.path.join(path, 'captions.srt'), 'w') | |
writer = Writer(w) | |
writer.set_captions(reader.read()) | |
writer.write() | |
writer.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment