Giter VIP home page Giter VIP logo

pytitle's Introduction

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

pytitle's People

Contributors

sina-e avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.