Skip to main content

Subtitle manipulation library for python.

Project description

PyPI PyPI - Downloads PyPI - Python Version 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 tutorialhere.

supported formats:

  • ☒ srt

  • ☐ ass

  • ☐ vtt

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

pytitle-0.1.4.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

pytitle-0.1.4-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file pytitle-0.1.4.tar.gz.

File metadata

  • Download URL: pytitle-0.1.4.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pytitle-0.1.4.tar.gz
Algorithm Hash digest
SHA256 211a4d0dd521f5badb2e8aab9b206d8de48e7ca20f44ca379e5b2912d42a868c
MD5 8e774b5c8a2950d63b48a5c34d373fd6
BLAKE2b-256 8ecb156c537f82ffdc69342f200d865343fafebeddb68eb4e859b65edb5ef426

See more details on using hashes here.

File details

Details for the file pytitle-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pytitle-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pytitle-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 17a3a9362c2191861707c2bdc5ef6ea2d093d6bf2d5b702d6be5bf3ae959a92a
MD5 95d6a90f0cf84fddf87030641673a18a
BLAKE2b-256 d22841ddeec1f00ad76d3da3b7c992aa8d758f22b0bf5d27d7006e9db5cad836

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