Skip to main content

SubRip (.srt) subtitle parser and writer

Project description

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')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysrt-0.1.7.tar.gz (4.2 kB view details)

Uploaded Source

File details

Details for the file pysrt-0.1.7.tar.gz.

File metadata

  • Download URL: pysrt-0.1.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pysrt-0.1.7.tar.gz
Algorithm Hash digest
SHA256 9f58e43baa7357b9c4a5652352790f7c0490513bbb0ad85c2daf0e917b0e55b8
MD5 2bdcf1e7e7d31126673e72755f5353d5
BLAKE2b-256 32a05dfad6ba29e9362772e605e0ad89fb2db214330e066fa48302cfe81733c5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page