You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
309 B
Python
12 lines
309 B
Python
6 years ago
|
import pysrt, argparse
|
||
|
|
||
|
ap = argparse.ArgumentParser("srttojs")
|
||
|
ap.add_argument("srt")
|
||
|
args = ap.parse_args()
|
||
|
|
||
|
srt= pysrt.open(args.srt)
|
||
|
print("<div class='sub'>")
|
||
|
for t in srt:
|
||
|
print ('<div><a data-start="{1}" href="#">{0}</a> {2}</div>'.format(t.start, t.start.ordinal/1000.0, t.text))
|
||
|
print ("</div>")
|