Python library for easier management and processing of subtitle files.
Project description
Sublib
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
Installation
Download the latest version from PyPi
python -m pip install sublib
Testing
Perform the tests with pytest
and pytest-mock
python -m pytest tests
Basic usage
First of all, import the package
import sublib
Each of the supported formats of subtitles is represent by its class
# Create a subtitle instance
subtitle = sublib.SubRip("subtitle.srt", "utf-8")
All subtitles classes have a few methods
and attributes
# Get object content in a universal format
general = subtitle.get_general_format()
# Set a new object from this format
another_subtitle = sublib.MicroDVD()
another_subtitle.set_from_general_format(general)
# Print subtitle lines
print(another_subtitle.content)
Advanced usage
Please, take a look if you need more details
Contributing
Pull requests are welcome!
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
sublib-1.2.1.tar.gz
(18.6 kB
view details)
Built Distribution
sublib-1.2.1-py3-none-any.whl
(17.7 kB
view details)
File details
Details for the file sublib-1.2.1.tar.gz
.
File metadata
- Download URL: sublib-1.2.1.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.4.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a041287d77087685272b88b4cbc01435b67d08f0088a0f757688a6fad4b8864 |
|
MD5 | 1b8376a3b18c0b14290c274b23cb0815 |
|
BLAKE2b-256 | 645967e0e54d8d606b4c58766aba6d49bcde2a809a5a155f62b930d80f765b33 |
File details
Details for the file sublib-1.2.1-py3-none-any.whl
.
File metadata
- Download URL: sublib-1.2.1-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.4.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6eb38bea3ab2aa47de3719d9fdcb5ce09df4f34145199dcf160fb44cbe555e7f |
|
MD5 | b99e5f10a03166c0574fb48201737e1b |
|
BLAKE2b-256 | 37686f3befb492e46625eef9d7c8c0416b17a62fcc4c154cbf90a443fd11074d |