skip to navigation
skip to content

pysrt 0.2.1

SubRip (.srt) subtitle parser and writer

Latest Version: 0.2.2

pysrt is a Python library used to edit or create SubRip files.

Usage

from pysrt import SubRipFile, SubRipItem, SubRipTime
subs = SubRipFile('some/file.srt')
subs[42].end.hours += 3
subs[42].sub_title = "Never end !"

#equivalent

part = SubRipFile(i for i in subs if i.end > SubRipTime(0, 0, 40))
part = SubRipFile(i for i in subs if i.end > (0, 0, 40))
part = SubRipFile(i for i in subs if i.end > {'seconds': 40})
part = subs.slice(ends_after={'seconds': 40})  # but better way

part.shift(seconds=-2)
subs.save('other/path.srt', 'utf-8')
File Type Py Version Uploaded on Size # downloads
pysrt-0.2.1.tar.gz (md5) Source 2009-11-05 15:16:29.102114 6KB 28

Log in to rate this package.