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.2.1.tar.gz (7.0 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pysrt-0.2.1.tar.gz
Algorithm Hash digest
SHA256 825242c4fecb8e45744ad6be20da4782c77968dc25d57e06bc764ccedba9d140
MD5 8eb363f9e53927eec429a759e2a982f1
BLAKE2b-256 63196652c18ba11ca1394a0669c070a5df27ab36ccc3950c41b07d9b3155531f

See more details on using hashes here.

Supported by

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