Skip to main content

Subtitle manipulation library for Python

PyPI PyPI - Downloads PyPI - Python Version Codecov coverage PyPI - License Read the Docs GitHub issues

PyTitle is a subtitle manipulation library for python, it's built on top of Pydantic.

note that development of this project is just started and it's not anywhere near complete or ready for production code. use it at your own risk

what this library can do?

well, it's able to do a lot of things, and more in the future, but for now:

  • search for a text or pattern in a subtitle.
  • shift all the timestaps, or just one timestap to forward or backward.
  • split the subtitle from an index or timestamp.
  • fix common problems in a subtitle, such as:
    • re-index .srt subtitles.
    • remove or fix italic, bold and other formatting tags.
    • add coloring or other formattings to a subtitle.
    • fix enconding problems.
    • fix arabic charachters, question marks and other formattings for persian subtitles.
    • fix overlays in timestamps.

Installing PyTitle

pip install pytitle

Quick start

For now, the only supported subtitle format is .srt. other formats will be added to the library soon.

Open a .srt Subtitle:

from pytitle.srt import SrtSubtitle

subtitle = SrtSubtitle.open("~/path/to/subtitle.srt")

shift all the timestamps for the opened subtitle 2 seconds forward:

subtitle.shift_forward(seconds=2)

or you can shift only one line, for example the 10th line(.srt indexes start at 1):

subtitle.shift_forward(seconds=2, index=10)

and when you done editing, save the file:

subtitle.save()

the above method will override the existing file, if you want to save the file in a different place or seperately:

subtitle.save(path="~/path/to/edited_subtitle.srt")

Read the full documentation and tutorial here.

supported formats:

  • srt
  • ass
  • vtt

Release files for pytitle 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytitle 0.1.6
File Size Uploaded
pytitle-0.1.6.tar.gz 10.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytitle 0.1.6
File Interpreter ABI Platform
pytitle-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / pytitle-0.1.6.tar.gz

Download URL pytitle-0.1.6.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ec561cdce27e6b4bf7305613703db481e590e875a021c181b9345871749b1817
BLAKE2b-256 checksum
How to use checksums
a0933307892fe7d5736247af795e306d26f1576826eab7c479327b3ca416232a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

Release files / pytitle-0.1.6-py3-none-any.whl

Download URL pytitle-0.1.6-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df9289011fafea2084985c3b82f92cc661d3fa53a933f0215313dab01e4fc5ca
BLAKE2b-256 checksum
How to use checksums
929adcd6c5c3e2130ce70ea3af175075616c915328f89360c07e5fc3a639bab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page