Python library for easier management and processing of subtitle files. Easily manage their content and conveniently use it in your own projects.
Features
- Read files data
- Convert subtitles formats
- Process content separated into lines
- Search for strings in data
- Acquire specific lines
- Detect used format
Download the latest version from PyPi
python -m pip install sublibPerform the tests with pytest and pytest-mock
python -m pytest testsFirst of all, import the package
importsublibEach of the supported formats of subtitles is represent by its class
# Create a subtitle instancesubtitle=sublib.SubRip("subtitle.srt", "utf-8")All subtitles classes have a few methods and attributes
# Get object content in a universal formatgeneral=subtitle.get_general_format()
# Set a new object from this formatanother_subtitle=sublib.MicroDVD()
another_subtitle.set_from_general_format(general)
# Print subtitle linesprint(another_subtitle.content)Please, take a look if you need more details
Pull requests are welcome!