Skip to content

Instantly share code, notes, and snippets.

@patrick91
Created June 9, 2016 09:59
Show Gist options
  • Save patrick91/37d0eb7e7e1303eb314a313107196d9b to your computer and use it in GitHub Desktop.
Save patrick91/37d0eb7e7e1303eb314a313107196d9b to your computer and use it in GitHub Desktop.
import sys
import glob
def add_line(filename):
out = []
with open(filename) as f:
for l in f:
if '-->' in l:
out.append('{} line:90%\n'.format(l.rstrip()))
else:
out.append(l)
return ''.join(out)
files = glob.glob('*.vtt')
for f in files:
edited = add_line(f)
with open(f, 'w') as n:
n.write(edited)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment